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

File diff suppressed because one or more lines are too long