|
|
@ -750,18 +750,14 @@ class NzbQueue(TryList): |
|
|
|
""" Check whether there are any pending articles for the downloader """ |
|
|
|
if not self.__nzo_list: |
|
|
|
return False |
|
|
|
if self.__top_only: |
|
|
|
for nzo in self.__nzo_list: |
|
|
|
# Ignore any items that are in a paused or grabbing state |
|
|
|
if nzo.status not in (Status.PAUSED, Status.GRABBING): |
|
|
|
return not nzo.server_in_try_list(server) |
|
|
|
else: |
|
|
|
# Check if this server is allowed for any object, then return if we've tried this server. |
|
|
|
for nzo in self.__nzo_list: |
|
|
|
if nzo.status not in (Status.PAUSED, Status.GRABBING): |
|
|
|
if nzo.server_allowed(server): |
|
|
|
# Check if this server is allowed for any object, then return if we've tried this server. |
|
|
|
for nzo in self.__nzo_list: |
|
|
|
if nzo.status not in (Status.PAUSED, Status.GRABBING): |
|
|
|
# Check if past propagation delay |
|
|
|
if not cfg.propagation_delay() or (nzo.avg_stamp + float(cfg.propagation_delay() * 60)) < time.time(): |
|
|
|
if nzo.server_allowed(server) or self.__top_only: |
|
|
|
return not self.server_in_try_list(server) |
|
|
|
return False |
|
|
|
return False |
|
|
|
|
|
|
|
@synchronized(NZBQUEUE_LOCK) |
|
|
|
def has_forced_items(self): |
|
|
@ -775,27 +771,19 @@ class NzbQueue(TryList): |
|
|
|
|
|
|
|
@synchronized(NZBQUEUE_LOCK) |
|
|
|
def get_article(self, server, servers): |
|
|
|
if self.__top_only: |
|
|
|
if self.__nzo_list: |
|
|
|
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: |
|
|
|
if nzo.server_allowed(server): |
|
|
|
article = nzo.get_article(server, servers) |
|
|
|
if article: |
|
|
|
return article |
|
|
|
|
|
|
|
else: |
|
|
|
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: |
|
|
|
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 |
|
|
|
if not cfg.propagation_delay() 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 |
|
|
|
if not nzo.server_in_try_list(server) and nzo.server_allowed(server): |
|
|
|
if (not nzo.server_in_try_list(server) or self.__top_only) and nzo.server_allowed(server): |
|
|
|
article = nzo.get_article(server, servers) |
|
|
|
if article: |
|
|
|
return article |
|
|
|
|
|
|
|
# No articles for this server, block server (until reset issued) |
|
|
|
# No articles for this server, block server (until reset issued) |
|
|
|
if not self.__top_only: |
|
|
|
self.add_to_try_list(server) |
|
|
|
|
|
|
|
@synchronized(NZBQUEUE_LOCK) |
|
|
|