A tiny bit of code reorganization.
This commit is contained in:
parent
7857d66376
commit
6377a626b6
20
ratatoskr.sh
20
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user