Wikia

Music Player Daemon Community Wiki

Client:Lcd4linux

525pages on
this wiki
Talk0

lcd4linux has a build in mpd plugin for displaying status informations. It can be personally configured. lcd4linux is compatible to many displays. Please take a look at the external links for further informations.


External links:


Mpd with lcd4linux-serdisplib on a l4m132c

Example lcd4linux configuration for a l4m132c (132x65) usb display with shown covers Edit

Driver serdisplib has to be installed for l4m132c [1] Installation guide in german
For showing covers i use the cover database from gmpc. I convert all the covers to a size of 45x45 by a script (see attached perl script below).


Please fit "/home/user/.covers/" to your gmpc cover directory:

# /etc/lcd4linux.conf
file '/home/user/.covers/'.mpd::artist().'/'.mpd::album().'_45x45.png'

Please fit "HID:/dev/usb/hiddev0" to your l4m132c device (normally: /dev/usb/hiddev0 or /dev/hiddev0).

# /etc/lcd4linux.conf
Port 'HID:/dev/usb/hiddev0'

If you have a problem with changing device names (caused by another usb devices) you may add a line to the udev config:

# /etc/udev/rules.d/10-own.rules
BUS=="usb", KERNEL=="hiddev?", SYSFS{idVendor}=="4243", SYSFS{idProduct}=="ee08", SYMLINK+="usb/usblcd"
Use in this case the symlink "/dev/usb/usblcd" instead of "/usb/dev/hiddev1".

Known problems:

  • Covers with albumartist="various" currently aren't shown. The lcd4linux code don't compiles with the actual mpdlib.
  • German "Umlaute" aren't showed. The reason is unknown.
# /etc/lcd4linux.conf

Variables {
   tick 500
   tack 100
   minute 60000
}


Display SerDispLib {
    Driver 'serdisplib'
    Port 'HID:/dev/usb/hiddev0'
    #Port '/dev/tts/0'	
    Model 'L4M132C'
    Options 'RESMODE=0; DEPTH=16; BRIGHTNESS=100; CONTRAST=10; POSTOFFMODE=1; INVERT=YES'
}


Plugin MPD {
    enabled 1
    server 'localhost'
    port 6600
#    password 'secret'
    minUpdateTime 500
}	    


#
# display mpd state icon: play/pause/stop
#
Widget mpd-state {
	class 'Icon'
	speed tack
	update tack
	bitmap {
        row1 '......|.*....|.......|......'
        row2 '......|.**...|.......|......'
        row3 '......|.***..|.**..**|.*****'
        row4 '......|.****.|.**..**|.*****'
        row5 '......|.***..|.**..**|.*****'
        row6 '......|.**...|.**..**|.*****'
        row7 '......|.*....|.**..**|.*****'
        row8 '......|......|.......|......'
    }
	frame (mpd::getStateInt())
	# blinking in pause state else static visible
	visible (mpd::getStateInt()==2 ? (test::onoff(0)) : '1')
}

#
# display mpd repeat icon
#
Widget mpd-repeat {
	class 'Icon'
	speed tack
	update tack
   bitmap {
        row1 '......|......'
        row2 '......|******'
        row3 '......|*....*'
        row4 '......|*..***'
        row5 '......|*...**'
        row6 '......|*....*'
        row7 '......|*.....'
        row8 '......|******'
    }
	frame (mpd::getRepeatInt())
	visible (1)
}

#
# display mpd random icon
#
Widget mpd-random {
	class 'Icon'
	speed tack
	update tack
   bitmap {
        row1 '......|......'
        row2 '......|******'
        row3 '......|.....*'
        row4 '......|*..***'
        row5 '......|**..**'
        row6 '......|***..*'
        row7 '......|*.....'
        row8 '......|******'
    }
	frame (mpd::getRandomInt())
	visible (1)
}

#
# display artist - title
#
Widget mpd-combo {
    class 'Text'
    expression mpd::artist() . '/' . mpd::title() 
    width 22
    align 'A'
    speed scroller
    update tack
}

#
# display artist
#
Widget mpd-artist {
    class 'Text'
    expression iconv('UTF-8', 'ISO-8859-1', mpd::artist()) 
    width 22
    align 'L'
    update tack
}

#
# display title
#
Widget mpd-title {
    class 'Text'
    expression iconv('UTF-8', 'ISO-8859-1', mpd::title())
    width 22
    align 'L'
    update tack
}

#
# display album
#
Widget mpd-album {
    class 'Text'
    expression iconv('UTF-8', 'ISO-8859-1', mpd::album())
    width 14
    align 'L'
    update tack
}

#
# display title date
#
Widget mpd-date {
    class 'Text'
    expression mpd::date() 
    width 4
    align 'R'
    update tack
}

