1
# Copyright (C) 2010 behrooz shabani (everplays) <behrooz@rock.com>
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 3, or (at your option)
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with Radio Tray. If not, see <http://www.gnu.org/licenses/>.
15
"""/TrackList object for MPRIS specification interface to radiotray
17
http://wiki.xmms2.xmms.se/wiki/MPRIS#.2FTrackList_object_methods
22
INTERFACE_NAME = 'org.freedesktop.MediaPlayer'
24
class RadioTrayMprisTrackList(dbus.service.Object):
27
/TrackList object methods
30
def __init__(self, bus): #mediator, provider, bus):
31
dbus.service.Object.__init__(self, bus, '/TrackList')
32
## we don't need these yet!
33
#self.mediator = mediator
34
#self.provider = provider
36
@dbus.service.method(INTERFACE_NAME,
37
in_signature="i", out_signature="a{sv}")
38
def GetMetadata(self, pos):
40
Gives all meta data available for element at given position in the
41
TrackList, counting from 0
43
Each dict entry is organized as follows
44
* string: Metadata item name
45
* variant: Metadata value
49
@dbus.service.method(INTERFACE_NAME, out_signature="i")
50
def GetCurrentTrack(self):
52
Return the position of current URI in the TrackList The return
53
value is zero-based, so the position of the first URI in the
54
TrackList is 0. The behavior of this method is unspecified if
55
there are zero elements in the TrackList.
59
@dbus.service.method(INTERFACE_NAME, out_signature="i")
62
Number of elements in the TrackList
66
@dbus.service.method(INTERFACE_NAME,
67
in_signature="sb", out_signature="i")
68
def AddTrack(self, uri, play_immediately):
70
Appends an URI in the TrackList.
74
@dbus.service.method(INTERFACE_NAME, in_signature="i")
75
def DelTrack(self, pos):
77
Appends an URI in the TrackList.
81
@dbus.service.method(INTERFACE_NAME, in_signature="b")
82
def SetLoop(self, loop):
84
Sets the player's "repeat" or "loop" setting
88
@dbus.service.method(INTERFACE_NAME, in_signature="b")
89
def SetRandom(self, random):
91
Sets the player's "random" setting
95
@dbus.service.signal(INTERFACE_NAME, signature="i")
96
def TrackListChange(self, num_of_elements):
98
Signal is emitted when the "TrackList" content has changed:
99
* When one or more elements have been added
100
* When one or more elements have been removed
101
* When the ordering of elements has changed
103
The argument is the number of elements in the TrackList after the