def get_article(self, server, servers): for nzo in self.__nzo_list: # Not when queue paused and not a forced item if nzo.status not in (Status.PAUSED, Status.GRABBING ) or nzo.priority == TOP_PRIORITY: # Check if past propagation delay, or forced if not cfg.propagation_delay( ) or nzo.priority == TOP_PRIORITY or (nzo.avg_stamp + float( cfg.propagation_delay() * 60)) < time.time(): if not nzo.server_in_try_list(server): article = nzo.get_article(server, servers) if article: return article # Stop after first job that wasn't paused/propagating/etc if self.__top_only: return
def has_articles_for(self, server): """ Check whether there are any pending articles for the downloader """ if not self.__nzo_list: return False # Check if this server is allowed for any object, then return if we've tried this server. for nzo in self.__nzo_list: # Not when queue paused and not a forced item if (nzo.status not in (Status.PAUSED, Status.GRABBING) and not sabnzbd.downloader.Downloader.do.paused ) or nzo.priority == TOP_PRIORITY: # Check if past propagation delay, or forced if not cfg.propagation_delay( ) or nzo.priority == TOP_PRIORITY or (nzo.avg_stamp + float( cfg.propagation_delay() * 60)) < time.time(): # Check if category allowed if nzo.server_allowed(server) or self.__top_only: return not self.server_in_try_list(server) return False
def get_article(self, server, servers): for nzo in self.__nzo_list: # Not when queue paused and not a forced item if (nzo.status not in (Status.PAUSED, Status.GRABBING) and not sabnzbd.downloader.Downloader.do.paused ) or nzo.priority == TOP_PRIORITY: # Check if past propagation delay, or forced if not cfg.propagation_delay( ) or nzo.priority == TOP_PRIORITY or (nzo.avg_stamp + float( cfg.propagation_delay() * 60)) < time.time(): # Don't try to get an article if server is in try_list of nzo and category allowed by server if nzo.server_allowed(server): if not nzo.server_in_try_list(server): article = nzo.get_article(server, servers) if article: return article # Stop after first job that wasn't paused/propagating/etc if self.__top_only: return
def get_article(self, server, servers): for nzo in self.__nzo_list: # Not when queue paused and not a forced item if (nzo.status not in (Status.PAUSED, Status.GRABBING) and not sabnzbd.downloader.Downloader.do.paused ) or nzo.priority == TOP_PRIORITY: # Check if past propagation delay, or forced if not cfg.propagation_delay( ) or nzo.priority == TOP_PRIORITY or (nzo.avg_stamp + float( cfg.propagation_delay() * 60)) < time.time(): # Don't try to get an article if server is in try_list of nzo and category allowed by server if nzo.server_allowed(server) and ( not nzo.server_in_try_list(server) or self.__top_only): article = nzo.get_article(server, servers) if article: return article # No articles for this server, block server (until reset issued) if not self.__top_only: self.add_to_try_list(server)
def has_articles_for(self, server): """ Check whether there are any pending articles for the downloader """ if not self.__nzo_list: return False # Check if this server is allowed for any object, then return if we've tried this server. for nzo in self.__nzo_list: # Not when queue paused and not a forced item if (nzo.status not in (Status.PAUSED, Status.GRABBING) and not sabnzbd.downloader.Downloader.do.paused) or nzo.priority == TOP_PRIORITY: # Check if past propagation delay, or forced if not cfg.propagation_delay() or nzo.priority == TOP_PRIORITY or (nzo.avg_stamp + float(cfg.propagation_delay() * 60)) < time.time(): # Check if category allowed if nzo.server_allowed(server) or self.__top_only: return not self.server_in_try_list(server) return False
def get_article(self, server, servers): for nzo in self.__nzo_list: # Not when queue paused and not a forced item if (nzo.status not in (Status.PAUSED, Status.GRABBING) and not sabnzbd.downloader.Downloader.do.paused) or nzo.priority == TOP_PRIORITY: # Check if past propagation delay, or forced if not cfg.propagation_delay() or nzo.priority == TOP_PRIORITY or (nzo.avg_stamp + float(cfg.propagation_delay() * 60)) < time.time(): # Don't try to get an article if server is in try_list of nzo and category allowed by server if nzo.server_allowed(server) and (not nzo.server_in_try_list(server) or self.__top_only): article = nzo.get_article(server, servers) if article: return article # No articles for this server, block server (until reset issued) if not self.__top_only: self.add_to_try_list(server)
def get_article(self, server, servers): for nzo in self.__nzo_list: # Not when queue paused and not a forced item if (nzo.status not in (Status.PAUSED, Status.GRABBING) and not sabnzbd.downloader.Downloader.do.paused) or nzo.priority == TOP_PRIORITY: # Check if past propagation delay, or forced if not cfg.propagation_delay() or nzo.priority == TOP_PRIORITY or (nzo.avg_stamp + float(cfg.propagation_delay() * 60)) < time.time(): # Don't try to get an article if server is in try_list of nzo and category allowed by server if nzo.server_allowed(server): if not nzo.server_in_try_list(server): article = nzo.get_article(server, servers) if article: return article # Stop after first job that wasn't paused/propagating/etc if self.__top_only: return
def get_article(self, server, servers): """ Get next article for jobs in the queue Not locked for performance, since it only reads the queue """ for nzo in self.__nzo_list: # Not when queue paused and not a forced item if nzo.status not in (Status.PAUSED, Status.GRABBING) or nzo.priority == TOP_PRIORITY: # Check if past propagation delay, or forced if not cfg.propagation_delay() or nzo.priority == TOP_PRIORITY or (nzo.avg_stamp + float(cfg.propagation_delay() * 60)) < time.time(): if not nzo.server_in_try_list(server): article = nzo.get_article(server, servers) if article: return article # Stop after first job that wasn't paused/propagating/etc if self.__top_only: return
def get_article(self, server, servers): """ Get next article for jobs in the queue Not locked for performance, since it only reads the queue """ # Pre-calculate propagation delay propagation_delay = float(cfg.propagation_delay() * 60) for nzo in self.__nzo_list: # Not when queue paused and not a forced item if nzo.status not in (Status.PAUSED, Status.GRABBING ) or nzo.priority == TOP_PRIORITY: # Check if past propagation delay, or forced if (not propagation_delay or nzo.priority == TOP_PRIORITY or (nzo.avg_stamp + propagation_delay) < time.time()): if not nzo.server_in_try_list(server): article = nzo.get_article(server, servers) if article: return article # Stop after first job that wasn't paused/propagating/etc if self.__top_only: return