Пример #1
0
            def on_link_task_added(info, error=None):
                if error or not info:
                    logger.error('CloudPage.do_add_link_task: %s, %s' %
                                 (info, error))
                    self.app.toast(_('Failed to parse download link'))
                    return
                if info.get('error_code', -1) != 0:
                    logger.error('CloudPage.do_add_link_task: %s, %s' %
                                 (info, error))

                if 'task_id' in info or info['error_code'] == 0:
                    self.reload()
                elif info['error_code'] == -19:
                    vcode = info['vcode']
                    vcode_dialog = VCodeDialog(self, self.app, info)
                    response = vcode_dialog.run()
                    vcode_input = vcode_dialog.get_vcode()
                    vcode_dialog.destroy()
                    if response != Gtk.ResponseType.OK:
                        return
                    gutil.async_call(pcs.cloud_add_link_task, self.app.cookie,
                                     self.app.tokens, source_url, save_path,
                                     vcode, vcode_input,
                                     callback=on_link_task_added)
                else:
                    self.app.toast(_('Error: {0}').format(info['error_msg']))
Пример #2
0
 def on_link_task_added(info, error=None):
     if error or not info:
         return
     if "task_id" in info or info["error_code"] == 0:
         self.reload()
     elif info["error_code"] == -19:
         vcode = info["vcode"]
         vcode_dialog = VCodeDialog(self, self.app, info)
         response = vcode_dialog.run()
         vcode_input = vcode_dialog.get_vcode()
         vcode_dialog.destroy()
         if response != Gtk.ResponseType.OK:
             return
         gutil.async_call(
             pcs.cloud_add_link_task,
             self.app.cookie,
             self.app.tokens,
             source_url,
             save_path,
             vcode,
             vcode_input,
             callback=on_link_task_added,
         )
     else:
         self.app.toast(_("Error: {0}").format(info["error_msg"]))
Пример #3
0
 def check_vcode(info, error=None):
     if error or not info:
         return
     if 'task_id' in info or info['error_code'] == 0:
         self.reload()
     elif info['error_code'] == -19:
         vcode_dialog = VCodeDialog(self, self.app, info)
         response = vcode_dialog.run()
         vcode_input = vcode_dialog.get_vcode()
         vcode_dialog.destroy()
         if response != Gtk.ResponseType.OK:
             return
         gutil.async_call(pcs.cloud_add_bt_task, self.app.cookie,
                          self.app.tokens, source_url, save_path,
                          selected_idx, file_sha1, info['vcode'],
                          vcode_input, callback=check_vcode)
     else:
         self.app.toast(_('Error: {0}').format(info['error_msg']))
Пример #4
0
            def on_link_task_added(info, error=None):
                if error or not info:
                    logger.error('CloudPage.do_add_link_task: %s, %s' %
                                 (info, error))
                    self.app.toast(_('Failed to parse download link'))
                    return
                if info.get('error_code', -1) != 0:
                    logger.error('CloudPage.do_add_link_task: %s, %s' %
                                 (info, error))

                if 'task_id' in info or info['error_code'] == 0:
                    self.reload()
                elif info['error_code'] == -19:
                    vcode = info['vcode']
                    vcode_dialog = VCodeDialog(self, self.app, info)
                    response = vcode_dialog.run()
                    vcode_input = vcode_dialog.get_vcode()
                    vcode_dialog.destroy()
                    if response != Gtk.ResponseType.OK:
                        return
                    gutil.async_call(pcs.cloud_add_link_task,
                                     self.app.cookie,
                                     self.app.tokens,
                                     source_url,
                                     save_path,
                                     vcode,
                                     vcode_input,
                                     callback=on_link_task_added)
                else:
                    self.app.toast(_('Error: {0}').format(info['error_msg']))
Пример #5
0
        def check_vcode(info, error=None):
            if error or not info:
                logger.error('CloudPage.check_vcode: %s, %s' % (info, error))
                return
            if info.get('error_code', -1) != 0:
                logger.error('CloudPage.check_vcode: %s, %s' % (info, error))

            if 'task_id' in info or info['error_code'] == 0:
                self.reload()
            elif info['error_code'] == -19:
                vcode_dialog = VCodeDialog(self, self.app, info)
                response = vcode_dialog.run()
                vcode_input = vcode_dialog.get_vcode()
                vcode_dialog.destroy()
                if response != Gtk.ResponseType.OK:
                    return
                gutil.async_call(pcs.cloud_add_bt_task,
                                 self.app.cookie,
                                 self.app.tokens,
                                 source_url,
                                 save_path,
                                 selected_idx,
                                 file_sha1,
                                 info['vcode'],
                                 vcode_input,
                                 callback=check_vcode)
            else:
                self.app.toast(_('Error: {0}').format(info['error_msg']))