fix: divising by 0

This commit is contained in:
Goldy
2024-07-13 21:10:01 +02:00
parent e54d64fc2b
commit dcef22a46d
+5 -3
View File
@@ -202,6 +202,8 @@ def get_debrid_extension(debridService: str):
debrid_extension = "TB"
elif debridService == "debridlink":
debrid_extension = "DL"
elif debridService == "offcloud":
debrid_extension = "OC"
return debrid_extension
@@ -387,10 +389,10 @@ async def get_balanced_hashes(hashes: dict, config: dict):
hashes_by_resolution[resolution_key] = []
hashes_by_resolution[resolution_key].append(hash)
if max_results == 0:
return hashes_by_resolution
total_resolutions = len(hashes_by_resolution)
if max_results == 0 or total_resolutions == 0:
return hashes_by_resolution
hashes_per_resolution = max_results // total_resolutions
extra_hashes = max_results % total_resolutions