-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathamarok.py
38 lines (29 loc) · 1.01 KB
/
amarok.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import dbus
class MprisPlaying:
def __init__(self):
self.artist = self.title = self.album = self.status = None
self.metadata = self.playbackstatus = None
self.bus = dbus.SessionBus()
def getData(self, interface, path):
stop = False
try:
mpris = self.bus.get_object(interface, path)
except dbus.exceptions.DBusException:
stop = True
if not stop:
self.metadata = mpris.Get('', 'Metadata')
self.playbackstatus = mpris.Get('', 'PlaybackStatus')
if self.metadata:
self.artist = self.metadata['xesam:artist'][0]
self.title = self.metadata['xesam:title']
self.album = self.metadata['xesam:album']
if self.playbackstatus:
self.status = self.playbackstatus
def getArtist(self):
return self.artist
def getTitle(self):
return self.title
def getAlbum(self):
return self.album
def getStatus(self):
return self.status