Skip to content

Instantly share code, notes, and snippets.

@joariasl
Last active March 28, 2020 20:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save joariasl/e2ce4fe850ae079cb1d5 to your computer and use it in GitHub Desktop.
Save joariasl/e2ce4fe850ae079cb1d5 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
@joariasl
Copy link
Author

For execute process in background:

$ nohup ./cmus_to_file.sh&

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment