aboutsummaryrefslogtreecommitdiff
path: root/scripts/save-video-in-game-folder.sh
blob: 3d07d6ac4c16461f613d92d48c269cbe53521c5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh

filepath="$1"
type="$2"

file_name="$(basename "$filepath")"
file_dir="$(dirname "$filepath")"

game_name=$(gsr-window-name focused || echo "Game")
game_name="$(echo "$game_name" | tr '/\\' '_')"
target_dir="$file_dir/$game_name"
new_filepath="$target_dir/$file_name"

mkdir -p "$target_dir"
mv "$filepath" "$new_filepath"

[ "$GSR_SHOW_SAVED_NOTIFICATION" != "1" ] && exit 0

case "$type" in
    "regular")
        gsr-notify --text "Saved recording to '$game_name/$file_name'" --timeout 3.0 --icon record --bg-color "$GSR_NOTIFY_BG_COLOR"
        ;;
    "replay")
        gsr-notify --text "Saved replay to '$game_name/$file_name'" --timeout 3.0 --icon replay --bg-color "$GSR_NOTIFY_BG_COLOR"
        ;;
esac