#
# display position/songs in playlists
#
Widget mpd-track {
    class 'Text'
    expression ( (mpd::getMpdPlaylistGetCurrentId().'/' .mpd::getMpdPlaylistLength() )
    width 7
    align 'R'
    update tick
}

#
# display title track
#
Widget mpd-track2 {
    class 'Text'
    expression (mpd::getTrack())
    width 5
    align 'L'
    update tick
}

#
# 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 tick
}

#
# 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 tick
}

Widget smallMP3Bar_part2 {
    class  'Text'
    expression '/'.mpd::formatTimeMMSS( mpd::totalTimeSec() )
    width  6
    update tick
    align  'L'
}


#
# display volume
#
Widget mpd-vol {
    class  'Text'
    expression 'VOL:'.mpd::getVolume()
    width  7
    align  'R'
    update tick
}

#
# display volume
#
Widget mpd-vol {
    class  'Text'
    expression 'VOL:'.mpd::getVolume()
    width  7
    align  'R'
    update tick   
}

Widget mpd-bitrate {
    class  'Text'
    expression mpd::bitRate().'k'
    width  6
    update tick
    align  'L'
}

Widget mpd-cover {
    class 'Image'
	file '/home/user/.covers/'.mpd::artist().'/'.mpd::album().'_45x45.png'
    update 2000
	reload 1
    visible 1
    inverted 1
}

Layout mpd_132x65 {
    Row1 {
	Col1  'mpd-artist'
    }
    Row2 {
	Col1 'mpd-title'
    }
    Row4 {
	Col9 'mpd-album'
    }    
    Row5 {
	Col9 'mpd-track2'
	Col19 'mpd-date'
    }
    Row6 {
	Col9 'smallMP3Bar_part1'
    }
    Row7 {
	Col9 'mpd-repeat'
	Col11 'mpd-random'
	Col16 'mpd-track'
    }    
	Row8 {
		Col9 'mpd-state'
		Col12 'mpd-tracktime'
	}
	Row8 {
		Col12 'mpd-tracktime'
	}
    Layer 2 {
		X19.Y2 'mpd-cover'
    }    
}

Variables {
    t_onesec 	1000
    t_500m 	500
    tack 500
    tick 100
    tacku 100
    scroller 300
}


Display 'SerDispLib'

Layout 'mpd_132x65'

Perl script for converting covers from gmpc database to a size of 45x45 Edit

Please fit the line

my $verz = "/home/markus/.covers";

to your gmpc cover directory.

#!/usr/bin/perl  
# -w

# 
# FUX 2009-07-11

require 5;
# use strict;

# MODULE
use File::Copy;

# VARIABLE
my $bild;
my $aktVerz;
my $main = 1;
my @Eintraege;

# PARAMETER
my $verz = "/home/markus/.covers";
my $thumbSize = "45x45";
my $thumbBackground = "black";




# check if black background file exist, if not, then make
if (-e "$verz/leinwand.png") {
	print "background picture file already exist\n";
}
else {
	print "make background picture file\n";
	system("convert -size $thumbSize xc:$thumbBackground $verz/leinwand.png");
}


&DatenEinlesen($verz);


sub DatenEinlesen {
my $bild;
my $aktVerz = shift;
opendir(DIR,"$aktVerz");
my @Eintraege = readdir(DIR);
#print "EINTRÄGE: @Eintraege\n";
closedir(DIR);

	if ( $#Eintraege < 2 ) { return; }

	foreach $bild (@Eintraege) {
		if (-d "$aktVerz/$bild" and "$bild" ne "." and "$bild" ne ".." ) {
			# Bei einem Verzeichnis rekursiv wieder aufrufen
			#print "VERZEICHNISAUFRUF: $bild - Aufruf: $aktVerz/$bild\n";
			&DatenEinlesen("$aktVerz/$bild");
		}
		else
		{
			#printf("$bild\n");
			my $filename = "$aktVerz/$bild"; 
			if($bild =~ /(.+)\.jpg/ or $bild =~ /(.+)\.png/ or $bild =~ /(.+)\.bmp/) {
				# Falls Interpreten-Bild, dann nicht konvertieren
				if( $bild !~ /(.*)_IMAGE./ and $bild !~ /(.*)_image./ and $bild !~ /_(.*)x(.*)./ ) {
					#printf("Bild erkannt: $bild\n");
					my $thumbName = substr("$aktVerz/$bild",0,-4) . '_' . $thumbSize . '.png';
					#printf("ThumbName: $thumbName\n");
					if (-e "$thumbName") {
						printf("Already converted: '$thumbName'\n");
					}
					else {
						printf("Convert: $thumbSize '$aktVerz/$bild $thumbName'\n");
						system("convert -geometry $thumbSize \"$aktVerz/$bild\" \"$thumbName\"");
						system("composite -compose over -gravity center \"$thumbName\" \"$verz/leinwand.png\" \"$thumbName\"");
					}			
				}
			}	
		}
	}
}


Around Wikia's network

Random Wiki