Here is my (michu / neophob.com) mpd widget config (v0.81):
Plugin MPD {
enabled 1
server 'localhost'
port 6600
# password 'secret'
minUpdateTime 500
}
#
# display artist and album, scrolling
#
Widget mpd-combo {
class 'Text'
expression mpd::artist() . '/' . mpd::title()
width 20
align 'A'
speed scroller
update tack
}
#
# display current song id and number of total song
#
Widget mpd-posid {
class 'Text'
expression mpd::getMpdPlaylistGetCurrentId().' of ' .mpd::getMpdPlaylistLength()
width 11
align 'L'
update tack
}
#
# display 30s the mpd uptime (ex. UP:2d03h32m) then 30s the current song id and number of total songs (ex. 267 of 734)
#
Widget mpd-toggler {
class 'Text'
expression ( (mpd::getMpdUptime()%60)<31 ? ('UP:'.mpd::formatTimeDDHHMM( mpd::getMpdUptime() ) ) : (mpd::getMpdPlaylistGetCurrentId().' of ' .mpd::getMpdPlaylistLength()) )
width 11
align 'L'
update tack
}
#
# display playerstate (play, pause, stop, unknown)
#
Widget mpd-playerstatus {
class 'Text'
expression (mpd::getStateInt() == 1 ? 'PLAYING' : '').(mpd::getStateInt() == 2 ? 'PAUSED ' : '').(mpd::getStateInt() == 3 ? 'STOPPED' : '').(mpd::getStateInt() == 0 ? 'UNKNOWN' : '')
width 7
align 'L'
update tack
}
#
# get repeat/random
# example: REP/RND, REP/---, ---/RND, ---/---
#
Widget mpd-reprnd {
class 'Text'
expression (mpd::getRepeatInt()>0 ? 'REP' : '---') . '/' . (mpd::getRandomInt()>0 ? 'RND' : '---')
width 7
align 'L'
update tack
}
#
# display track position example: <00:48/04:33>
#
Widget mpd-tracktime {
class 'Text'
expression mpd::formatTimeMMSS( mpd::elapsedTimeSec() ).'/'.mpd::formatTimeMMSS( mpd::totalTimeSec() )
width 11
align 'L'
update tack
}
#
# display uptime of mpd, example: <0d06h51m>
#
Widget mpd-uptime {
class 'Text'
expression 'UP:'.mpd::formatTimeDDHHMM( mpd::getMpdUptime() )
width 11
align 'L'
update 10000
}
#
# small playbar and track time
#
Widget smallMP3Bar_part1 {
class 'Bar'
expression mpd::elapsedTimeSec()
length 14
min 0
max mpd::totalTimeSec()
direction 'E'
style 'H'
update tack
}
#
# display volume
#
Widget mpd-vol {
class 'Text'
expression 'VOL:'.mpd::getVolume()
width 7
align 'R'
update tack
}
Widget smallMP3Bar_part2 {
class 'Text'
expression '/'.mpd::formatTimeMMSS( mpd::totalTimeSec() )
width 6
update tack
align 'L'
}
#
# display volume
#
Widget mpd-vol {
class 'Text'
expression 'VOL:'.mpd::getVolume()
width 7
align 'R'
update tack
}
Widget mpd-bitrate {
class 'Text'
expression mpd::bitRate().'k'
width 6
update tack
align 'L'
}
# example:
# +--------------------+ +--------------------+
# ¦ad/It's A Fire ¦ ¦ Portishead/It's A F¦
# ¦*** /03:48¦ ¦********* /03:48¦
# ¦REP/RND PLAYING 128k¦ ¦REP/RND PLAYING 128k¦
# ¦UP:2d03h33m VOL:100¦ ¦267 of 734 VOL:100¦
# +--------------------+ +--------------------+
Layout L20x4 {
Row1 {
Col1 'mpd-combo'
}
Row2 {
Col1 'smallMP3Bar_part1'
Col15 'smallMP3Bar_part2'
}
Row3 {
Col1 'mpd-reprnd'
Col9 'mpd-playerstatus'
Col17 'mpd-bitrate'
}
Row4 {
Col1 'mpd-toggler'
Col14 'mpd-vol'
}
}
Variables {
t_onesec 1000
t_500m 500
tack 500
tick 100
tacku 100
scroller 300
}
Display CFA634 {
Driver 'Crystalfontz'
Model '634'
Port '/dev/ttyUSB0'
# Speed 38400
Contrast 65
Backlight 20
Icons 1
}
Display 'CFA634'
Layout 'L20x4'
The new option „minUpdateTime“ defines how long plugin_mpd.c should wait (in ms) until it reconnects to the mpd server. A „minUpdateTime 500“ will update the values each 1/2 second. If you query this plugin more than the minUpdateTime it will return a cached value.
| mpd::artist | return artist of the current song |
| mpd::title | return title of the current song |
| mpd::album | return album of the current song |
| mpd::file | return filename of the current song |
| mpd::totalTimeSec | return play time of the current song, return value is in seconds! |
| mpd::elapsedTimeSec | return play time of the current song, return value is in seconds! |
| mpd::bitRate | return bitRate of current the song |
| mpd::getRepeatInt | return if mpd will repeat (1: yes, 0: no) |
| mpd::getRandomInt | return if mpd is plaing randomly |
| mpd::getStateInt | return if mpd plaing state, 0=unknown, 1=play, 2=pause, 3=stop |
| mpd::getVolume | returns mpd volume |
| mpd::getSongsInDb | return the ammount of mpd songs in the current db |
| mpd::getMpdUptime | returns how long mpd is up, return value is in seconds |
| mpd::getMpdPlayTime | returns how long mpd is plaing sound, return value is in seconds |
| mpd::getMpdDbPlayTime | returns how long mpd is up, return value is in seconds |
| mpd::getMpdPlaylistLength | returns how many tracks are in the mpd db |
| mpd::getMpdPlaylistGetCurrentId | returns the current track id |
| mpd::formatTimeMMSS | this function will format a second value into HH:MM (ex. 02:33) |
| mpd::formatTimeDDHHMM | this function will format a second value into DD:HH:MM (ex. 0d02h33m) |
New since v0.8:
| mpd::getSamplerateHz | returns samplerate of current song in hz |
| mpd::getAudioChannels | returns audio channel of current track |
New since v0.83:
| mpd::cmdNextSong | next song |
| mpd::cmdPrevSong | prev song |
| mpd::cmdStopSong | stop song |
| mpd::cmdTogglePauseSong | toggle pause |
| mpd::cmdVolUp | increase volume |
| mpd::cmdVolDown | decrease volume |
| mpd::cmdToggleRandom | toggle random play |
| mpd::cmdToggleRepeat | toggle repeat |
Attention: plugin_mpd returns string non-converted. MPD uses UTF-8 internal for strings (this means for artist, track…) - so you probably need to convert the string, an example:
Widget mpd-ascii-artist {
class 'Text'
expression iconv('UTF-8', 'ISO-8859-1', mpd::artist())
width 20
align 'P'
speed scroller
update tack
}
So make sure you use the plugin_iconv!
You need libmpdclient to compile this plugin, src: http://www.musicpd.org/libmpdclient.shtml.
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.
If you run into some stange errors, use the integrated debug functions of lcd4linux:
root@OpenWrt:/# lcd4linux -Fvvq Version 0.10.2-SVN-796 starting plugin_cfg.c: Variable scroller = '300' (300) plugin_cfg.c: Variable t_500m = '500' (500) plugin_cfg.c: Variable t_onesec = '1000' (1000) plugin_cfg.c: Variable tack = '500' (500) plugin_cfg.c: Variable tacku = '100' (100) plugin_cfg.c: Variable tick = '100' (100) plugin_gps.c: v0.2 [[:lcd4linux:KVV]] Using station 89 [[:lcd4linux:KVV]] Using default port 80 [[:lcd4linux:KVV]] Using default refresh interval of 60 seconds [[:lcd4linux:KVV]] Default abbreviation setting: off plugin_mpd.c: [[:lcd4linux:MPD]] v0.7, check lcd4linux configuration file... [[:lcd4linux:MPD]] empty 'Plugin:MPD.password' entry in /etc/lcd4linux.conf, assuming none plugin_mpd.c: [[:lcd4linux:MPD]] connection detail: [[:lcd4linux:localhost:6600]] plugin_mpd.c: [[:lcd4linux:MPD]] done lcd4linux.c: initializing driver Crystalfontz Crystalfontz: $Rev: 840 $ Crystalfontz: using model '634' Crystalfontz: using port '/dev/ttyUSB0' at 19200 baud Crystalfontz: reserving 4 of 8 user-defined characters for icons Crystalfontz: using 0 GPI's and 0 GPO's initializing layout 'L20x4' lcd4linux.c: starting main loop plugin_mpd.c: [[:lcd4linux:MPD]] not connected, try to reconnect... plugin_mpd.c: [[:lcd4linux:MPD]] connection ok...
The message „MPD not connected, try to reconnect…“ is normal, as this plugin checks if the client is connected to the MPD server, if not a connection will established.
As TRAC refuse my images, I need to specify my website: http://www.neophob.com/serendipity/index.php?/archives/136-Asus-WL500GP-+-OpenWrt-+-Lcd4linux-Jukebox.html - there you can find some „in-use“ images.