Last active
September 2, 2021 09:27
-
-
Save Donearm/1035677 to your computer and use it in GitHub Desktop.
Script to capture info on currently playing song in MPD, add an (optional) prefix and/or suffix and tweet it all via TTYtter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Script to capture info on currently playing song in MPD, add an | |
# (optional) prefix and/or suffix and tweet it all via TTYtter (which | |
# must be of course already been configured) | |
# | |
# Dependencies: TTYtter, a MPD client that can output song info (I use | |
# ncmpcpp) | |
PREFIX='on air: ' # what should go before the now playing string | |
SUFFIX=' #NP' # what should go after the now playing string | |
# save the now playing string from the mpd client of choice (it and | |
# format can be of course changed according to one's tastes | |
NP=$(ncmpcpp --current-song "%a - %t") | |
if [ -z $NP ]; then | |
echo "Can't get the current song, is MPD playing?" | |
echo "Or perhaps the MPD client isn't working/displaying song info correctly?" | |
exit 1 | |
else | |
continue | |
fi | |
STATUS="${PREFIX}${NP}${SUFFIX}" | |
echo $STATUS | |
ttytter -rc=-donearm -script -status="$STATUS" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Update the gist, thanks @masala-man!