Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 8th, 2008  |  syntax: None  |  size: 3.32 KB  |  views: 164  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/bash
  2. # amaroK info display script by eirc <eirc.eirc@gmail.com>
  3. #
  4. # requirements: amaroK (!)
  5. # for Collection stats to work amarok must be using
  6. # mySQL to store it's collection
  7.  
  8. case "$1" in
  9.  
  10. # Now Playing Info
  11. artist) dcop amarok player artist ;;
  12. title)  dcop amarok player title ;;
  13. album)  dcop amarok player album ;;
  14. year)   dcop amarok player year ;;
  15. genre)  dcop amarok player genre ;;
  16. progress)
  17.     curr=`dcop amarok player trackCurrentTime`
  18.     tot=`dcop amarok player trackTotalTime`
  19.     if (( $tot )); then
  20.         expr $curr \* 100  / $tot
  21.     fi
  22.     ;;
  23. rating)
  24. rate=`dcop amarok player rating`
  25. if [ $rate == "0" ];
  26.         then echo "N/A"
  27. else
  28.         echo $rate"/10";
  29. fi      
  30. ;;
  31.  
  32. # Collection Info
  33. totalArtists)      dcop amarok collection totalArtists ;;
  34. totalAlbums)       dcop amarok collection totalAlbums ;;
  35. totalTracks)       dcop amarok collection totalTracks ;;
  36. totalGenres)       dcop amarok collection totalGenres ;;
  37. totalCompilations) dcop amarok collection totalCompilations ;;
  38.  
  39. # Collection Stats
  40. most_songs_by_artist) dcop amarok collection query 'SELECT t1.name FROM artist t1 INNER JOIN tags t2 ON t1.id = t2.artist GROUP BY t2.artist ORDER BY COUNT(t2.artist) DESC LIMIT 1;' ;;
  41. most_songs_by_artist_n) dcop amarok collection query 'SELECT count(t2.artist) FROM artist t1 INNER JOIN tags t2 ON t1.id = t2.artist GROUP BY t2.artist ORDER BY COUNT(t2.artist) DESC LIMIT 1;' ;;
  42. most_songs_are_genre) dcop amarok collection query 'SELECT t1.name FROM genre t1 INNER JOIN tags t2 ON t1.id = t2.genre GROUP BY t2.genre ORDER BY COUNT(t2.genre) DESC LIMIT 1;' ;;
  43. most_songs_are_genre_n) dcop amarok collection query 'SELECT count(t2.genre) FROM genre t1 INNER JOIN tags t2 ON t1.id = t2.genre GROUP BY t2.genre ORDER BY COUNT(t2.genre) DESC LIMIT 1;' ;;
  44. most_songs_during_year) dcop amarok collection query 'SELECT t1.name FROM year t1 INNER JOIN tags t2 ON t1.id = t2.year GROUP BY t2.year ORDER BY COUNT(t2.year) DESC LIMIT 1;' ;;
  45. most_songs_during_year_n) dcop amarok collection query 'SELECT count(t2.year) FROM year t1 INNER JOIN tags t2 ON t1.id = t2.year GROUP BY t2.year ORDER BY COUNT(t2.year) DESC LIMIT 1;' ;;
  46. most_albums_by_artist) dcop amarok collection query 'SELECT name FROM artist WHERE id=(SELECT t1.artist from (SELECT artist FROM tags GROUP BY album) AS t1 GROUP BY t1.artist ORDER BY count(artist) DESC LIMIT 1);' ;;
  47. most_albums_by_artist_n) dcop amarok collection query 'SELECT count(artist) from (SELECT artist FROM tags GROUP BY album) AS t1 GROUP BY t1.artist ORDER BY count(artist) DESC LIMIT 1;' ;;
  48. most_albums_are_genre) dcop amarok collection query 'SELECT name FROM genre WHERE id=(SELECT t1.genre from (SELECT genre FROM tags GROUP BY album) AS t1 GROUP BY t1.genre ORDER BY count(genre) DESC LIMIT 1);' ;;
  49. most_albums_are_genre_n) dcop amarok collection query 'SELECT count(genre) from (SELECT genre FROM tags GROUP BY album) AS t1 GROUP BY t1.genre ORDER BY count(genre) DESC LIMIT 1;' ;;
  50. most_albums_during_year) dcop amarok collection query 'SELECT name FROM year WHERE id=(SELECT t1.year from (SELECT year FROM tags GROUP BY album) AS t1 GROUP BY t1.year ORDER BY count(year) DESC LIMIT 1);' ;;
  51. most_albums_during_year_n) dcop amarok collection query 'SELECT count(year) from (SELECT year FROM tags GROUP BY album) AS t1 GROUP BY t1.year ORDER BY count(year) DESC LIMIT 1;' ;;
  52.  
  53. esac