예제 #1
0
    def download(self, download, d_type):
        """ Download/upload data from/to receiver """
        try:
            self._expander.set_expanded(True)
            self.clear_output()

            if download:
                download_data(properties=self._profile_properties,
                              download_type=d_type,
                              callback=self.append_output)
            else:
                self.show_info_message(get_message("Please, wait..."),
                                       Gtk.MessageType.INFO)
                upload_data(properties=self._profile_properties,
                            download_type=d_type,
                            remove_unused=self._remove_unused_check_button.
                            get_active(),
                            profile=self._profile,
                            callback=self.append_output,
                            done_callback=lambda: self.show_info_message(
                                get_message("Done!"), Gtk.MessageType.INFO),
                            use_http=self._use_http_switch.get_active())
        except Exception as e:
            message = str(getattr(e, "message", str(e)))
            self.show_info_message(message, Gtk.MessageType.ERROR)
        else:
            if download and d_type is not DownloadType.SATELLITES:
                GLib.idle_add(self._open_data_callback)
예제 #2
0
    def download(self, download, d_type):
        """ Download/upload data from/to receiver """
        GLib.idle_add(self._expander.set_expanded, True)
        self.clear_output()
        backup, backup_src, data_path = self._settings.backup_before_downloading, None, None

        try:
            if download:
                if backup and d_type is not DownloadType.SATELLITES:
                    data_path = self._settings.data_local_path or self._data_path_entry.get_text()
                    os.makedirs(os.path.dirname(data_path), exist_ok=True)
                    backup_path = self._settings.backup_local_path or data_path + "backup/"
                    backup_src = backup_data(data_path, backup_path, d_type is DownloadType.ALL)

                download_data(settings=self._settings, download_type=d_type, callback=self.append_output)
            else:
                self.show_info_message(get_message("Please, wait..."), Gtk.MessageType.INFO)
                upload_data(settings=self._settings,
                            download_type=d_type,
                            remove_unused=self._remove_unused_check_button.get_active(),
                            callback=self.append_output,
                            done_callback=lambda: self.show_info_message(get_message("Done!"), Gtk.MessageType.INFO),
                            use_http=self._use_http_switch.get_active())
        except Exception as e:
            msg = "Downloading data error: {}"
            log(msg.format(e), debug=self._settings.debug_mode, fmt_message=msg)
            self.show_info_message(str(e), Gtk.MessageType.ERROR)
            if all((download, backup, data_path)):
                restore_data(backup_src, data_path)
        else:
            if download and d_type is not DownloadType.SATELLITES:
                GLib.idle_add(self._open_data_callback)
예제 #3
0
파일: epg.py 프로젝트: audi06/DemonEditor
 def download_epg_from_stb(self):
     """ Download the epg.dat file via ftp from the receiver. """
     try:
         download_data(settings=self._settings,
                       download_type=DownloadType.EPG,
                       callback=print)
     except Exception as e:
         GLib.idle_add(self.show_info_message,
                       f"Download epg.dat file error: {e}",
                       Gtk.MessageType.ERROR)
     else:
         GLib.idle_add(self._app.emit, "epg-dat-downloaded", None)
예제 #4
0
    def on_download(self, item=None, files_filter=None, path=None):
        path = path or self.check_dest_path()
        if not path:
            return

        settings = Settings(self._settings.settings)
        settings.picons_local_path = path + "/"
        self.run_func(
            lambda: download_data(settings=settings,
                                  download_type=DownloadType.PICONS,
                                  callback=self.append_output,
                                  files_filter=files_filter), True)
예제 #5
0
 def download_epg_from_stb(self):
     """ Download the epg.dat file via ftp from the receiver. """
     download_data(settings=self._settings,
                   download_type=DownloadType.EPG,
                   callback=print)