wiki:plugin_mpd

Version 9 (modified by anonymous, 12 years ago) (diff)

--

MPD plugin

example config

Here is my (michu / neophob.com (improved by d@ten / nanl.de :P)) mpd widget config:

Widget mpd-album {
    class 'Text'
    expression mpd::album()
    width 20
    align 'C'
    update tack
}

Widget mpd-artist-album {
    class 'Text'
    prefix mpd::artist('/')
    expression mpd::album()
    width 20
    align 'M'
    speed 250
    update 400
}

Widget mpd-title {
    class  'Text'
    expression  mpd::title()
    width  20
    align  'M'
    speed 250
    update tack
}

Widget mpd-status {
    class  'Text'
    prefix mpd::elapsedTime()
    expression mpd::totalTime()
    postfix mpd::getRepRand()
    width  20
    update tack
    align  'C'
}

Widget mpd-elapsedTimeBar {
    style 'h'
    class 'Bar'
    length 20
    expression mpd::elapsedTimeSec()
    max mpd::totalTimeSec()
    update 1000
}

Layout L20x2 {
     Row1 {
         Col1 'mpd-artist-album'
     }
     Row2 {
         Col1 'mpd-title'
     }
     Row3 {
         Col1 'mpd-status'
     }
     Row4 {
#       Col1 'mpd-test'
        Col1 'mpd-elapsedTimeBar'
     }
}

Variables {
   tack 100
}

Additional info

this plugin tries to connect to the mpd daemon at localhost:6600, BUT you can define a environment variable called MPD_HOST and MPD_PORT to change those default values.
functions:

Functions

mpd::artist()return artist of current song
mpd::title()return title or name of current song
mpd::album()return album of current song
mpd::elapsedTimereturn elapsed time of current song, display's MM:SS
mpd::elapsedTimeSecreturn elapsed time of current song, return value is ONLY in seconds||
mpd::totalTimereturn play time of current song, display's MM:SS
mpd::totalTimeSecreturn play time of current song, return value is ONLY in seconds||
mpd::bitRatereturn bitRate of current song
mpd::getRepeatreturn if mpd will repeat
mpd::getRandomreturn if mpd is plaing random
mpd::getRepRandcombines repeat and random, example1: REP/RND, example2: ---/RND

Dev

You need libmpd to compile this plugin, src: http://sarine.nl/gmpc-downloads.
If you want more information about this plugin or a openwrt binary visit http://www.neophob.com/serendipity/index.php?/archives/114-LCD4Linux-for-OpenWRT,-SVN-Version-including-patched-plugin_mpd.html.


old wiki entry here:

Under construction!

Doesn't work in RC1 with latest mpd. There exists no libmpd.h-file in current mpd-sources, which is required for this plugin.

checking which plugins to compile... done
checking libmpd/libmpd.h usability... no
checking libmpd/libmpd.h presence... no
checking for libmpd/libmpd.h... no
configure: WARNING: libmpd/libmpd.h header not found: mpd plugin disabled
foo@foo:/usr/src/mpd-0.12.2$ find . -name "libmpd.h"
foo@foo:/usr/src/mpd-0.12.2$ find . -name "lib*"
foo@foo:/usr/src/mpd-0.12.2$ find . -name "*mpd.h"
foo@foo:/usr/src/mpd-0.12.2$

Functions

mpd::artist()return artist of current song
mpd::title()return title or name of current song
mpd::album()return album of current song
mpd::playtime()return elapsed time of current song
mpd::totaltime()return total time of current song

Configuration example

Plugin Mpd {
 Host 'MPd-Server'
 Port 6600
}

Widget examples

Widget mpd-title {
    class  'Text'
    expression  mpd::title()
    width  20
    align  'C'
    update tack
}

Widget mpd-artist {
    class 'Text'
    expression mpd::artist()
    width 20
    align 'C'
    update tack
}

Widget mpd-album {
    class 'Text'
    expression mpd::album()
    width 20
    align 'C'
    update tack
}

Widget mpd-time {
    class 'Bar'
    expression mpd::playtime()
    length 20
    direction 'E'
    min 0
    max mpd::totaltime()
    update tack
}