mirror of
https://github.com/powerline/powerline.git
synced 2025-07-25 06:46:33 +02:00
Add elapsed time to dbus players.
This commit is contained in:
parent
9bff8a5660
commit
8d85c4f73b
@ -249,12 +249,19 @@ else:
|
|||||||
player = bus.get_object(bus_name, player_path)
|
player = bus.get_object(bus_name, player_path)
|
||||||
iface = dbus.Interface(player, iface_prop)
|
iface = dbus.Interface(player, iface_prop)
|
||||||
info = iface.Get(iface_player, 'Metadata')
|
info = iface.Get(iface_player, 'Metadata')
|
||||||
elapsed = iface.Get(iface_player, 'Position')
|
|
||||||
status = iface.Get(iface_player, 'PlaybackStatus')
|
status = iface.Get(iface_player, 'PlaybackStatus')
|
||||||
except dbus.exceptions.DBusException:
|
except dbus.exceptions.DBusException:
|
||||||
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')
|
||||||
@ -270,7 +277,7 @@ else:
|
|||||||
'album': album,
|
'album': album,
|
||||||
'artist': artist,
|
'artist': artist,
|
||||||
'title': title,
|
'title': title,
|
||||||
'elapsed': _convert_seconds(elapsed / 1e6),
|
'elapsed': elapsed,
|
||||||
'total': _convert_seconds(info.get('mpris:length') / 1e6),
|
'total': _convert_seconds(info.get('mpris:length') / 1e6),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user