Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
    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()
Ejemplo n.º 3
0
    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()
Ejemplo n.º 4
0
 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)
Ejemplo n.º 5
0
 def action(self):
     from miro.downloader import RemoteDownloader
     for status in self.args[0]:
         RemoteDownloader.update_status(status)
Ejemplo n.º 6
0
 def action(self):
     from miro.downloader import RemoteDownloader
     return RemoteDownloader.update_status(*self.args, **self.kws)
Ejemplo n.º 7
0
 def action(self):
     from miro.downloader import RemoteDownloader
     for status in self.args[0]:
         RemoteDownloader.update_status(status)
Ejemplo n.º 8
0
 def action(self):
     from miro.downloader import RemoteDownloader
     return RemoteDownloader.update_status(*self.args, **self.kws)