This commit is contained in:
Errol Sancaktar 2024-08-20 12:33:21 -06:00
parent 792b0cce2b
commit 2ed964f198
2 changed files with 32 additions and 38 deletions

View File

@ -67,25 +67,25 @@ set_volume() {
start_spotify() {
display "Starting Spotify"
tmux new-window -n $TARGET_NAME $TARGET_COMMAND &&
tmux swap-window -s $TARGET_NAME -t 1
display "Spotify Window Created"
until [ "$(check_running)" = "1" ]; do
display "Waiting for Spotify"
sleep 1
done
display "Starting Liked Playlist"
$TARGET_COMMAND playback start liked -r --limit=$LIMIT
until [ "$(get_volume)" != "Spotify Not Running" ]; do
display "Checking Initial Volume"
sleep 1
done
display "Checking Volume"
current_volume="$(get_volume)"
if [ "$current_volume" != "$VOLUME" ]; then
display $current_volume
$($TARGET_COMMAND playback volume $VOLUME)
fi
tmux new-window -n $TARGET_NAME $TARGET_COMMAND &&
tmux swap-window -s $TARGET_NAME -t 1
display "Spotify Window Created"
until [ "$(check_running)" = "1" ]; do
display "Waiting for Spotify"
sleep 1
done
display "Starting Liked Playlist"
$TARGET_COMMAND playback start liked -r --limit=$LIMIT
until [ "$(get_volume)" != "Spotify Not Running" ]; do
display "Checking Initial Volume"
sleep 1
done
display "Checking Volume"
current_volume="$(get_volume)"
if [ "$current_volume" != "$VOLUME" ]; then
display $current_volume
$($TARGET_COMMAND playback volume $VOLUME)
fi
}
restart_spotify() {
@ -134,22 +134,22 @@ else
fi
echo "$1"
case "$1" in
"n")
$TARGET_COMMAND playback next && set_volume
"n")
$TARGET_COMMAND playback next && set_volume
;;
"p")
$TARGET_COMMAND playback previous && set_volume
"p")
$TARGET_COMMAND playback previous && set_volume
;;
"s")
$TARGET_COMMAND playback play-pause && set_volume
"s")
$TARGET_COMMAND playback play-pause && set_volume
;;
"r")
restart_spotify
"r")
restart_spotify
;;
*)
echo "Usage: $0 [-n|-p|-s|-v]"
exit 1
*)
echo "Usage: $0 [-n|-p|-s|-v]"
exit 1
;;
esac
fi

File diff suppressed because one or more lines are too long