fix: make convertSeasonRangeToIntegerRange function support both shows and IndexerQueryResults

This commit is contained in:
maxDorninger
2025-05-24 21:05:51 +02:00
parent 0ea500bacd
commit 64eace0c74

View File

@@ -41,11 +41,13 @@ export function getFullyQualifiedShowName(show: { name: string; year: number }):
}
export function convertTorrentSeasonRangeToIntegerRange(torrent: any): string {
if (torrent.season?.length === 1) return torrent.season[0]?.toString();
if (torrent.season?.length >= 2) return torrent.season[0]?.toString() + "-" + torrent.season.at(-1).toString();
if (torrent?.season?.length === 1) return torrent.season[0]?.toString();
if (torrent?.season?.length >= 2) return torrent.season[0]?.toString() + "-" + torrent.season.at(-1).toString();
if (torrent?.seasons?.length === 1) return torrent.seasons[0]?.toString();
if (torrent?.seasons?.length >= 2) return torrent.seasons[0]?.toString() + "-" + torrent.seasons.at(-1).toString();
else {
console.log("Error parsing season range: " + torrent.seasons);
return "Error parsing season range: " + torrent.seasons;
console.log("Error parsing season range: " + torrent?.seasons + torrent?.season);
return "Error parsing season range: " + torrent?.seasons + torrent?.season;
}
}