예제 #1
0
 def __call__(self):
     import main
     if not main.allowed_by_blacklist(self.url):
         return
     try:
         self.downloader.run()
     except Downloader.DownloadTemporaryError as exc:
         print("%s: %s %s" % (self, type(exc).__name__, exc))
         # Retry later.
         # However, also queue some random action to allow other downloads.
         TaskSystem.queue_work(RandomNextFile())
         TaskSystem.queue_work(self)
     except Downloader.DownloadFatalError as exc:
         print("%s: %s %s" % (self, type(exc).__name__, exc))
예제 #2
0
 def __call__(self):
     import main
     if not main.allowed_by_blacklist(self.url):
         return
     try:
         self.downloader.run()
     except Downloader.DownloadTemporaryError:
         # Retry later.
         # However, also queue some random action to allow other downloads.
         TaskSystem.queue_work(RandomNextFile())
         TaskSystem.queue_work(self)
     except Downloader.DownloadFatalError:
         # Cannot handle. Nothing we can do.
         pass
예제 #3
0
 def __call__(self):
     import main
     if not main.DownloadOnly:
         # This can happen if we saved this action at an earlier run
         # where we had the option enabled.
         # Just ignore it now.
         return
     import TaskSystem
     import Threading
     # Check if there are no more downloads running.
     if len(TaskSystem.currentWorkSet) <= 1:  # should only be ourselves
         # Exit.
         Logging.log("All downloads finished.")
         Threading.do_in_main_thread(IssueSystemExit(), wait=False)
     else:
         # Check again later.
         TaskSystem.queue_work(CheckDownloadsFinished())
예제 #4
0
 def __call__(self):
     walker = get_random_walker(self.base)
     try:
         # Either throws TemporaryException or returns None if empty.
         url = walker.get_next_file()
     except FileSysIntf.TemporaryException as exc:
         # Handle another one later.
         # Will automatically be added.
         Logging.log("%s: TemporaryException:" % self, exc)
         return
     if not url:
         # Can happen if we end up in an empty source or directory.
         Logging.log("%s: no file found" % self)
         Index.index.remove_source(self.base)
         return
     if TaskSystem.reached_suggested_max_queue():
         # Better go exploring a bit more, and handle the current queue first.
         Logging.log("%s: reached suggested max queue, will not queue download" % self)
         return
     TaskSystem.queue_work(Download(url))