Skip to content

Commit acc8112

Browse files
committed
feat: ios video players support (ex: infuse)
1 parent 8db7933 commit acc8112

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

comet/api/stream.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,12 @@ async def stream(
263263
else ("⚡" if torrent["cached"] else "⬇️")
264264
)
265265

266+
torrent_title = torrent["title"]
266267
the_stream = {
267268
"name": f"[{debrid_extension}{debrid_emoji}] Comet {rtn_data.resolution}",
268269
"description": format_title(
269270
rtn_data,
270-
torrent["title"],
271+
torrent_title,
271272
torrent["seeders"],
272273
torrent["size"],
273274
torrent["tracker"],
@@ -292,7 +293,7 @@ async def stream(
292293
the_stream["sources"] = torrent["sources"]
293294
else:
294295
the_stream["url"] = (
295-
f"{request.url.scheme}://{request.url.netloc}/{b64config}/playback/{info_hash}/{torrent['fileIndex'] if torrent['cached'] and torrent['fileIndex'] is not None else 'n'}/{title}/{result_season}/{result_episode}"
296+
f"{request.url.scheme}://{request.url.netloc}/{b64config}/playback/{info_hash}/{torrent['fileIndex'] if torrent['cached'] and torrent['fileIndex'] is not None else 'n'}/{title}/{result_season}/{result_episode}/{torrent_title}"
296297
)
297298

298299
if torrent["cached"]:
@@ -303,7 +304,7 @@ async def stream(
303304
return {"streams": cached_results + non_cached_results}
304305

305306

306-
@streams.get("/{b64config}/playback/{hash}/{index}/{name}/{season}/{episode}")
307+
@streams.get("/{b64config}/playback/{hash}/{index}/{name}/{season}/{episode}/{torrent_name}")
307308
async def playback(
308309
request: Request,
309310
b64config: str,
@@ -312,10 +313,9 @@ async def playback(
312313
name: str,
313314
season: str,
314315
episode: str,
316+
torrent_name: str
315317
):
316318
config = config_check(b64config)
317-
# if not config:
318-
# return FileResponse("comet/assets/invalidconfig.mp4")
319319

320320
season = int(season) if season != "n" else None
321321
episode = int(episode) if episode != "n" else None
@@ -361,7 +361,7 @@ async def playback(
361361
ip if not should_proxy else "",
362362
)
363363
download_url = await debrid.generate_download_link(
364-
hash, index, name, season, episode
364+
hash, index, name, torrent_name, season, episode
365365
)
366366
if not download_url:
367367
return FileResponse("comet/assets/uncached.mp4")

comet/debrid/stremthru.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ async def get_availability(
169169
return files
170170

171171
async def generate_download_link(
172-
self, hash: str, index: str, name: str, season: int, episode: int
172+
self, hash: str, index: str, name: str, torrent_name: str, season: int, episode: int
173173
):
174174
try:
175175
magnet = await self.session.post(
@@ -219,7 +219,7 @@ async def generate_download_link(
219219
}
220220
files.append(file_info)
221221

222-
if str(file["index"]) == index:
222+
if filename == torrent_name or str(file["index"]) == index:
223223
target_file = file
224224

225225
if season == file_season and episode == file_episode:

comet/utils/models.py

-5
Original file line numberDiff line numberDiff line change
@@ -581,12 +581,7 @@ def check_debrid_service(cls, v):
581581
default_config["rtnRanking"] = rtn_ranking_default
582582

583583

584-
# Web Config Initialization
585-
# languages = [language for language in PTT.parse.LANGUAGES_TRANSLATION_TABLE.values()]
586-
# languages.insert(0, "Unknown")
587-
# languages.insert(1, "Multi")
588584
web_config = {
589-
# "languages": languages,
590585
"resolutions": [resolution.value for resolution in RTN.models.Resolution],
591586
"resultFormat": ["title", "metadata", "seeders", "size", "tracker", "languages"],
592587
}

0 commit comments

Comments
 (0)