Skip to content
This repository was archived by the owner on Nov 15, 2025. It is now read-only.

Commit 8af3065

Browse files
committed
Fix episode index being off causing wrong selection
- Fixed episode index being off by one and causing wrong episode select on some tv shows
1 parent 7329225 commit 8af3065

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

comet/utils/general.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -771,25 +771,25 @@ async def uncached_select_index(
771771
"file_name_extractor": lambda file: file.get("name", ""),
772772
"filter": lambda files: files, # No filtering for DL
773773
"id_getter": lambda file, i: i,
774-
"fallback": lambda idx: int(idx),
774+
"fallback": lambda idx: max(int(idx) - 1, 0),
775775
},
776776
"alldebrid": {
777777
"file_name_extractor": lambda file: file.get("filename", ""),
778778
"filter": lambda files: files,
779779
"id_getter": lambda file, i: i,
780-
"fallback": lambda idx: int(idx),
780+
"fallback": lambda idx: max(int(idx) - 1, 0),
781781
},
782782
"premiumize": {
783783
"file_name_extractor": lambda file: file.get("path", "").split("/")[-1],
784784
"filter": lambda files: files,
785785
"id_getter": lambda file, i: i,
786-
"fallback": lambda idx: int(idx),
786+
"fallback": lambda idx: max(int(idx) - 1, 0),
787787
},
788788
"torbox": {
789-
"file_name_extractor": lambda file: file.get("name", ""),
789+
"file_name_extractor": lambda file: file.get("short_name", ""),
790790
"filter": lambda files: files,
791791
"id_getter": lambda file, i: file.get("id"),
792-
"fallback": lambda idx: int(idx),
792+
"fallback": lambda idx: max(int(idx) - 1, 0),
793793
},
794794
}
795795

@@ -1054,7 +1054,7 @@ async def add_uncached_files(
10541054
# Later on in debrid handle_uncached the real index is determiend based on title and file_name to return the correct download link
10551055
# The index used in the url only is a placeholder to make it unique to make sure the download link / uncached torrents cache can work
10561056
# Real index can only be determined later when the debrid files are known for that uncached torrent
1057-
file_index = episode - 1 if episode else 0
1057+
file_index = episode if episode else 0
10581058
stremio_data = {
10591059
"index": file_index,
10601060
"title": torrent["Title"],

todo.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@
201201
- Set CACHE_WIPE = 0 to disable background cache clean up
202202

203203
### Still need to do:
204+
- Binge sometimes still not working uncached torbox
204205
- Maybe Add torbox usenet availability check (Not really needed and will add overhead but for better user experince)
205206
- Maybe add Easynews+ as provider as well.
206207
- Check jackett/prowlarr missing infohashes sometimes, probably rate limits?

0 commit comments

Comments
 (0)