[js] fix MRPIS behaviour
This commit is contained in:
parent
829cc3acb8
commit
3cea125207
|
@ -128,19 +128,37 @@ class MusicTrackListener(gobject.GObject):
|
||||||
|
|
||||||
def _mpris_properties_extract(self, song):
|
def _mpris_properties_extract(self, song):
|
||||||
info = MusicTrackInfo()
|
info = MusicTrackInfo()
|
||||||
|
|
||||||
|
if song.has_key('title'):
|
||||||
info.title = song['title']
|
info.title = song['title']
|
||||||
|
else:
|
||||||
|
info.title = ''
|
||||||
|
|
||||||
|
if song.has_key('album'):
|
||||||
info.album = song['album']
|
info.album = song['album']
|
||||||
|
else:
|
||||||
|
info.album = ''
|
||||||
|
|
||||||
|
if song.has_key('artist'):
|
||||||
info.artist = song['artist']
|
info.artist = song['artist']
|
||||||
|
else:
|
||||||
|
info.artist = ''
|
||||||
|
|
||||||
|
if song.has_key('length'):
|
||||||
info.duration = int(song['length'])
|
info.duration = int(song['length'])
|
||||||
|
else:
|
||||||
|
info.duration = 0
|
||||||
|
|
||||||
return info
|
return info
|
||||||
|
|
||||||
def _mpris_playing_changed_cb(self, playing):
|
def _mpris_playing_changed_cb(self, playing):
|
||||||
if playing == 2:
|
if playing == 0:
|
||||||
|
self.emit('music-track-changed', self._last_playing_music)
|
||||||
|
else:
|
||||||
self.emit('music-track-changed', None)
|
self.emit('music-track-changed', None)
|
||||||
|
|
||||||
def _mpris_music_track_change_cb(self, arg):
|
def _mpris_music_track_change_cb(self, arg):
|
||||||
info = self._mpris_properties_extract(arg)
|
self._last_playing_music = self._mpris_properties_extract(arg)
|
||||||
self.emit('music-track-changed', info)
|
|
||||||
|
|
||||||
def _muine_properties_extract(self, song_string):
|
def _muine_properties_extract(self, song_string):
|
||||||
d = dict((x.strip() for x in s1.split(':', 1)) for s1 in \
|
d = dict((x.strip() for x in s1.split(':', 1)) for s1 in \
|
||||||
|
|
Loading…
Reference in New Issue