def do_activate(self): WebPlayer.DBAccess.rbshell = self.object WebPlayer.PlayerControl.rbshell = self.object Views.Views.rbplugin = self Views.Views.add_template_path("web/") # Get port and adress settings from schema port = settings.get_int("server-port") address = settings.get_string("server-address") print ("starting server " + address + ":" + str(port) + " ...") self.__server = WebServer(address, port, "webplayer.settings") self.__server.start()
class RhythmRemotePlugin(GObject.Object, Peas.Activatable): __gtype_name__ = 'RhythmRemotePlugin' # The plugin class must have a GObject property named 'object', # which is how it receives a reference to the shell object # (an instance of the RBShell class), through which it can # access the rest of the Rhythmbox application. object = GObject.Property(type=GObject.GObject) def __init__(self): super(RhythmRemotePlugin, self).__init__() def do_activate(self): WebPlayer.DBAccess.rbshell = self.object WebPlayer.PlayerControl.rbshell = self.object Views.Views.rbplugin = self Views.Views.add_template_path("web/") # Get port and adress settings from schema port = settings.get_int("server-port") address = settings.get_string("server-address") print ("starting server " + address + ":" + str(port) + " ...") self.__server = WebServer(address, port, "webplayer.settings") self.__server.start() def do_deactivate(self): print ("stopping server...") self.__server.stop() def find_file(self, filename): info = self.plugin_info data_dir = info.get_data_dir() data_dir = data_dir.replace("/src", "/rhythmremote/") path = os.path.join(data_dir, filename) if os.path.exists(path): return path return None