Last active
March 28, 2020 20:23
-
-
Save joariasl/e2ce4fe850ae079cb1d5 to your computer and use it in GitHub Desktop.
cmus player playing now to temp file from OBS
This file contains hidden or 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
#!/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
For execute process in background:
$ nohup ./cmus_to_file.sh&