feat(torrents): pass tmdb_id and season to m3u stream for series

Add seasonFromEpisodes (single season only, skips ranges) and include
tmdb_id plus the resolved season in the m3u/cast stream params.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
nerandClaude Opus 4.8 committed 2026-08-07 19:14:59 +03:00
1 parent 735c63471a
commit 284458f783
2 files changed
+14 -1

No files matched your search

+7
View File
@@ -55,6 +55,13 @@ export const getMagnetHash = (link: string) => {
export const torrentKey = (torrent: Torrent) =>
torrent.download || getMagnetHash(torrent.magnet) || torrent.hash || torrent.id;
export const seasonFromEpisodes = (episodes?: string): number | undefined => {
if (!episodes) return undefined;
if (/^S\d+\s*[-–—]\s*\d+/i.test(episodes)) return undefined;
const [, season] = episodes.match(/^S(\d+)/i) || [];
return season ? Number(season) : undefined;
};
export const formatBytes = (bytes?: number) => {
if (bytes == null || !isFinite(bytes)) return '';