mirror of
https://github.com/powerline/powerline.git
synced 2025-07-26 07:16:31 +02:00
Add common player conversion methods
This commit is contained in:
parent
ea32006715
commit
e8ebb07662
@ -290,6 +290,20 @@ class NowPlayingSegment(object):
|
|||||||
return None
|
return None
|
||||||
return stdout.strip()
|
return stdout.strip()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _convert_state(state):
|
||||||
|
state = state.lower()
|
||||||
|
if 'play' in state:
|
||||||
|
return 'play'
|
||||||
|
if 'pause' in state:
|
||||||
|
return 'pause'
|
||||||
|
if 'stop' in state:
|
||||||
|
return 'stop'
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _convert_seconds(seconds):
|
||||||
|
return u'{0:.0f}:{1:02.0f}'.format(*divmod(float(seconds), 60))
|
||||||
|
|
||||||
def player_mpd(self, host='localhost', port=6600):
|
def player_mpd(self, host='localhost', port=6600):
|
||||||
try:
|
try:
|
||||||
import mpd
|
import mpd
|
||||||
|
Loading…
x
Reference in New Issue
Block a user