Merge pull request #1813 from chester755/develop

Adding elapsed time to dbus players
This commit is contained in:
Nikolai Aleksandrovich Pavlov 2017-08-05 00:47:20 +03:00 committed by GitHub
commit d0d0644e3c
1 changed files with 9 additions and 0 deletions

View File

@ -254,6 +254,14 @@ else:
return return
if not info: if not info:
return return
try:
elapsed = iface.Get(iface_player, 'Position')
except dbus.exceptions.DBusException:
pl.warning('Missing player elapsed time')
elapsed = None
else:
elapsed = _convert_seconds(elapsed / 1e6)
album = info.get('xesam:album') album = info.get('xesam:album')
title = info.get('xesam:title') title = info.get('xesam:title')
artist = info.get('xesam:artist') artist = info.get('xesam:artist')
@ -269,6 +277,7 @@ else:
'album': album, 'album': album,
'artist': artist, 'artist': artist,
'title': title, 'title': title,
'elapsed': elapsed,
'total': _convert_seconds(info.get('mpris:length') / 1e6), 'total': _convert_seconds(info.get('mpris:length') / 1e6),
} }