Skip to content

Commit

Permalink
Merge pull request #8 from sirstudly/fix_torbox_check_cache
Browse files Browse the repository at this point in the history
Fixes Torbox cache check with 200+ hashes
  • Loading branch information
funkypenguin authored Oct 14, 2024
2 parents 8c46cf6 + 90278bd commit cfddfdd
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions debrid/services/torbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,15 @@ def check(element, force=False):
else:
ui_print("[torbox] error (missing torrent hash): ignoring release '" + release.title + "'")
element.Releases.remove(release)
if len(hashes) > 0:
response = get('https://api.torbox.app/v1/api/torrents/checkcached?format=list&list_files=true&hash=' + ','.join(hashes))
ui_print("[torbox] checking and sorting all release files ...", ui_settings.debug)

# we have a hard-limit of 190ish hashes before we get an error for using an overlong URI so split them up if so
offset = 0
hash_limit = 190
ui_print("[torbox] checking and sorting all release files ...", ui_settings.debug)
hashes = list(hashes) # so we can splice it
while offset < len(hashes):
response = get('https://api.torbox.app/v1/api/torrents/checkcached?format=list&list_files=true&hash=' + ','.join(hashes[offset:offset + hash_limit]))
offset += hash_limit
for release in element.Releases:
release.files = []
release_hash = release.hash.lower()
Expand Down

0 comments on commit cfddfdd

Please sign in to comment.