A tiny bit of code reorganization.

This commit is contained in:
stormdragon2976 2023-01-30 12:54:28 -05:00
parent 7857d66376
commit 6377a626b6
1 changed files with 13 additions and 7 deletions

View File

@ -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