def __init__(self, gui_manager, url): self.MAIN_URL_OPEN = UrlOpen(use_cache=False) BaseDownloader.__init__(self, self.MAIN_URL_OPEN, gui_manager, url) self.url = url self.gui_manager = gui_manager self.config = Config.get() self.user = None self.password = None accounts = self.config.get_key("accounts") for host, data in accounts: if host == "wupload": self.user = data["username"] self.password = base64.b64decode(data["password"]) self.captcha_window = CaptchaWindow(gui_manager, self._on_captcha_ok) self.MAIN_URL_OPEN.add_headers({ "Referer": url, "Origin": "http://www.wupload.com", "Host": "www.wupload.com", }) CAPTCHA_URL_OPEN.add_headers({"referer": url})
def __init__(self, gui_manager, file_object, file_path=None, download_only=False, choose_host=False): self.gui_manager = gui_manager self.config = Config.get() self.file_object = file_object self.download_only = download_only self.choose_host = choose_host self.selected_quality = None self._speed_list = [] self._last_downloaded_size = 0 self.speed = 0 self.file_path = file_path if not self.file_path: self.file_path = self.config.get_key("cache_dir") self.file_path = os.path.join(self.file_path, self.get_filename()) # Builder for the hosts selection self.hosts_builder = gtk.Builder() self.hosts_builder.add_from_file(HOSTS_GUI_FILE) self.hosts_builder.connect_signals(self) glade_objects = ["hosts_window", "hosts_icon_view", "hosts_icon_view_model"] for glade_object in glade_objects: setattr(self, glade_object, self.hosts_builder.get_object(glade_object)) self.gui_manager.background_task(self.get_hosts, self.display_hosts, status_message=gettext("Fetching hosts..."), unfreeze=False)
def __init__(self, gui_manager): """ Creates the window and initializes the attributes. """ # Gtk builder self.builder = gtk.Builder() self.builder.add_from_file(SETTINGS_GUI_FILE) self.builder.connect_signals(self) self.gui_manager = gui_manager self.config = Config.get() # Widgets glade_objects = [ "settings_dialog", "player_location_button", "player_arguments_entry", "megaupload_user_entry", "megaupload_pass_entry", "wupload_user_entry", "wupload_pass_entry", "cache_dir_button", "automatic_marks", "use_custom_resolve", "filename_template", "automatic_start", "download_subtitles", ] for glade_object in glade_objects: setattr(self, glade_object, self.builder.get_object(glade_object))
def __init__(self, gui_manager): """ Creates the window and initializes the attributes. """ # Gtk builder self.builder = gtk.Builder() self.builder.add_from_file(SETTINGS_GUI_FILE) self.builder.connect_signals(self) self.gui_manager = gui_manager self.config = Config.get() # Widgets glade_objects = [ "settings_dialog", "player_location_button", "player_arguments_entry", "megaupload_user_entry", "megaupload_pass_entry", "cache_dir_button", "automatic_marks", "use_custom_resolve", "filename_template", "automatic_start", ] for glade_object in glade_objects: setattr(self, glade_object, self.builder.get_object(glade_object))
def __init__(self, parent): """ Creates the window and initializes the attributes. """ # Gtk builder self.builder = gtk.Builder() self.builder.add_from_file(WIZARD_GUI_FILE) self.builder.connect_signals(self) # Config self.config = Config.get() # Widgets glade_objects = ["wizard_window", "player_location_button"] for glade_object in glade_objects: setattr(self, glade_object, self.builder.get_object(glade_object)) self.wizard_window.set_transient_for(parent)
def __init__(self, gui_manager, file_object, file_path=None, download_only=False, choose_host=False): self.gui_manager = gui_manager self.config = Config.get() self.file_object = file_object self.download_only = download_only self.choose_host = choose_host self.selected_quality = None self._speed_list = [] self._last_downloaded_size = 0 self.speed = 0 self.file_path = file_path if not self.file_path: self.file_path = self.config.get_key("cache_dir") self.file_path = os.path.join(self.file_path, self.get_filename()) # Builder for the hosts selection self.hosts_builder = gtk.Builder() self.hosts_builder.add_from_file(HOSTS_GUI_FILE) self.hosts_builder.connect_signals(self) glade_objects = [ "hosts_window", "hosts_icon_view", "hosts_icon_view_model" ] for glade_object in glade_objects: setattr(self, glade_object, self.hosts_builder.get_object(glade_object)) self.gui_manager.background_task( self.get_hosts, self.display_hosts, status_message=gettext("Fetching hosts..."), unfreeze=False)
def CustomResolver(host): config = Config.get() if config.get_key("use_custom_resolve"): if host in CUSTOM_DNS: host = CUSTOM_DNS[host] return host