Add Rhythmbox to now_playing segment

Closes #155.
This commit is contained in:
Gaurav Narula 2013-01-31 17:55:18 +05:30 committed by Kim Silkebækken
parent 0ad417cc79
commit cb860ce5d0
1 changed files with 13 additions and 0 deletions

View File

@ -347,4 +347,17 @@ class NowPlayingSegment(object):
'title': str(info['xesam:title']),
'total': '{0:.0f}:{1:02.0f}'.format(*divmod(float(info['mpris:length'] / 1e6), 60)),
}
def player_rhythmbox(self):
now_playing = self._run_cmd(['rhythmbox-client', '--no-start', '--no-present', '--print-playing-format', '%at\n%aa\n%tt\n%te\n%td'])
if not now_playing:
return
now_playing = now_playing.split('\n')
return {
'album': now_playing[0],
'artist': now_playing[1],
'title': now_playing[2],
'elapsed': now_playing[3],
'total': now_playing[4],
}
now_playing = NowPlayingSegment()