def stream_ready(self, result): if result['status'] == 'success': if result.get('use_stream_urls', False): url = "stream+%s" % result['url'] if result.get('auto_open_stream_urls', False): threads.deferToThread(webbrowser.open, url) else: dialogs.InformationDialog('Stream ready', '<a href="%s">Click here to open it</a>' % url).run() else: dialogs.ErrorDialog('Stream ready', 'Copy the link into a media player', details=result['url']).run() else: dialogs.ErrorDialog('Stream failed', 'Was unable to prepare the stream', details=result).run()
def on_apply(self, widget): try: options = self.generate_opts() self.gtkui.store[self.item_id][0] = options["urls"][0] self.gtkui.trackers[self.item_index]["url"] = options["urls"][0] except Exception, err: dialogs.ErrorDialog("Error", str(err), self.dialog).run()
def on_apply(self, Event=None): try: options = self.generate_opts() client.autoadd.set_options( str(self.watchdir_id), options ).addCallbacks(self.on_added, self.on_error_show) except IncompatibleOption, err: dialogs.ErrorDialog(_("Incompatible Option"), str(err), self.dialog).run()
def on_add(self, event=None): try: options = self.generate_opts() client.autoadd.add(options).addCallbacks(self.on_added, self.on_error_show) except IncompatibleOption as ex: dialogs.ErrorDialog(_('Incompatible Option'), str(ex), self.dialog).run()
def on_apply_prefs(self): log.debug("applying prefs for Streaming") serve_method = 'standalone' # if self.glade.get_widget("input_serve_standalone").get_active(): # serve_method = 'standalone' # elif self.glade.get_widget("input_serve_webui").get_active(): # serve_method = 'webui' if self.glade.get_widget("input_ssl_cert_daemon").get_active(): ssl_source = 'daemon' elif self.glade.get_widget("input_ssl_cert_custom").get_active(): ssl_source = 'custom' config = { "ip": self.glade.get_widget("input_ip").get_text(), "port": int(self.glade.get_widget("input_port").get_text()), "use_stream_urls": self.glade.get_widget("input_use_stream_urls").get_active(), "auto_open_stream_urls": self.glade.get_widget("input_auto_open_stream_urls").get_active(), "allow_remote": self.glade.get_widget("input_allow_remote").get_active(), "download_only_streamed": self.glade.get_widget("input_download_only_streamed").get_active(), "reverse_proxy_enabled": self.glade.get_widget("input_reverse_proxy_enabled").get_active(), # "download_in_order": self.glade.get_widget("input_download_in_order").get_active(), "use_ssl": self.glade.get_widget("input_use_ssl").get_active(), # "remote_username": self.glade.get_widget("input_remote_username").get_text(), "reverse_proxy_base_url": self.glade.get_widget("input_reverse_proxy_base_url").get_text(), "remote_password": self.glade.get_widget("input_remote_password").get_text(), "ssl_priv_key_path": self.glade.get_widget("input_ssl_priv_key_path").get_text(), "ssl_cert_path": self.glade.get_widget("input_ssl_cert_path").get_text(), "serve_method": serve_method, "ssl_source": ssl_source, } result = yield client.streaming.set_config(config) if result: message_type, message_class, message = result if message_type == 'error': topic = 'Unknown error type' if message_class == 'ssl': topic = 'SSL Failed' dialogs.ErrorDialog(topic, message).run()
def on_add(self, widget): try: options = self.generate_opts() for url in options["urls"]: if not self.in_store(url): self.gtkui.store.append([url]) self.gtkui.trackers.append({"url": url}) except Exception, err: dialogs.ErrorDialog("Error", str(err), self.dialog).run()
def on_cell_edited(self, cell, path_string, new_text, model): # iter = model.get_iter_from_string(path_string) # path = model.get_path(iter)[0] try: ip = common.IP.parse(new_text) model.set(model.get_iter_from_string(path_string), 0, ip.address) except common.BadIP as ex: model.remove(model.get_iter_from_string(path_string)) from deluge.ui.gtkui import dialogs d = dialogs.ErrorDialog(_('Bad IP address'), ex.message) d.run()
def stream_ready(self, result): if result['status'] == 'success': if result.get('use_stream_urls', False): url = "stream+%s" % result['url'] if result.get('auto_open_stream_urls', False): threads.deferToThread(execute_url, url) else: def on_dialog_callback(response): if response == gtk.RESPONSE_YES: threads.deferToThread(execute_url, url) dialogs.YesNoDialog( 'Stream ready', 'Do you want to play the video?').run().addCallback( on_dialog_callback) else: dialogs.ErrorDialog('Stream ready', 'Copy the link into a media player', details=result['url']).run() else: dialogs.ErrorDialog('Stream failed', 'Was unable to prepare the stream', details=result).run()
def on_error_show(self, result): d = dialogs.ErrorDialog(_("Error"), result.value.exception_msg, self.dialog) result.cleanFailure() d.run()