~ubuntu-branches/ubuntu/raring/radiotray/raring

« back to all changes in this revision

Viewing changes to src/mpris_tracklist.py

  • Committer: Bazaar Package Importer
  • Author(s): Elías Alejandro Año Mendoza
  • Date: 2010-06-15 02:19:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100615021900-m8wrzkbq8kez1etv
Tags: 0.6-2
Added build dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2010 behrooz shabani (everplays) <behrooz@rock.com>
 
2
#
 
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)
 
6
# any later version.
 
7
#
 
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.
 
12
#
 
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
 
16
 
 
17
http://wiki.xmms2.xmms.se/wiki/MPRIS#.2FTrackList_object_methods
 
18
"""
 
19
import dbus
 
20
import dbus.service
 
21
 
 
22
INTERFACE_NAME = 'org.freedesktop.MediaPlayer'
 
23
 
 
24
class RadioTrayMprisTrackList(dbus.service.Object):
 
25
 
 
26
    """
 
27
        /TrackList object methods
 
28
    """
 
29
 
 
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
 
35
 
 
36
    @dbus.service.method(INTERFACE_NAME,
 
37
            in_signature="i", out_signature="a{sv}")
 
38
    def GetMetadata(self, pos):
 
39
        """
 
40
            Gives all meta data available for element at given position in the
 
41
            TrackList, counting from 0
 
42
 
 
43
            Each dict entry is organized as follows
 
44
              * string: Metadata item name
 
45
              * variant: Metadata value
 
46
        """
 
47
        return {}
 
48
 
 
49
    @dbus.service.method(INTERFACE_NAME, out_signature="i")
 
50
    def GetCurrentTrack(self):
 
51
        """
 
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.
 
56
        """
 
57
        return -1
 
58
 
 
59
    @dbus.service.method(INTERFACE_NAME, out_signature="i")
 
60
    def GetLength(self):
 
61
        """
 
62
            Number of elements in the TrackList
 
63
        """
 
64
        return 0
 
65
 
 
66
    @dbus.service.method(INTERFACE_NAME,
 
67
            in_signature="sb", out_signature="i")
 
68
    def AddTrack(self, uri, play_immediately):
 
69
        """
 
70
            Appends an URI in the TrackList.
 
71
        """
 
72
        return 0
 
73
 
 
74
    @dbus.service.method(INTERFACE_NAME, in_signature="i")
 
75
    def DelTrack(self, pos):
 
76
        """
 
77
            Appends an URI in the TrackList.
 
78
        """
 
79
        pass
 
80
 
 
81
    @dbus.service.method(INTERFACE_NAME, in_signature="b")
 
82
    def SetLoop(self, loop):
 
83
        """
 
84
            Sets the player's "repeat" or "loop" setting
 
85
        """
 
86
        pass
 
87
 
 
88
    @dbus.service.method(INTERFACE_NAME, in_signature="b")
 
89
    def SetRandom(self, random):
 
90
        """
 
91
            Sets the player's "random" setting
 
92
        """
 
93
        pass
 
94
 
 
95
    @dbus.service.signal(INTERFACE_NAME, signature="i")
 
96
    def TrackListChange(self, num_of_elements):
 
97
        """
 
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
 
102
 
 
103
            The argument is the number of elements in the TrackList after the
 
104
            change happened.
 
105
        """
 
106
        pass