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() {
|
play_sound() {
|
||||||
|
if [[ "${enable_sound}" == "false" ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
local soundFile="${configPath}/soundpacks/${sound_pack:-default}/${1}.opus"
|
local soundFile="${configPath}/soundpacks/${sound_pack:-default}/${1}.opus"
|
||||||
if [[ -e "${soundFile}" ]]; then
|
if [[ -e "${soundFile}" ]]; then
|
||||||
sox -qV0 "${soundFile}" -d &> /dev/null &
|
sox -qV0 "${soundFile}" -d &> /dev/null &
|
||||||
@ -90,7 +93,6 @@ scrobble_music() {
|
|||||||
fi
|
fi
|
||||||
echo "Track scrobbled!"
|
echo "Track scrobbled!"
|
||||||
play_sound scrobble
|
play_sound scrobble
|
||||||
exit 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -119,8 +121,7 @@ post_music() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Music posted!"
|
echo "Music posted!"
|
||||||
play_sound post
|
play_sound post_music
|
||||||
exit 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -151,7 +152,6 @@ local json="$(jq -n --arg status "$text" \
|
|||||||
fi
|
fi
|
||||||
echo "Status posted!"
|
echo "Status posted!"
|
||||||
play_sound post
|
play_sound post
|
||||||
exit 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -206,9 +206,15 @@ while getopts "${args}" i ; do
|
|||||||
case "$i" in
|
case "$i" in
|
||||||
C) get_oauth_token;;
|
C) get_oauth_token;;
|
||||||
h) help;;
|
h) help;;
|
||||||
M) post_music;;
|
M)
|
||||||
p) post_status "${OPTARG}";;
|
post_music
|
||||||
S) scrobble_music;;
|
exit 0;;
|
||||||
|
p)
|
||||||
|
post_status "${OPTARG}"
|
||||||
|
exit 0;;
|
||||||
|
S)
|
||||||
|
scrobble_music
|
||||||
|
exit 0;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user