Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # I made this script to have vlc metadata in conky
- # Just add "${execpi 300 /path-of-this-script/vlc2conky.sh --artist}" to have the artist metadata
- # If you have more than one vlc instance the script will work with the first listed by "ps -eF"
- # If you change the name of the script don't forget to change the last "grep -v" with the correct name of the script
- # Licence : GPL v3
- # by Dgellow Jons , 1 September 2010
- t=`ps -eF|grep vlc|grep -v grep|grep -v vlc2conky.sh`
- # Function to extract the metadata
- Extraction()
- {
- t=${t#*vlc}
- metadata=`exiftool -$metadata $t`
- metadata=${metadata#*:}
- if [ "$metadata" ]; then
- echo $metadata
- else
- echo "UNKNOWN"
- fi
- return
- }
- if test $# -ne 1; then
- echo "C'thulu's Avatar says : \"Give me one option if you want my services ! GHUAAAAA ! \""
- exit 0
- fi
- # Test if vlc is running
- if [ "$t" ]
- then
- # Test the option
- case $1 in
- "--artist")metadata="Artist"
- Extraction;;
- "--album") metadata="Album"
- Extraction;;
- "--title") metadata="Title"
- Extraction;;
- "--file") echo ${t##*/};;
- *) echo "Bad option. --title, --artist or --album"
- esac
- else
- echo "VLC is not running"
- fi
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement