From 6377a626b64d170cb9ad3d4d1d5ea1c1371afd33 Mon Sep 17 00:00:00 2001 From: stormdragon2976 Date: Mon, 30 Jan 2023 12:54:28 -0500 Subject: [PATCH] A tiny bit of code reorganization. --- ratatoskr.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/ratatoskr.sh b/ratatoskr.sh index ec463b9..d9266e1 100755 --- a/ratatoskr.sh +++ b/ratatoskr.sh @@ -59,6 +59,9 @@ get_oauth_token() { play_sound() { + if [[ "${enable_sound}" == "false" ]]; then + return + fi local soundFile="${configPath}/soundpacks/${sound_pack:-default}/${1}.opus" if [[ -e "${soundFile}" ]]; then sox -qV0 "${soundFile}" -d &> /dev/null & @@ -90,7 +93,6 @@ scrobble_music() { fi echo "Track scrobbled!" play_sound scrobble - exit 0 } @@ -119,8 +121,7 @@ post_music() { exit 1 fi echo "Music posted!" - play_sound post - exit 0 + play_sound post_music } @@ -151,7 +152,6 @@ local json="$(jq -n --arg status "$text" \ fi echo "Status posted!" play_sound post - exit 0 } @@ -206,9 +206,15 @@ while getopts "${args}" i ; do case "$i" in C) get_oauth_token;; h) help;; - M) post_music;; - p) post_status "${OPTARG}";; - S) scrobble_music;; + M) + post_music + exit 0;; + p) + post_status "${OPTARG}" + exit 0;; + S) + scrobble_music + exit 0;; esac done