Guest User

Untitled

a guest
Jul 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #!/bin/sh
  2. database="$HOME/.mpd.db"
  3.  
  4. LC_ALL="C"
  5.  
  6. number_of() {
  7. local N=$(grep "$1" "$database" | sort | uniq | wc -l)
  8. echo $N
  9. }
  10.  
  11. most_from() {
  12. local most=$(grep "$1" "$database" | sort | uniq -c | sort -r | head -1 | cut -d ':' -f 2-)
  13. echo $most
  14. }
  15.  
  16. echo
  17. echo "tracks : $(number_of '^Title: ')"
  18. echo "artists : $(number_of '^Artist: ')"
  19. echo "albums : $(number_of '^Album: ')"
  20. echo
  21. echo "most from artist : $(most_from '^Artist: ')"
  22. echo "most from year : $(most_from '^Date: ')"
  23. echo "most from genre : $(most_from '^Genre: ')"
  24. echo
Add Comment
Please, Sign In to add comment