Feeds:
Posts
Comments

Posts Tagged ‘mpd’

KDE notifications + MPD

To get mpd to show the currently playing song, one can easily use kdialog:

kdialog --title "Currently playing song" --passivepopup "`mpc | head -n1`" 3

which triggers a KDE notification popup for 3 seconds. Not very pretty, but it’s simple and can be triggered via xbindkeys or something similar.

Advertisements

Read Full Post »

As with Amarok it’s not possible to delete the currently playing song in the MPD with any client I know. So again here’s my script. This time with a lot more error control 😉

#!/bin/bash
# Change this to your mpd music directory.
music_directory='/var/lib/mpd/music'
if ! mpc &> /dev/null
then
        echo "mpc wasn't found. Please install first."
        exit 1
fi
if [[ `mpc | wc -l` != 3 ]]
then
        echo 'There is no song playing right now...'
        exit 2
fi
if [[ -z $MUSICTRASH ]]
then
        echo 'Please set $MUSICTRASH.'
        echo '  For example add this line to your .bashrc:'
        echo '  export MUSICTRASH=~/music/.trash'
        exit 3
fi
if ! [[ -d $MUSICTRASH ]]
then
        echo "$MUSICTRASH does not exist."
        exit 4
fi
file=`mpc --format '%file%' | head -n1`
path="$music_directory/$file"
if [[ -f $path ]]
then
        name=`basename "$path"`
        mpc del 0
        mv "$path" "$MUSICTRASH/"
        echo "'$name' moved to '$MUSICTRASH'"
fi

Also set the config variable where you want to move your trashed music files:

File: .bashrc

export MUSICTRASH=~/music/.trash

Har!

TIP: Use xbindkeys if you need fast, easy and desktop-environment-independent global shortcuts.

Read Full Post »