Home | Trees | Indices | Help |
|
---|
|
1 # This application is released under the GNU General Public License 2 # v3 (or, at your option, any later version). You can find the full 3 # text of the license under http://www.gnu.org/licenses/gpl.txt. 4 # By using, editing and/or distributing this software you agree to 5 # the terms and conditions of this license. 6 # Thank you for using free software! 7 8 9 # Exaile API by vrunner 10 11 import os 12 import dbus 13 import string 14 import gobject 15 from GenericPlayer import GenericAPI 16 17 #EXAILE = {'DBUS_NAME':'org.exaile.DBusInterface','DBUS_OBJECT':'/DBusInterfaceObject', \ 18 # 'DBUS_TITLE':'get_title()','DBUS_ALBUM':'get_album()', \ 19 # 'DBUS_ARTIST':'get_artist()','DBUS_ART':'get_cover_path()',\ 20 # 'DBUS_PLAYING':'query()','PLAY_WORD':'playing'} 2123 __name__ = 'Exaile API' 24 __version__ = '0.0' 25 __author__ = 'vrunner' 26 __desc__ = 'API to the Exaile Music Player' 27 28 ns = "org.exaile.DBusInterface" 29 iroot = "/DBusInterfaceObject" 30 iface = "org.exaile.DBusInterface" 31 32 playerAPI = None 33 34 __timeout = None 35 __interval = 2 36 37 callbackFn = None 38 __curplaying = None 39 40 # Extended Functions from the GenericAPI 41 44 4810850 proxy_obj = self.session_bus.get_object(self.ns, self.iroot) 51 self.playerAPI = dbus.Interface(proxy_obj, self.iface)52 55 58 61 64 68 7173 self.playerAPI.next_track()7476 self.playerAPI.prev_track()7779 self.callback_fn = fn 80 # Could not find a callback signal for Banshee, so just calling after some time interval 81 if self.__timeout: 82 gobject.source_remove(self.__timeout) 83 self.__timeout = gobject.timeout_add(self.__interval * 1000, self.info_changed)8486 if self.__timeout: 87 gobject.source_remove(self.__timeout) 88 89 try: 90 # Only call the callback function if Data has changed 91 if self.__curplaying != None and not self.is_playing(): 92 self.__curplaying = None 93 self.callback_fn() 94 95 nowplaying = self.now_playing() 96 if self.is_playing() and self.__curplaying != nowplaying: 97 self.__curplaying = nowplaying 98 self.callback_fn() 99 self.__timeout = gobject.timeout_add(self.__interval * 1000, self.info_changed) 100 except: 101 # The player exited ? call callback function 102 self.callback_fn() 103 pass104 105
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Feb 28 23:21:26 2011 | http://epydoc.sourceforge.net |