Beispiel #1
0
    def on_copyto_activated(self, menu_item):
        tree_paths = self.iconview.get_selected_items()
        if not tree_paths:
            return

        dialog = FolderBrowserDialog(self.parent, self.app, _('Copy To...'))
        response = dialog.run()
        targ_path = ''
        if response != Gtk.ResponseType.OK:
            dialog.destroy()
            return
        targ_path = dialog.get_path()
        dialog.destroy()

        filelist = []
        for tree_path in tree_paths:
            filelist.append({
                'path': self.liststore[tree_path][PATH_COL],
                'dest': targ_path,
                'newname': self.liststore[tree_path][NAME_COL],
                })
        gutil.async_call(
                pcs.copy,
                self.app.cookie, self.app.tokens, filelist,
                callback=self.parent.reload)
Beispiel #2
0
 def on_check_login(info, error=None):
     if not info or error:
         logger.error('SigninDialog.on_check_login: %s, %s' %
                      (info, error))
         self.signin_failed(
             _('Failed to check login, please try again'))
     else:
         ubi_cookie, status = info
         cookie.load_list(ubi_cookie)
         nonlocal codeString
         nonlocal verifycode
         codeString = status['data']['codeString']
         vcodetype = status['data']['vcodetype']
         if codeString:
             dialog = SigninVcodeDialog(self, username, cookie, tokens,
                                        codeString, vcodetype)
             response = dialog.run()
             verifycode = dialog.get_vcode()
             codeString = dialog.codeString
             dialog.destroy()
             if not verifycode or len(verifycode) != 4:
                 self.signin_failed(
                     _('Please input verification code!'))
                 return
             else:
                 gutil.async_call(auth.get_public_key,
                                  cookie,
                                  tokens,
                                  callback=on_get_public_key)
         else:
             gutil.async_call(auth.get_public_key,
                              cookie,
                              tokens,
                              callback=on_get_public_key)
Beispiel #3
0
 def on_drag_data_received(self, widget, context, x, y, data, info, time):
     '''拖放结束'''
     if not data:
         return
     bx, by = self.iconview.convert_widget_to_bin_window_coords(x, y)
     selected = Gtk.TreeView.get_path_at_pos(self.iconview, bx, by)
     if not selected:
         return
     tree_path = selected[0]
     if tree_path is None:
         return
     target_path = self.liststore[tree_path][PATH_COL]
     is_dir = self.liststore[tree_path][ISDIR_COL]
     if not is_dir or info != TargetInfo.PLAIN_TEXT:
         return
     filelist_str = data.get_text()
     filelist = json.loads(filelist_str)
     for file_item in filelist:
         if file_item['path'] == target_path:
             self.app.toast(_('Error: Move folder to itself!'))
             return
     for file_item in filelist:
         file_item['dest'] = target_path
     gutil.async_call(pcs.move, self.app.cookie, self.app.tokens, filelist,
                      callback=self.parent.reload)
Beispiel #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']))
Beispiel #5
0
 def on_get_share_uk(info, error=None):
     if error or not info:
         logger.error('SharePage.reload: %s, %s' % (error, info))
         self.app.toast(_('Invalid link: {0}!'.format(self.curr_url)))
         self.has_next = False
         self.url_entry.props.secondary_icon_name = REFRESH_ICON
         return
     else:
         need_pwd = info[0]
         if info[1]:
             self.surl = info[1]
         if len(info) == 4 and info[2] and info[3]:
             self.uk, self.shareid = info[2:4]
         # 输入密码:
         if need_pwd:
             pwd_dialog = PwdDialog(self.app)
             response = pwd_dialog.run()
             if response == Gtk.ResponseType.OK:
                 pwd = pwd_dialog.get_pwd()
             else:
                 return
             pwd_dialog.destroy()
             gutil.async_call(pcs.verify_share_password,
                              self.app.cookie,
                              self.uk,
                              self.shareid,
                              self.surl,
                              pwd,
                              callback=on_verify_password)
         else:
             self.load_url()
Beispiel #6
0
    def on_clear_button_clicked(self, button):
        def on_clear_task(info, error=None):
            self.reload()

        gutil.async_call(
            pcs.cloud_clear_task, self.app.cookie, self.app.tokens,
            callback=on_clear_task)
Beispiel #7
0
 def on_search_entry_activated(self, search_entry):
     text = search_entry.get_text()
     if not text:
         return
     gutil.async_call(
             pcs.search, self.app.cookie, self.app.tokens, text,
             self.path, callback=self.icon_window.load)
Beispiel #8
0
 def on_get_bduss(result, error=None):
     status, info = result
     if status == 4:
         self.signin_failed(
             _('Please check username and password are correct!'))
     elif status == 0:
         cookie.load_list(info)
         self.signin_button.set_label(_('Get bdstoken...'))
         gutil.async_call(auth.get_bdstoken,
                          cookie,
                          callback=on_get_bdstoken)
     elif status == 257:
         vcodetype, codeString = info
         dialog = SigninVcodeDialog(self, username, cookie,
                                    tokens['token'], codeString,
                                    vcodetype)
         dialog.run()
         vcode = dialog.get_vcode()
         dialog.destroy()
         if not vcode or len(vcode) != 4:
             self.signin_failed(_('Please input verification code!'))
             return
         self.signin_button.set_label(_('Get bduss...'))
         gutil.async_call(auth.get_bduss,
                          cookie,
                          tokens['token'],
                          username,
                          password,
                          vcode,
                          codeString,
                          callback=on_get_bduss)
     else:
         self.signin_failed(
             _('Unknown err_no {0}, please try again!').format(status))
Beispiel #9
0
    def on_private_share_activated(self, menu_item):
        def on_share(info, error=None):
            if error or not info or info[0]['errno'] != 0:
                logger.error('IconWindow.on_private_share_activated: %s, %s' %
                             (info, error))
                self.app.toast(_('Failed to share selected files'))
                return

            file_info, passwd = info

            tipInfo = "".join([
                "链接: ",
                file_info['shorturl'],
                " 密码: ",
                passwd
            ])
            self.app.update_clipboard(tipInfo)


        tree_paths = self.iconview.get_selected_items()
        if not tree_paths:
            return
        fid_list = []
        for tree_path in tree_paths:
            pcs_file = self.get_pcs_file(tree_path)
            fid_list.append(pcs_file['fs_id'])
            privatePwd = self.getPrivateSharePwd(_("请输入4位的分享密码(可以是一个数字或字母加一个中文哦)"), _("分享密码"))
            if privatePwd is None:
                return
            # if len(privatePwd) is not 4:
            #     self.app.toast("密码长度不是4位!")
            #     return

            gutil.async_call(pcs.enable_private_share, self.app.cookie,
                             self.app.tokens, fid_list, privatePwd, callback=on_share)
Beispiel #10
0
        def on_list_task(info, error=None):
            print('on list task() --', info)
            if error or not info:
                print('Error: failed to list cloud tasks')
                return
            if 'error_code' in info and info['error_code'] != 0:
                print('Error: ', info['error_msg'])
                print(info)
                return
            tasks = info['task_info']
            for task in tasks:
                self.liststore.append([
                    task['task_id'],
                    task['task_name'],
                    task['save_path'],
                    task['source_url'],
                    0,
                    0,
                    int(task['status']),
                    0,
                    '0',
                    ])
            self.scan_tasks()

            nonlocal start
            start = start + len(tasks)
            if info['total'] > start:
                gutil.async_call(
                    pcs.cloud_list_task, self.app.cookie, self.app.tokens,
                    start, callback=on_list_task)
Beispiel #11
0
 def open_video_link(red_url, error=None):
     '''得到视频最后地址后, 调用播放器直接播放'''
     if error or not red_url:
         return
     gutil.async_call(app_info.launch_uris, [
         red_url,
     ], None)
    def on_cloud_button_clicked(self, button):
        def on_transfer_files(info, error=None):
            if error or not info:
                self.app.toast(_('Failed to copy selected files!'))
                logger.error('SharePage.on_cloud_button_clicked: %s %s' %
                             (info, error))
            elif info['errno'] != 0:
                self.app.toast(_('Failed to copy selected files! {0}').format(
                                ErrorMsg.o.get(info['errno'])))
                logger.error('SharePage.on_cloud_button_clicked: %s %s' %
                             (info, error))
            else:
                self.app.blink_page(self.app.home_page)

        filelist = [row[PATH_COL] for row in self.liststore if
                    row[CHECK_COL] and row[NAME_COL] != '..']
        if not filelist:
            return
        folder_browser = FolderBrowserDialog(self, self.app, _('Save to..'))
        response = folder_browser.run()
        dest = folder_browser.get_path()
        folder_browser.destroy()
        if response != Gtk.ResponseType.OK:
            return
        gutil.async_call(pcs.share_transfer, self.app.cookie, self.app.tokens,
                         self.shareid, self.uk, filelist, dest,
                         self.app.profile['upload-mode'],
                         callback=on_transfer_files)
Beispiel #13
0
    def load(self):
        def on_load(info, error=None):
            self.loading_spin.stop()
            self.loading_spin.hide()
            if not info or 'errno' not in info:
                self.app.toast(_('Network error'))
            elif info['errno'] != 0 and info['errno'] != 31034:
                self.app.toast(info.get('error_msg', _('Network error')))

            if error or not info or info.get('errno', -1) != 0:
                if error or not info or info.get('errno', -1) != 31034:
                    logger.error('%s.on_load: %s, %s' %
                                 (self.disname, info, error))
                return
            self.icon_window.load(info['info'])

        has_next = True
        self.page_num = 1
        self.loading_spin.start()
        self.loading_spin.show_all()
        gutil.async_call(pcs.get_category,
                         self.app.cookie,
                         self.app.tokens,
                         self.category,
                         self.page_num,
                         callback=on_load)
Beispiel #14
0
 def on_check_login(status, error=None):
     if error or not status:
         self.signin_failed(
                 _('Failed to get check login, please try again.'))
     elif len(status['data']['codeString']):
         codeString = status['data']['codeString']
         vcodetype = status['data']['vcodetype']
         dialog = SigninVcodeDialog(
             self, username, cookie, tokens['token'],
             codeString, vcodetype)
         dialog.run()
         vcode = dialog.get_vcode()
         dialog.destroy()
         if not vcode or len(vcode) != 4:
             self.signin_failed(
                 _('Please input verification code!'))
             return
         self.signin_button.set_label(_('Get bduss...'))
         gutil.async_call(
                 auth.get_bduss, cookie,
                 tokens['token'], username, password, vcode,
                 codeString, callback=on_get_bduss)
     else:
         self.signin_button.set_label(_('Get bduss...'))
         gutil.async_call(
                 auth.get_bduss, cookie, tokens['token'], username,
                 password, callback=on_get_bduss)
Beispiel #15
0
    def add_cloud_bt_task(self, source_url, save_path=None):
        '''从服务器上获取种子, 并建立离线下载任务

        source_url - BT 种子在服务器上的绝对路径, 或者是磁链的地址.
        save_path  - 要保存到的路径, 如果为None, 就会弹出目录选择的对话框
        '''
        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']))

        self.check_first()

        if not save_path:
            folder_browser = FolderBrowserDialog(self, self.app,
                                                 _('Save to..'))
            response = folder_browser.run()
            save_path = folder_browser.get_path()
            folder_browser.destroy()
            if response != Gtk.ResponseType.OK:
                return
        if not save_path:
            return

        bt_browser = BTBrowserDialog(self, self.app, _('Choose..'), source_url,
                                     save_path)
        response = bt_browser.run()
        selected_idx, file_sha1 = bt_browser.get_selected()
        bt_browser.destroy()
        if response != Gtk.ResponseType.OK or not selected_idx:
            return
        gutil.async_call(pcs.cloud_add_bt_task,
                         self.app.cookie,
                         self.app.tokens,
                         source_url,
                         save_path,
                         selected_idx,
                         file_sha1,
                         callback=check_vcode)
        self.app.blink_page(self.app.cloud_page)
Beispiel #16
0
    def load_next(self):
        def on_load_next(info, error=None):
            self.loading_spin.stop()
            self.loading_spin.hide()
            if not info:
                self.app.toast(_('Network error'))
            elif info.get('errno', -1) != 0:
                self.app.toast(info.get('error_msg', _('Network error')))
            if error or not info or info['errno'] != 0:
                logger.error('%s.on_load_next: %s, %s' %
                             (self.disname, info, error))
                return
            if info['info']:
                self.icon_window.load_next(info['info'])
            else:
                self.has_next = False

        if not self.has_next:
            return
        self.loading_spin.start()
        self.loading_spin.show_all()
        self.page_num = self.page_num + 1
        gutil.async_call(pcs.get_category,
                         self.app.cookie,
                         self.app.tokens,
                         self.category,
                         self.page_num,
                         callback=on_load_next)
Beispiel #17
0
 def _refresh_vcode(info, error=None):
     if not info or error:
         logger.error("SigninVcode.refresh_vcode: %s, %s." % (info, error))
         return
     logger.debug("refresh vcode: %s" % info)
     self.codeString = info["data"]["verifyStr"]
     gutil.async_call(auth.get_signin_vcode, self.cookie, self.codeString, callback=self.update_img)
Beispiel #18
0
 def load_next(self):
     self.loading_spin.start()
     self.loading_spin.show_all()
     self.page_num = self.page_num + 1
     gutil.async_call(
             pcs.list_trash, self.app.cookie, self.app.tokens, '/',
             self.page_num, callback=self.append_filelist)
Beispiel #19
0
    def on_cloud_button_clicked(self, button):
        def on_transfer_files(info, error=None):
            if error or not info:
                self.app.toast(_('Failed to copy selected files!'))
                logger.error('SharePage.on_cloud_button_clicked: %s %s' %
                             (info, error))
            elif info['errno'] != 0:
                self.app.toast(_('Failed to copy selected files! {0}').format(
                                ErrorMsg.o.get(info['errno'])))
                logger.error('SharePage.on_cloud_button_clicked: %s %s' %
                             (info, error))
            else:
                self.app.blink_page(self.app.home_page)

        filelist = [row[PATH_COL] for row in self.liststore if
                    row[CHECK_COL] and row[NAME_COL] != '..']
        if not filelist:
            return
        folder_browser = FolderBrowserDialog(self, self.app, _('Save to..'))
        response = folder_browser.run()
        dest = folder_browser.get_path()
        folder_browser.destroy()
        if response != Gtk.ResponseType.OK:
            return
        gutil.async_call(pcs.share_transfer, self.app.cookie, self.app.tokens,
                         self.shareid, self.uk, filelist, dest,
                         self.app.profile['upload-mode'],
                         callback=on_transfer_files)
Beispiel #20
0
    def add_tasks(self, pcs_files):
        '''建立批量下载任务, 包括目录'''
        def on_list_dir(info, error=None):
            path, pcs_files = info
            if error or not pcs_files:
                dialog = Gtk.MessageDialog(
                    self.app.window, Gtk.DialogFlags.MODAL,
                    Gtk.MessageType.ERROR, Gtk.ButtonsType.CLOSE,
                    _('Failed to scan folder to download'))
                dialog.format_secondary_text(
                    _('Please download {0} again').format(path))
                dialog.run()
                dialog.destroy()
                return
            self.add_tasks(pcs_files)

        self.check_first()
        for pcs_file in pcs_files:
            if pcs_file['isdir']:
                gutil.async_call(pcs.list_dir_all,
                                 self.app.cookie,
                                 self.app.tokens,
                                 pcs_file['path'],
                                 callback=on_list_dir)
            else:
                self.add_task(pcs_file)
        self.check_commit(force=True)
Beispiel #21
0
    def launch_app_with_app_info(self, app_info):
        def save_playlist(pls, error=None):
            '''先保存播放列表到临时目录, 再调用播放器直接打开这个播放列表

            '''
            if not error and pls and b'error_code' not in pls:
                pls_filepath = os.path.join('/tmp',
                        pcs_file['server_filename'] + '.m3u8')
                with open(pls_filepath, 'wb') as fh:
                    fh.write(pls)
                pls_file_uri = 'file://' + pls_filepath
                app_info.launch_uris([pls_file_uri, ], None)
            else:
                logger.error('IconWindow.launch_app_with_app_info: %s, %s' %
                             (pls, error))
                return

        # first, download this to load dir
        # then open it with app_info
        tree_paths = self.iconview.get_selected_items()
        if not tree_paths:
            return
        tree_path = tree_paths[0]
        file_type = self.liststore[tree_path][TYPE_COL]
        pcs_file = self.get_pcs_file(tree_path)
        # 'media' 对应于rmvb格式.
        # 如果是视频等多媒体格式的话, 流媒体模式下是直接调用播放器进行网络播放的
        if self.app.profile['use-streaming'] and ('video' in file_type or 'media' in file_type):
            gutil.async_call(pcs.get_streaming_playlist, self.app.cookie,
                             pcs_file['path'], callback=save_playlist)
        else:
            self.app.blink_page(self.app.download_page)
            self.app.download_page.add_launch_task(pcs_file, app_info)
Beispiel #22
0
    def display_files(self, pcs_files):
        '''重新格式化一下文件列表, 去除不需要的信息

        这一操作主要是为了便于接下来的查找工作.
        文件的path都被提取出来, 然后放到了一个list中.
        '''
        tree_iters = []
        for pcs_file in pcs_files:
            path = pcs_file['path']
            pixbuf, type_ = self.app.mime.get(path, pcs_file['isdir'],
                                              icon_size=self.ICON_SIZE)
            name = os.path.split(path)[NAME_COL]
            tooltip = gutil.escape(name)
            size = pcs_file.get('size', 0)
            if pcs_file['isdir']:
                human_size = '--'
            else:
                human_size = util.get_human_size(pcs_file['size'])[0]
            mtime = pcs_file.get('server_mtime', 0)
            human_mtime = time.ctime(mtime)
            tree_iter = self.liststore.append([
                pixbuf, name, path, tooltip, size, human_size,
                pcs_file['isdir'], mtime, human_mtime, type_,
                json.dumps(pcs_file)
            ])
            tree_iters.append(tree_iter)
        cache_path = Config.get_cache_path(self.app.profile['username'])
        gutil.async_call(gutil.update_liststore_image, self.liststore,
                         tree_iters, PIXBUF_COL, pcs_files, cache_path,
                         self.ICON_SIZE)
Beispiel #23
0
 def load_next(self):
     self.loading_spin.start()
     self.loading_spin.show_all()
     self.page_num = self.page_num + 1
     gutil.async_call(
             pcs.list_trash, self.app.cookie, self.app.tokens, '/',
             self.page_num, callback=self.append_filelist)
Beispiel #24
0
    def scan_tasks(self):
        '''定期获取离线下载任务的信息, 比如10秒钟'''
        def update_task_status(info, error=None):
            if error or not info:
                logger.error('CloudPage.scan_tasks: %s, %s' % (info, error))
                return
            tasks = info['task_info']
            for row in self.liststore:
                if not row or row[TASKID_COL] not in tasks:
                    continue
                task = tasks[row[TASKID_COL]]
                row[SIZE_COL] = int(task['file_size'])
                row[FINISHED_COL] = int(task['finished_size'])
                row[STATUS_COL] = int(task['status'])
                if row[SIZE_COL]:
                    row[PERCENT_COL] = int(row[FINISHED_COL] / row[SIZE_COL] *
                                           100)
                size = util.get_human_size(row[SIZE_COL])[0]
                finished_size = util.get_human_size(row[FINISHED_COL])[0]
                if row[SIZE_COL] == row[FINISHED_COL]:
                    row[HUMANSIZE_COL] = size
                else:
                    row[HUMANSIZE_COL] = '{0}/{1}'.format(finished_size, size)

        task_ids = [row[TASKID_COL] for row in self.liststore]
        if task_ids:
            gutil.async_call(pcs.cloud_query_task,
                             self.app.cookie,
                             self.app.tokens,
                             task_ids,
                             callback=update_task_status)
Beispiel #25
0
        def do_worker_merge_files(fid):
            def on_create_superfile(pcs_file, error=None):
                if error or not pcs_file:
                    print('on create superfile:', pcs_file, error)
                    do_worker_error(fid)
                    return
                else:
                    self.remove_slice_db(fid)
                    do_worker_uploaded(fid)

            block_list = self.get_slice_db(fid)
            if fid not in self.workers:
                return
            row = self.get_row_by_fid(fid)
            if not row:
                return
            if not block_list:
                # TODO
                pass
            else:
                gutil.async_call(pcs.create_superfile,
                                 self.app.cookie,
                                 row[PATH_COL],
                                 block_list,
                                 callback=on_create_superfile)
Beispiel #26
0
    def scan_tasks(self):
        '''定期获取离线下载任务的信息, 比如10秒钟'''
        def update_task_status(info, error=None):
            if error or not info:
                logger.error('CloudPage.scan_tasks: %s, %s' % (info, error))
                return
            tasks = info['task_info']
            for row in self.liststore:
                if not row or row[TASKID_COL] not in tasks:
                    continue
                task = tasks[row[TASKID_COL]]
                row[SIZE_COL] = int(task['file_size'])
                row[FINISHED_COL] = int(task['finished_size'])
                row[STATUS_COL] = int(task['status'])
                if row[SIZE_COL]:
                    row[PERCENT_COL] = int(
                            row[FINISHED_COL] / row[SIZE_COL] * 100)
                size = util.get_human_size(row[SIZE_COL])[0]
                finished_size = util.get_human_size(row[FINISHED_COL])[0]
                if row[SIZE_COL] == row[FINISHED_COL]:
                    row[HUMANSIZE_COL] = size
                else:
                    row[HUMANSIZE_COL] = '{0}/{1}'.format(finished_size, size)

        task_ids = [row[TASKID_COL] for row in self.liststore]
        if task_ids:
            gutil.async_call(pcs.cloud_query_task, self.app.cookie,
                             self.app.tokens, task_ids,
                             callback=update_task_status)
Beispiel #27
0
    def __init__(self, parent, app, info):
        super().__init__(_('Verification..'), app.window,
                         Gtk.DialogFlags.MODAL,
                         (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
                          Gtk.STOCK_OK, Gtk.ResponseType.OK))

        self.set_default_response(Gtk.ResponseType.OK)
        self.set_default_size(320, 200)
        self.set_border_width(10)
        self.app = app

        box = self.get_content_area()
        box.set_spacing(10)

        gutil.async_call(net.urlopen, info['img'],
                         {'Cookie': app.cookie.header_output()},
                         callback=self.update_img)
        self.img = Gtk.Image()
        box.pack_start(self.img, False, False, 0)

        self.entry = Gtk.Entry()
        self.entry.connect('activate',
                lambda *args: self.response(Gtk.ResponseType.OK))
        box.pack_start(self.entry, False, False, 0)

        box.show_all()
Beispiel #28
0
 def load(self):
     self.loading_spin.start()
     self.loading_spin.show_all()
     self.page_num = 1
     self.liststore.clear()
     gutil.async_call(pcs.list_trash, self.app.cookie, self.app.tokens, '/',
                      self.page_num, callback=self.append_filelist)
Beispiel #29
0
 def on_check_login(info, error=None):
     if not info or error:
         logger.error('SigninDialog.on_check_login: %s, %s' %
                      (info, error))
         self.signin_failed(_('Failed to check login, please try again'))
     else:
         ubi_cookie, status = info
         cookie.load_list(ubi_cookie)
         nonlocal codeString
         nonlocal verifycode
         codeString = status['data']['codeString']
         vcodetype = status['data']['vcodetype']
         if codeString:
             dialog = SigninVcodeDialog(self, username, cookie,
                                        tokens, codeString, vcodetype)
             response = dialog.run()
             verifycode = dialog.get_vcode()
             codeString = dialog.codeString
             dialog.destroy()
             if not verifycode or len(verifycode) != 4:
                 self.signin_failed(_('Please input verification code!'))
                 return
             else:
                 gutil.async_call(auth.get_public_key, cookie,
                                  tokens, callback=on_get_public_key)
         else:
             gutil.async_call(auth.get_public_key, cookie,
                              tokens, callback=on_get_public_key)
Beispiel #30
0
 def on_get_bduss(result, error=None):
     status, info = result
     if status == 4:
         self.signin_failed(
             _('Please check username and password are correct!'))
     elif status == 0:
         cookie.load_list(info)
         self.signin_button.set_label(_('Get bdstoken...'))
         gutil.async_call(
             auth.get_bdstoken, cookie, callback=on_get_bdstoken)
     elif status == 257:
         vcodetype, codeString = info
         dialog = SigninVcodeDialog(
             self, username, cookie, tokens['token'],
             codeString, vcodetype)
         dialog.run()
         vcode = dialog.get_vcode()
         dialog.destroy()
         if not vcode or len(vcode) != 4:
             self.signin_failed(
                 _('Please input verification code!'))
             return
         self.signin_button.set_label(_('Get bduss...'))
         gutil.async_call(
                 auth.get_bduss, cookie,
                 tokens['token'], username, password, vcode,
                 codeString, callback=on_get_bduss)
     else:
         self.signin_failed(
             _('Unknown err_no {0}, please try again!').format(
                 status))
Beispiel #31
0
        def do_worker_merge_files(fid):
            def on_create_superfile(pcs_file, error=None):
                if error or not pcs_file:
                    self.app.toast(_('Failed to upload, please try again'))
                    logger.error('UploadPage.do_worker_merge_files: %s, %s' %
                                 (pcs_file, error))
                    do_worker_error(fid)
                    return
                else:
                    self.remove_slice_db(fid)
                    do_worker_uploaded(fid)

            block_list = self.get_slice_db(fid)
            if fid not in self.workers:
                return
            row = self.get_row_by_fid(fid)
            if not row:
                return
            if not block_list:
                # TODO:
                pass
            else:
                gutil.async_call(pcs.create_superfile, self.app.cookie,
                                 row[PATH_COL], block_list,
                                 callback=on_create_superfile)
Beispiel #32
0
    def __init__(self, parent, app, info):
        super().__init__(
            _('Verification..'), app.window, Gtk.DialogFlags.MODAL,
            (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
            Gtk.STOCK_OK, Gtk.ResponseType.OK))

        self.set_default_response(Gtk.ResponseType.OK)
        self.set_default_size(320, 200)
        self.set_border_width(10)
        self.app = app

        box = self.get_content_area()
        box.set_spacing(10)

        gutil.async_call(
            net.urlopen, info['img'], {
                'Cookie': app.cookie.header_output(),
            }, callback=self.update_img)
        self.img = Gtk.Image()
        box.pack_start(self.img, False, False, 0)

        self.entry = Gtk.Entry()
        self.entry.connect('activate', lambda *args: self.hide())
        box.pack_start(self.entry, False, False, 0)

        box.show_all()
Beispiel #33
0
        def on_list_task(info, error=None):
            self.loading_spin.stop()
            self.loading_spin.hide()
            if error or not info:
                return
            if "error_code" in info and info["error_code"] != 0:
                return
            tasks = info["task_info"]
            for task in tasks:
                self.liststore.append(
                    [
                        task["task_id"],
                        task["task_name"],
                        task["save_path"],
                        task["source_url"],
                        0,
                        0,
                        int(task["status"]),
                        0,
                        "0",
                        gutil.escape(os.path.join(task["save_path"], task["task_name"])),
                    ]
                )
            self.scan_tasks()

            nonlocal start
            start = start + len(tasks)
            if info["total"] > start:
                gutil.async_call(pcs.cloud_list_task, self.app.cookie, self.app.tokens, start, callback=on_list_task)
Beispiel #34
0
        def do_worker_merge_files(fid):
            def on_create_superfile(pcs_file, error=None):
                if error or not pcs_file:
                    self.app.toast(_('Failed to upload, please try again'))
                    logger.error('UploadPage.do_worker_merge_files: %s, %s' %
                                 (pcs_file, error))
                    do_worker_error(fid)
                    return
                else:
                    self.remove_slice_db(fid)
                    do_worker_uploaded(fid)

            block_list = self.get_slice_db(fid)
            if fid not in self.workers:
                return
            row = self.get_row_by_fid(fid)
            if not row:
                return
            if not block_list:
                # TODO:
                pass
            else:
                gutil.async_call(pcs.create_superfile, self.app.cookie,
                                 row[PATH_COL], block_list,
                                 callback=on_create_superfile)
Beispiel #35
0
    def scan_tasks(self):
        """定期获取离线下载任务的信息, 比如10秒钟"""

        def update_task_status(info, error=None):
            if error or not info:
                return
            tasks = info["task_info"]
            for row in self.liststore:
                if row[TASKID_COL] not in tasks:
                    continue
                task = tasks[row[TASKID_COL]]
                row[SIZE_COL] = int(task["file_size"])
                row[FINISHED_COL] = int(task["finished_size"])
                row[STATUS_COL] = int(task["status"])
                if row[SIZE_COL]:
                    row[PERCENT_COL] = int(row[FINISHED_COL] / row[SIZE_COL] * 100)
                size = util.get_human_size(row[SIZE_COL])[0]
                finished_size = util.get_human_size(row[FINISHED_COL])[0]
                if row[SIZE_COL] == row[FINISHED_COL]:
                    row[HUMANSIZE_COL] = size
                else:
                    row[HUMANSIZE_COL] = "{0}/{1}".format(finished_size, size)

        task_ids = [row[TASKID_COL] for row in self.liststore]
        if task_ids:
            gutil.async_call(
                pcs.cloud_query_task, self.app.cookie, self.app.tokens, task_ids, callback=update_task_status
            )
Beispiel #36
0
 def on_check_login(status, error=None):
     if error or not status:
         self.signin_failed(
             _('Failed to get check login, please try again.'))
     elif len(status['data']['codeString']):
         codeString = status['data']['codeString']
         vcodetype = status['data']['vcodetype']
         dialog = SigninVcodeDialog(self, username, cookie,
                                    tokens['token'], codeString,
                                    vcodetype)
         dialog.run()
         vcode = dialog.get_vcode()
         dialog.destroy()
         if not vcode or len(vcode) != 4:
             self.signin_failed(_('Please input verification code!'))
             return
         self.signin_button.set_label(_('Get bduss...'))
         gutil.async_call(auth.get_bduss,
                          cookie,
                          tokens['token'],
                          username,
                          password,
                          vcode,
                          codeString,
                          callback=on_get_bduss)
     else:
         self.signin_button.set_label(_('Get bduss...'))
         gutil.async_call(auth.get_bduss,
                          cookie,
                          tokens['token'],
                          username,
                          password,
                          callback=on_get_bduss)
Beispiel #37
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"]))
Beispiel #38
0
    def load_next(self):
        '''载入下一页'''
        def on_load_next(info, error=None):
            self.loading_spin.stop()
            self.loading_spin.hide()
            if not info:
                self.app.toast(_('Network error'))
            elif info.get('errno', -1) != 0:
                self.app.toast(info.get('error_msg', _('Network error')))
            if error or not info or info.get('errno', -1) != 0:
                logger.error('HomePage.load_next: %s, %s' % (info, error))
                return
            if info['list']:
                self.icon_window.load_next(info['list'])
            else:
                self.has_next = False

        if not self.has_next:
            return
        self.page_num = self.page_num + 1
        self.path_box.set_path(self.path)
        self.loading_spin.start()
        self.loading_spin.show_all()
        gutil.async_call(pcs.list_dir,
                         self.app.cookie,
                         self.app.tokens,
                         self.path,
                         self.page_num,
                         callback=on_load_next)
Beispiel #39
0
 def on_cancel_button_clicked(self, button):
     model, tree_paths = self.selection.get_selected_rows()
     if not tree_paths or len(tree_paths) != 1:
         return
     tree_path = tree_paths[0]
     task_id = model[tree_path][TASKID_COL]
     gutil.async_call(pcs.cloud_cancel_task, self.app.cookie, self.app.tokens, task_id, callback=self.reload)
Beispiel #40
0
    def add_tasks(self, pcs_files, dirname=''):
        '''建立批量下载任务, 包括目录'''
        def on_list_dir(info, error=None):
            path, pcs_files = info
            if error or not pcs_files:
                dialog = Gtk.MessageDialog(self.app.window,
                        Gtk.DialogFlags.MODAL,
                        Gtk.MessageType.ERROR, Gtk.ButtonsType.CLOSE,
                        _('Failed to scan folder to download'))
                dialog.format_secondary_text(
                        _('Please download {0} again').format(path))
                dialog.run()
                dialog.destroy()
                return
            self.add_tasks(pcs_files, dirname)

        self.check_first()
        for pcs_file in pcs_files:
            if pcs_file['isdir']:
                gutil.async_call(pcs.list_dir_all, self.app.cookie,
                                 self.app.tokens, pcs_file['path'],
                                 callback=on_list_dir)
            else:
                self.add_task(pcs_file, dirname)
        self.check_commit(force=True)
Beispiel #41
0
    def __init__(self, parent, cookie, form):
        super().__init__(_('Verification..'), parent, Gtk.DialogFlags.MODAL)

        self.set_default_size(280, 120)
        self.set_border_width(5)
        self.cookie = cookie
        self.form = form

        box = self.get_content_area()
        box.set_spacing(5)

        self.vcode_img = Gtk.Image()
        box.pack_start(self.vcode_img, False, False, 0)
        self.vcode_entry = Gtk.Entry()
        self.vcode_entry.connect('activate', self.on_vcode_confirmed)
        box.pack_start(self.vcode_entry, False, False, 0)

        button_box = Gtk.Box()
        box.pack_end(button_box, False, False, 0)
        vcode_confirm = Gtk.Button.new_from_stock(Gtk.STOCK_OK)
        vcode_confirm.connect('clicked', self.on_vcode_confirmed)
        button_box.pack_end(vcode_confirm, True, True, 0)

        gutil.async_call(auth.get_wap_signin_vcode,
                         cookie,
                         form['vcodestr'],
                         callback=self.update_img)
        self.img = Gtk.Image()
        box.pack_start(self.img, False, False, 0)

        box.show_all()
Beispiel #42
0
        def on_list_task(info, error=None):
            self.loading_spin.stop()
            self.loading_spin.hide()
            if error or not info:
                return
            if 'error_code' in info and info['error_code'] != 0:
                return
            tasks = info['task_info']
            for task in tasks:
                self.liststore.append([
                    task['task_id'],
                    task['task_name'],
                    task['save_path'],
                    task['source_url'],
                    0,
                    0,
                    int(task['status']),
                    0,
                    '0',
                    gutil.escape(task['save_path'])
                    ])
            self.scan_tasks()

            nonlocal start
            start = start + len(tasks)
            if info['total'] > start:
                gutil.async_call(
                    pcs.cloud_list_task, self.app.cookie, self.app.tokens,
                    start, callback=on_list_task)
Beispiel #43
0
 def on_get_wap_passport(info, error=None):
     if error or not info:
         print('Error occurs in on_get_wap_passport:', info, error)
         self.signin_failed(
             _('Failed to get WAP page, please try again.'))
     cookie_str, _form = info
     if not cookie_str or not _form:
         print('Error occurs in on_get_wap_passport:', info, error)
         self.signin_failed(
             _('Failed to get WAP page, please try again.'))
     else:
         nonlocal form
         form = _form
         form['username'] = username
         form['password'] = password
         cookie.load_list(cookie_str)
         if len(form.get('vcodestr', '')):
             dialog = SigninVcodeDialog(self, cookie, form)
             dialog.run()
             dialog.destroy()
             if len(form.get('verifycode', '')) != 4:
                 print('verifycode length is not 4!')
                 return
         self.signin_button.set_label(_('Signin...'))
         gutil.async_call(auth.wap_signin,
                          cookie,
                          form,
                          callback=on_wap_signin)
Beispiel #44
0
    def load_next(self):
        '''载入下一页'''
        def on_load_next(info, error=None):
            self.loading_spin.stop()
            self.loading_spin.hide()
            if not info:
                self.app.toast(_('Network error'))
            elif info.get('errno', -1) != 0:
                self.app.toast(info.get('error_msg', _('Network error')))
            if error or not info or info.get('errno', -1) != 0:
                logger.error('HomePage.load_next: %s, %s' % (info, error))
                return
            if info['list']:
                self.icon_window.load_next(info['list'])
            else:
                self.has_next = False

        if not self.has_next:
            return
        self.page_num = self.page_num + 1
        self.path_box.set_path(self.path)
        self.loading_spin.start()
        self.loading_spin.show_all()
        gutil.async_call(pcs.list_dir, self.app.cookie, self.app.tokens,
                         self.path, self.page_num, callback=on_load_next)
Beispiel #45
0
    def display_files(self, pcs_files):
        '''重新格式化一下文件列表, 去除不需要的信息

        这一操作主要是为了便于接下来的查找工作.
        文件的path都被提取出来, 然后放到了一个list中.
        '''
        tree_iters = []
        for pcs_file in pcs_files:
            path = pcs_file['path']
            pixbuf, type_ = self.app.mime.get(path,
                                              pcs_file['isdir'],
                                              icon_size=self.ICON_SIZE)
            name = os.path.split(path)[NAME_COL]
            tooltip = gutil.escape(name)
            size = pcs_file.get('size', 0)
            if pcs_file['isdir']:
                human_size = '--'
            else:
                human_size = util.get_human_size(pcs_file['size'])[0]
            mtime = pcs_file.get('server_mtime', 0)
            human_mtime = time.ctime(mtime)
            tree_iter = self.liststore.append([
                pixbuf, name, path, tooltip, size, human_size,
                pcs_file['isdir'], mtime, human_mtime, type_,
                json.dumps(pcs_file)
            ])
            tree_iters.append(tree_iter)
        cache_path = Config.get_cache_path(self.app.profile['username'])
        gutil.async_call(gutil.update_liststore_image, self.liststore,
                         tree_iters, PIXBUF_COL, pcs_files, cache_path,
                         self.ICON_SIZE)
Beispiel #46
0
 def open_video_link(red_url, error=None):
     '''得到视频最后地址后, 调用播放器直接播放'''
     if error or not red_url:
         logger.error('IconWindow.launch_app_with_app_info: %s, %s' %
                      (red_url, error))
         return
     gutil.async_call(app_info.launch_uris, [red_url, ], None)
Beispiel #47
0
 def on_drag_data_received(self, widget, context, x, y, data, info, time):
     '''拖放结束'''
     if not data:
         return
     bx, by = self.iconview.convert_widget_to_bin_window_coords(x, y)
     selected = Gtk.TreeView.get_path_at_pos(self.iconview, bx, by)
     if not selected:
         return
     tree_path = selected[0]
     if tree_path is None:
         return
     target_path = self.liststore[tree_path][PATH_COL]
     is_dir = self.liststore[tree_path][ISDIR_COL]
     if not is_dir or info != TargetInfo.PLAIN_TEXT:
         return
     filelist_str = data.get_text()
     filelist = json.loads(filelist_str)
     for file_item in filelist:
         if file_item['path'] == target_path:
             self.app.toast(_('Error: Move folder to itself!'))
             return
     for file_item in filelist:
         file_item['dest'] = target_path
     gutil.async_call(pcs.move,
                      self.app.cookie,
                      self.app.tokens,
                      filelist,
                      callback=self.parent.reload)
Beispiel #48
0
        def on_list_task(info, error=None):
            self.loading_spin.stop()
            self.loading_spin.hide()
            if not info:
                self.app.toast(_('Network error, info is empty'))
            if error or not info:
                logger.error('CloudPage.load: %s, %s' % (info, error))
                return
            tasks = info['task_info']
            for task in tasks:
                self.liststore.append([
                    task['task_id'], task['task_name'], task['save_path'],
                    task['source_url'], 0, 0,
                    int(task['status']), 0, '0',
                    gutil.escape(task['save_path'])
                ])
            self.scan_tasks()

            nonlocal start
            start = start + len(tasks)
            if info['total'] > start:
                gutil.async_call(pcs.cloud_list_task,
                                 self.app.cookie,
                                 self.app.tokens,
                                 start,
                                 callback=on_list_task)
Beispiel #49
0
 def open_video_link(resp, error=None):
     '''得到视频最后地址后, 调用播放器直接播放'''
     if error or not resp:
         print('Failed to get video dlink!')
         return
     red_url, req_id = resp
     gutil.async_call(app_info.launch_uris, [red_url, ], None)
Beispiel #50
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']))
Beispiel #51
0
    def __init__(self, parent, cookie, form):
        super().__init__(
            _('Verification..'), parent, Gtk.DialogFlags.MODAL)

        self.set_default_size(280, 120)
        self.set_border_width(5)
        self.cookie = cookie
        self.form = form

        box = self.get_content_area()
        box.set_spacing(5)

        self.vcode_img = Gtk.Image()
        box.pack_start(self.vcode_img, False, False, 0)
        self.vcode_entry = Gtk.Entry()
        self.vcode_entry.connect('activate', self.on_vcode_confirmed)
        box.pack_start(self.vcode_entry, False, False, 0)

        button_box = Gtk.Box()
        box.pack_end(button_box, False, False, 0)
        vcode_confirm = Gtk.Button.new_from_stock(Gtk.STOCK_OK)
        vcode_confirm.connect('clicked', self.on_vcode_confirmed)
        button_box.pack_end(vcode_confirm, True, True, 0)

        gutil.async_call(
            auth.get_wap_signin_vcode, cookie, form['vcodestr'],
            callback=self.update_img)
        self.img = Gtk.Image()
        box.pack_start(self.img, False, False, 0)

        box.show_all()
Beispiel #52
0
        def on_list_task(info, error=None):
            self.loading_spin.stop()
            self.loading_spin.hide()
            if not info:
                self.app.toast(_('Network error, info is empty'))
            if error or not info:
                logger.error('CloudPage.load: %s, %s' % (info, error))
                return
            tasks = info['task_info']
            for task in tasks:
                self.liststore.append([
                    task['task_id'],
                    task['task_name'],
                    task['save_path'],
                    task['source_url'],
                    0,
                    0,
                    int(task['status']),
                    0,
                    '0',
                    gutil.escape(task['save_path'])
                ])
            self.scan_tasks()

            nonlocal start
            start = start + len(tasks)
            if info['total'] > start:
                gutil.async_call(pcs.cloud_list_task, self.app.cookie,
                                 self.app.tokens, start, callback=on_list_task)
Beispiel #53
0
 def on_get_wap_passport(info, error=None):
     if error or not info:
         print('Error occurs in on_get_wap_passport:', info, error)
         self.signin_failed(
                 _('Failed to get WAP page, please try again.'))
     cookie_str, _form = info
     if not cookie_str or not _form:
         print('Error occurs in on_get_wap_passport:', info, error)
         self.signin_failed(
                 _('Failed to get WAP page, please try again.'))
     else:
         nonlocal form
         form = _form
         form['username'] = username
         form['password'] = password
         cookie.load_list(cookie_str)
         if len(form.get('vcodestr', '')):
             dialog = SigninVcodeDialog(self, cookie, form)
             dialog.run()
             dialog.destroy()
             if len(form.get('verifycode', '')) != 4:
                 print('verifycode length is not 4!')
                 return
         self.signin_button.set_label(_('Signin...'))
         gutil.async_call(auth.wap_signin, cookie, form,
                 callback=on_wap_signin)
Beispiel #54
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']))
Beispiel #55
0
 def on_post_login(info, error=None):
     if error or not info:
         logger.error('SigninDialog.on_post_login: %s, %s' %
                      (info, error))
         self.signin_failed(_('Login failed, please try again'))
     else:
         errno, query = info
         if errno == 0:
             cookie.load_list(query)
             self.signin_button.set_label(_('Get bdstoken...'))
             gutil.async_call(auth.get_bdstoken,
                              cookie,
                              callback=on_get_bdstoken)
         # 257: 需要输入验证码
         elif errno == 257:
             nonlocal verifycode
             nonlocal codeString
             vcodetype = query['vcodetype']
             codeString = query['codeString']
             dialog = SigninVcodeDialog(self, username, cookie,
                                        tokens['token'], codeString,
                                        vcodetype)
             response = dialog.run()
             verifycode = dialog.get_vcode()
             codeString = dialog.codeString
             dialog.destroy()
             if not verifycode or len(verifycode) != 4:
                 self.signin_failed(
                     _('Please input verification code!'))
                 return
             else:
                 self.signin_button.set_label(_('Get bdstoken...'))
                 gutil.async_call(auth.post_login,
                                  cookie,
                                  tokens,
                                  username,
                                  password_enc,
                                  rsakey,
                                  verifycode,
                                  codeString,
                                  callback=on_post_login)
         # 密码错误
         elif errno == 4:
             logger.error('SigninDialog.on_post_login: %s, %s' %
                          (info, error))
             self.signin_failed(_('Password error, please try again'))
         # 验证码错误
         elif errno == 6:
             self.signin_failed(
                 _('Verfication code error, please try again'))
         # 需要短信验证
         elif errno == 400031:
             logger.error('SigninDialog.on_post_login: %s, %s' %
                          (info, error))
             self.signin_failed(
                 _('Does not support SMS/Email verification!'))
         else:
             logger.error('SigninDialog.on_post_login: %s, %s' %
                          (info, error))
             self.signin_failed(_('Unknown error, please try again'))
Beispiel #56
0
 def load(self):
     self.loading_spin.start()
     self.loading_spin.show_all()
     self.page_num = 1
     self.liststore.clear()
     gutil.async_call(pcs.list_trash, self.app.cookie, self.app.tokens, '/',
                      self.page_num, callback=self.append_filelist)
Beispiel #57
0
 def open_video_link(red_url, error=None):
     '''得到视频最后地址后, 调用播放器直接播放'''
     if error or not red_url:
         logger.error('IconWindow.launch_app_with_app_info: %s, %s' %
                      (red_url, error))
         return
     gutil.async_call(app_info.launch_uris, [red_url, ], None)