Advertisement
Guest User

mewsic

a guest
Dec 15th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.80 KB | None | 0 0
  1. #!/usr/bin/env sh
  2.  
  3. db=$HOME/music.txt
  4. timestamp=$(date +"%y%m%d%H%M")
  5.  
  6. report=$(cmus-remote -Q | head -n 7)
  7. track=$(echo "$report" | grep tag)
  8. status=$(echo "$report" | grep status | awk '{gsub("status ", "");print}')
  9. duration=$(echo "$report" | grep duration | awk '{gsub("duration ", "");print}')
  10. position=$(echo "$report" | grep position | awk '{gsub("position ", "");print}')
  11.  
  12. artist=$(printf "$track" | grep --text '^tag artist' | awk '{gsub("tag artist ", "");print}')
  13. album=$(printf "$track" | grep --text '^tag album' | awk '{gsub("tag album ", "");print}')
  14. song=$(printf "$track" | grep --text '^tag title' | awk '{gsub("tag title ", "");print}')
  15.  
  16. 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