Advertisement
Guest User

VLC metadata to Conky

a guest
Sep 1st, 2010
799
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.18 KB | None | 0 0
  1. #!/bin/bash
  2. # I made this script to have vlc metadata in conky
  3. # Just add "${execpi 300 /path-of-this-script/vlc2conky.sh --artist}" to have the artist metadata
  4. # If you have more than one vlc instance the script will work with the first listed by "ps -eF"
  5. # If you change the name of the script don't forget to change the last "grep -v" with the correct name of the script
  6. # Licence : GPL v3
  7. # by Dgellow Jons , 1 September 2010
  8.  
  9. t=`ps -eF|grep vlc|grep -v grep|grep -v vlc2conky.sh`
  10.  
  11. # Function to extract the metadata
  12. Extraction()
  13. {
  14. t=${t#*vlc}
  15. metadata=`exiftool -$metadata $t`
  16. metadata=${metadata#*:}
  17. if [ "$metadata" ]; then
  18.     echo $metadata
  19. else
  20.     echo "UNKNOWN"
  21. fi
  22. return
  23. }
  24.  
  25. if test $# -ne 1; then
  26.     echo "C'thulu's Avatar says : \"Give me one option if you want my services ! GHUAAAAA ! \""
  27.     exit 0
  28. fi
  29.  
  30. # Test if vlc is running
  31. if [ "$t" ]
  32. then
  33.     # Test the option
  34.     case $1 in
  35.         "--artist")metadata="Artist"
  36.                    Extraction;;
  37.         "--album") metadata="Album"
  38.                     Extraction;;
  39.         "--title") metadata="Title"
  40.                    Extraction;;
  41.         "--file") echo ${t##*/};;
  42.         *) echo "Bad option. --title, --artist or --album"
  43.     esac
  44. else
  45.     echo "VLC is not running"
  46. fi
  47.  
  48. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement