Created
October 26, 2011 22:53
-
-
Save usure/1318262 to your computer and use it in GitHub Desktop.
cmus twitter bash script
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
#cmus and ttytter must be installed | |
#Full twitter intergration coming soon to script. (No need for ttytter) | |
PROGRAM='cmus' | |
#DIRECTORY="$HOME/log" | |
if ps ax | grep -v grep | grep $PROGRAM > /dev/null | |
then | |
echo "CMUS is running" | |
else | |
echo "cmus is not running! Start cmus and then try again." | |
exit 1 | |
fi | |
#Uncomment below. if you want logging | |
#if [ -d "$DIRECTORY" ]; then #If log file does not exist. Create it | |
# echo "Log file exists!" | |
#else | |
# touch log | |
#fi | |
# echo "Printing to twitter." | |
while : | |
do | |
ARTIST=$( cmus-remote -Q 2>/dev/null | grep artist | cut -d " " -f 3- ) | |
TITLE=$( cmus-remote -Q 2>/dev/null | grep title | cut -d " " -f 3- ) | |
ttytter -status="#nowplaying >> #$TITLE - #$ARTIST." > /dev/null/ | |
#echo "Checking for new song" | |
sleep 3 | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment