Mpris2Plugin. Support 'url' in mpris2 metadata
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
[info]
|
[info]
|
||||||
name: MPRIS2 support
|
name: MPRIS2 support
|
||||||
short_name: mpris2_support
|
short_name: mpris2_support
|
||||||
version: 0.2
|
version: 0.3
|
||||||
description: MPRIS2 support. Allows to update status message according to the music you're listening via the MPRIS2 D-Bus API.
|
description: MPRIS2 support. Allows to update status message according to the music you're listening via the MPRIS2 D-Bus API.
|
||||||
authors = Denis Fomin <fominde@gmail.com>
|
authors = Denis Fomin <fominde@gmail.com>
|
||||||
homepage = http://trac-plugins.gajim.org/wiki/MprisSupportPlugin
|
homepage = http://trac-plugins.gajim.org/wiki/MprisSupportPlugin
|
||||||
|
|||||||
@@ -10,7 +10,13 @@ from plugins.plugin import GajimPluginException
|
|||||||
from common import dbus_support
|
from common import dbus_support
|
||||||
|
|
||||||
if dbus_support.supported:
|
if dbus_support.supported:
|
||||||
from music_track_listener import MusicTrackInfo, MusicTrackListener
|
from music_track_listener import MusicTrackListener
|
||||||
|
|
||||||
|
|
||||||
|
class MusicTrackInfo(object):
|
||||||
|
__slots__ = ['title', 'album', 'artist', 'duration', 'track_number',
|
||||||
|
'paused', 'url', 'albumartist']
|
||||||
|
|
||||||
|
|
||||||
class Mpris2Plugin(GajimPlugin):
|
class Mpris2Plugin(GajimPlugin):
|
||||||
@log_calls('Mpris2Plugin')
|
@log_calls('Mpris2Plugin')
|
||||||
@@ -51,7 +57,10 @@ class Mpris2Plugin(GajimPlugin):
|
|||||||
info.title = data.get("xesam:title", '')
|
info.title = data.get("xesam:title", '')
|
||||||
info.album = data.get("xesam:album", '')
|
info.album = data.get("xesam:album", '')
|
||||||
info.artist = data.get("xesam:artist", [''])[0]
|
info.artist = data.get("xesam:artist", [''])[0]
|
||||||
|
info.albumartist = data.get("xesam:albumArtist", [''])[0]
|
||||||
info.duration = int(data.get('mpris:length', 0))
|
info.duration = int(data.get('mpris:length', 0))
|
||||||
info.track_number = int(data.get('xesam:trackNumber', 0))
|
info.track_number = int(data.get('xesam:trackNumber', 0))
|
||||||
|
info.url = data.get("xesam:url", '')
|
||||||
|
|
||||||
self._last_playing_music = info
|
self._last_playing_music = info
|
||||||
self.listener.emit('music-track-changed', info)
|
self.listener.emit('music-track-changed', info)
|
||||||
|
|||||||
Reference in New Issue
Block a user