Skip to content

Instantly share code, notes, and snippets.

@rochacbruno
Forked from joariasl/cmus_to_file.sh
Created March 28, 2020 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rochacbruno/c0007db986c163d96dcd265ae3e09d87 to your computer and use it in GitHub Desktop.
Save rochacbruno/c0007db986c163d96dcd265ae3e09d87 to your computer and use it in GitHub Desktop.
cmus player playing now to temp file from OBS
#!/usr/bin/env sh
file=/tmp/cmus_playing.txt
while true
do
music=""
if cmus-remote -C status | grep -q playing; then
music=$(cmus-remote -Q | grep -e "tag title" -e "tag artist" | sed "s/^tag\s\w*\s//g" | sed "N;s/\n/ - /g")
if (( ${#music} > 0 )); then
music="Now playing: $music"
fi
fi
echo $music > $file
sleep 5s
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment