def load(self):
        '''获取当前的离线任务列表'''
        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)

        self.loading_spin.start()
        self.loading_spin.show_all()
        start = 0
        gutil.async_call(pcs.cloud_list_task, self.app.cookie, self.app.tokens,
                         start, callback=on_list_task)
def load ( self ) : 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 ) self . loading_spin . start ( ) self . loading_spin . show_all ( ) start = 0 gutil . async_call ( pcs . cloud_list_task , self . app . cookie , self . app . tokens , start , callback = on_list_task )
获取当前的离线任务列表