wiki:plugin_mpris_dbus

MPRIS plugin

Starting with the current development version Lcd4Linux supports the MPRIS dbus protocol. MPRIS retrieves information from MPRIS capable media-player. (For more information about MPRIS: https://xmms2.org/wiki/Media_Player_Interfaces)

Hint: No MPRIS support is available in the LCD4Linux-0.11.0-SVN (2009-01-15) download package or earlier versions.

Functions

mpris_dbus::signal_TrackChange(METADATA_KEY)returns information based on metadata key for the current file.
mpris_dbus::method_PositionGet(DBUS_ADDRESS_OF_PLAYER)returns the playing position as percentage of whole length of the file. DBUS_ADDRESS_OF_PLAYER parameter is the mpris-dbus address of media player.

Some METADATA Keys:

locationUrl to the media (local files are represented as a file:// url).
titleName.
artistName of artist or band performing the work.
albumName of compilation the work is part of.
tracknumberThe position if it's part of a larger set.
timeThe duration in seconds.
mtimeThe duration in milliseconds.
genreThe genre.
commentA comment about the work.
ratingA "taste" rate value, out of 5.
yearThe year when the performing was realized, i.e. 2007.
dateWhen the performing was realized.

More information can be found at https://xmms2.org/wiki/MPRIS_Metadata

Some DBUS addresses :

Amarok2org.mpris.amarok
VLCorg.mpris.vlc
BMPxorg.mpris.bmp

Returning metadata information can be different for each mpris capable media-player. For more information please check :
https://xmms2.org/wiki/MPRIS
http://wiki.videolan.org/DBus-spec
https://community.kde.org/Amarok/Development/Scripting_HowTo_2.0#The_DBus_Interface_for_External_Applications

Sample lcd4linux.conf file which uses X11 driver :

Variables {
   tick 500
   tack 100
   minute 60000
}

Display XWindow {
    Driver 'X11'
    Size   '240x64'
    Font   '6x8'
    Pixel  '2+1'
    Gap    '0x0'
    Border 20
    Buttons 2
    Foreground  'ffffffcc'
    Background  '0000CE22'
    Basecolor   '0000CE'
    Bordercolor '00004F
}

Widget mpris_artist {
    class 'Text'
    expression  mpris_dbus::signal_TrackChange('artist')
    prefix 'Artist:'
    width 40
    align 'P'
    update tick
}
Widget mpris_album {
    class 'Text'
    expression  mpris_dbus::signal_TrackChange('album')
    prefix 'Album:'
    width 40
    align 'P'
    update tick
}
Widget mpris_title {
    class 'Text'
    expression  mpris_dbus::signal_TrackChange('title')
    prefix 'Title:'
    width 40
    align 'P'
    update tick
}
Widget mpris_genre {
    class 'Text'
    expression  mpris_dbus::signal_TrackChange('genre')
    prefix 'Genre:'
    width 20
    align 'P'
    update tick
}
Widget mpris_bitrate {
    class 'Text'
    expression  mpris_dbus::signal_TrackChange('audio-bitrate')
    prefix ''
    width 3
    align 'L'
    update tick
}
Widget mpris_samplerate {
    class 'Text'
    expression  mpris_dbus::signal_TrackChange('audio-samplerate')
    prefix ''
    width 5
    align 'L'
    update tick
}
Widget mpris_time {
    class 'Text'
    expression  mpris_dbus::signal_TrackChange('time')
    postfix ''
    width 5
    align 'R'
    update tick
}
Widget mpris_mtime {
    class 'Text'
    expression  mpris_dbus::signal_TrackChange('mtime')
    prefix ''
    width 6
    align 'R'
    update tick
}
Widget mpris_TrackPosition {
    class 'Text'
    expression  mpris_dbus::method_PositionGet('org.kde.amarok')	
    prefix 'Position % :'
    width 17
    update 200
}
Widget mpris_TrackPosition_bar {
    class 'Bar'
    expression  mpris_dbus::method_PositionGet('org.mpris.amarok')
    length 40	
    min 0
    max 100
    direction 'E'
    style 'H'
    update 200
}
Widget mpris_location {
    class 'Text'
    expression  mpris_dbus::signal_TrackChange('location')
    prefix 'Location:'
    width 40
    align 'P'
    update tick
}

Layout Default {
    Row1 {
	Col1  'mpris_artist'
    }
    Row2 {
	Col1  'mpris_album'
    }
    Row3 {
	Col1  'mpris_title'
    }
    Row4 {
	Col1  'mpris_genre'
	Col21  'mpris_bitrate'
	Col25  'mpris_samplerate'
    }
    Row5 {
	Col1 'mpris_time'
	Col7  'mpris_mtime'
    }
    Row6 {
	Col1 'mpris_TrackPosition_bar'
    }
    Row7 {
	Col1 'mpris_TrackPosition'
    }
    Row8 {
	Col1 'mpris_location'
    }
}

Display 'XWindow'

Layout 'Default'

Last modified 13 months ago Last modified on 02/29/16 22:07:41

Attachments (2)

Download all attachments as: .zip