mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-13 04:45:08 -05:00
Merge pull request #816 from KontiSR/fix_newznab_offset
Fix offset calculation. No more unnecessary (double) searches.
This commit is contained in:
commit
f54412fc3d
@ -315,17 +315,27 @@ class NewznabProvider(generic.NZBProvider):
|
|||||||
if total == 0:
|
if total == 0:
|
||||||
total = int(data.feed.newznab_response['total'] or 0)
|
total = int(data.feed.newznab_response['total'] or 0)
|
||||||
offset = int(data.feed.newznab_response['offset'] or 0)
|
offset = int(data.feed.newznab_response['offset'] or 0)
|
||||||
|
|
||||||
|
# No items found, prevent from doing another search
|
||||||
|
if total == 0:
|
||||||
|
break
|
||||||
|
|
||||||
if offset != params['offset']:
|
if offset != params['offset']:
|
||||||
logger.log("Tell your newznab provider to fix their bloody newznab responses")
|
logger.log("Tell your newznab provider to fix their bloody newznab responses")
|
||||||
break
|
break
|
||||||
|
|
||||||
# if there are more items available then the amount given in one call, grab some more
|
|
||||||
params['offset'] += params['limit']
|
params['offset'] += params['limit']
|
||||||
|
if (total > int(params['offset'])):
|
||||||
logger.log(str(
|
offset = int(params['offset'])
|
||||||
total - offset) + " more items to be fetched from provider. Fetching another " + str(
|
# if there are more items available then the amount given in one call, grab some more
|
||||||
params['limit']) + " items.", logger.DEBUG)
|
logger.log(str(
|
||||||
|
total - int(params['offset'])) + " more items to be fetched from provider. Fetching another " + str(
|
||||||
|
params['limit']) + " items.", logger.DEBUG)
|
||||||
|
else:
|
||||||
|
logger.log(str(
|
||||||
|
total - int(params['offset'])) + " No more searches needed, could find anything I was looking for! " + str(
|
||||||
|
params['limit']) + " items.", logger.DEBUG)
|
||||||
|
break
|
||||||
|
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user