#!/bin/bash
#
# Shell-script to get info from the current song in VLC
#
# Author: nicolunacba (Nicolas Luna)
#
# WARNING: To get this plugin enabled, in VLC go to
# Tools -> Preferences -> Show all -> Interface -> Control
# Interface, and enable DBUS
# 


# Check if VLC Player is ON
ACTIVE=`ps ax | grep -v grep | grep " vlc"`
if [[ -z $ACTIVE ]]; then
	echo 0
	exit 0
fi

# Get the MetaData about the current song
ARTIST=`qdbus org.mpris.vlc /Player GetMetadata | grep "artist:"`
TITLE=`qdbus org.mpris.vlc /Player GetMetadata | grep "title:"`
LOCATION=`qdbus org.mpris.vlc /Player GetMetadata | grep "location:"`

# Parse it ...
ARTIST=${ARTIST:7}
TITLE=${TITLE:6}
LOCATION=${LOCATION:9}

# And display it :-)
echo 1

echo $ARTIST
echo $TITLE
echo $LOCATION

exit 0
