Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env sh
- db=$HOME/music.txt
- timestamp=$(date +"%y%m%d%H%M")
- report=$(cmus-remote -Q | head -n 7)
- track=$(echo "$report" | grep tag)
- status=$(echo "$report" | grep status | awk '{gsub("status ", "");print}')
- duration=$(echo "$report" | grep duration | awk '{gsub("duration ", "");print}')
- position=$(echo "$report" | grep position | awk '{gsub("position ", "");print}')
- artist=$(printf "$track" | grep --text '^tag artist' | awk '{gsub("tag artist ", "");print}')
- album=$(printf "$track" | grep --text '^tag album' | awk '{gsub("tag album ", "");print}')
- song=$(printf "$track" | grep --text '^tag title' | awk '{gsub("tag title ", "");print}')
- printf "%s %s %s/%s %s %s %s %s\n" "$timestamp" "$status" "$position" "$duration" "$song" "$album" "$artist" "$albumartist" | tee -a "$db"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement