Home | Trees | Indices | Help |
|
---|
|
1 # This program is free software: you can redistribute it and/or modify 2 # it under the terms of the GNU General Public License as published by 3 # the Free Software Foundation, either version 3 of the License, or 4 # (at your option) any later version. 5 # 6 # This program is distributed in the hope that it will be useful, 7 # but WITHOUT ANY WARRANTY; without even the implied warranty of 8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 # GNU General Public License for more details. 10 # 11 # You should have received a copy of the GNU General Public License 12 # along with this program. If not, see <http://www.gnu.org/licenses/>. 13 14 15 # Exaile API by vrunner 16 17 import os 18 import dbus 19 import string 20 import gobject 21 from GenericPlayer import GenericAPI 22 23 #EXAILE = {'DBUS_NAME':'org.exaile.DBusInterface','DBUS_OBJECT':'/DBusInterfaceObject', \ 24 # 'DBUS_TITLE':'get_title()','DBUS_ALBUM':'get_album()', \ 25 # 'DBUS_ARTIST':'get_artist()','DBUS_ART':'get_cover_path()',\ 26 # 'DBUS_PLAYING':'query()','PLAY_WORD':'playing'} 2729 __name__ = 'Exaile API' 30 __version__ = '0.0' 31 __author__ = 'vrunner' 32 __desc__ = 'API to the Exaile Music Player' 33 34 ns = "org.exaile.DBusInterface" 35 iroot = "/DBusInterfaceObject" 36 iface = "org.exaile.DBusInterface" 37 38 playerAPI = None 39 40 __timeout = None 41 __interval = 2 42 43 callbackFn = None 44 __curplaying = None 45 46 # Extended Functions from the GenericAPI 47 50 5411456 proxy_obj = self.session_bus.get_object(self.ns, self.iroot) 57 self.playerAPI = dbus.Interface(proxy_obj, self.iface)58 61 64 67 70 74 7779 self.playerAPI.next_track()8082 self.playerAPI.prev_track()8385 self.callback_fn = fn 86 # Could not find a callback signal for Banshee, so just calling after some time interval 87 if self.__timeout: 88 gobject.source_remove(self.__timeout) 89 self.__timeout = gobject.timeout_add(self.__interval * 1000, self.info_changed)9092 if self.__timeout: 93 gobject.source_remove(self.__timeout) 94 95 try: 96 # Only call the callback function if Data has changed 97 if self.__curplaying != None and not self.is_playing(): 98 self.__curplaying = None 99 self.callback_fn() 100 101 nowplaying = self.now_playing() 102 if self.is_playing() and self.__curplaying != nowplaying: 103 self.__curplaying = nowplaying 104 self.callback_fn() 105 self.__timeout = gobject.timeout_add(self.__interval * 1000, self.info_changed) 106 except: 107 # The player exited ? call callback function 108 self.callback_fn() 109 pass110 111
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Jan 4 16:58:25 2012 | http://epydoc.sourceforge.net |