def update_downloader_status(self, item, path, current_size, total_size): status = { 'dlid': item.downloader.dlid, 'url': item.url, 'current_size': current_size, 'total_size': total_size, 'upload_size': 0, 'start_time': 1000, 'short_filename': os.path.basename(path), 'reason_failed': None, 'short_reason_failed': None, 'type': None, 'retry_time': None, 'retry_count': None, } if current_size < total_size: status.update({ 'state': u'downloading', 'end_time': None, 'eta': 10, 'rate': 1, 'filename': os.path.join(self.tempdir, 'Incomplete downloads', os.path.basename(path)), }) else: status.update({ 'state': u'finished', 'end_time': status['start_time'] + 50, 'eta': None, 'rate': None, 'filename': path, }) RemoteDownloader.update_status(status, cmd_done=True)
def action(self): from miro.downloader import RemoteDownloader from miro.messages import DownloaderSyncCommandComplete cmd_done = self.args[1] fresh = all(RemoteDownloader.update_status(status, cmd_done=cmd_done) for status in self.args[0]) if cmd_done and fresh: DownloaderSyncCommandComplete().send_to_frontend()
def action(self): from miro.downloader import RemoteDownloader from miro.messages import DownloaderSyncCommandComplete cmd_done = self.args[1] fresh = all( RemoteDownloader.update_status(status, cmd_done=cmd_done) for status in self.args[0]) if cmd_done and fresh: DownloaderSyncCommandComplete().send_to_frontend()
def action(self): from miro.downloader import RemoteDownloader for status in self.args[0]: RemoteDownloader.update_status(status)
def action(self): from miro.downloader import RemoteDownloader return RemoteDownloader.update_status(*self.args, **self.kws)