4
class MocHandler(songretriever.MusicHandler):
5
'''Handler moc (Music On Console) music player'''
6
NAME = 'Music On Console'
7
DESCRIPTION = 'Music handler for moc'
8
AUTHOR = 'Adolfo Fitoria'
9
WEBSITE = 'www.emesene.org'
11
def __init__(self, main_window = None):
12
songretriever.MusicHandler.__init__(self, main_window)
15
'''returns True if the player is running'''
16
status = commands.getoutput('ps -e | grep mocp')
20
'''returns True if the player is playing a song'''
21
command = "mocp -Q '%state' 2>/dev/null"
22
if not self.is_running():
25
status = commands.getoutput(command)
27
return status == 'PLAY'
29
def get_current_song(self):
30
'''returns the current song or None if no song is playing'''
31
command = "mocp -Q '%artist;%album;%song;%file' 2>/dev/null"
32
output = commands.getoutput(command).split(';')
33
if not self.is_running() or not self.is_playing():
36
return songretriever.Song(output[0], output[1],