mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-27 09:31:50 +01:00
default to season 1, with specials still playable
This commit is contained in:
parent
1c17ef679d
commit
f5f69ca7d4
@ -96,24 +96,22 @@ export async function getMetaFromId(
|
|||||||
|
|
||||||
if (type === MWMediaType.SERIES) {
|
if (type === MWMediaType.SERIES) {
|
||||||
const seasons = (details as TMDBShowData).seasons;
|
const seasons = (details as TMDBShowData).seasons;
|
||||||
const season =
|
|
||||||
seasons?.find((v) => v.id.toString() === seasonId) ?? seasons?.[0];
|
|
||||||
|
|
||||||
const episodes = await getEpisodes(
|
let selectedSeason = seasons.find((v) => v.id.toString() === seasonId);
|
||||||
details.id.toString(),
|
if (!selectedSeason) {
|
||||||
season.season_number === null || season.season_number === 0
|
selectedSeason = seasons.find((v) => v.season_number === 1);
|
||||||
? 1
|
}
|
||||||
: season.season_number
|
|
||||||
);
|
if (selectedSeason) {
|
||||||
|
const episodes = await getEpisodes(
|
||||||
|
details.id.toString(),
|
||||||
|
selectedSeason.season_number
|
||||||
|
);
|
||||||
|
|
||||||
if (season && episodes) {
|
|
||||||
seasonData = {
|
seasonData = {
|
||||||
id: season.id.toString(),
|
id: selectedSeason.id.toString(),
|
||||||
season_number:
|
season_number: selectedSeason.season_number,
|
||||||
season.season_number === null || season.season_number === 0
|
title: selectedSeason.name,
|
||||||
? 1
|
|
||||||
: season.season_number,
|
|
||||||
title: season.name,
|
|
||||||
episodes,
|
episodes,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ export interface MediaCardProps {
|
|||||||
linkable?: boolean;
|
linkable?: boolean;
|
||||||
series?: {
|
series?: {
|
||||||
episode: number;
|
episode: number;
|
||||||
season: number;
|
season?: number;
|
||||||
episodeId: string;
|
episodeId: string;
|
||||||
seasonId: string;
|
seasonId: string;
|
||||||
};
|
};
|
||||||
@ -72,7 +72,7 @@ function MediaCardContent({
|
|||||||
].join(" ")}
|
].join(" ")}
|
||||||
>
|
>
|
||||||
{t("seasons.seasonAndEpisode", {
|
{t("seasons.seasonAndEpisode", {
|
||||||
season: series.season,
|
season: series.season || 1,
|
||||||
episode: series.episode,
|
episode: series.episode,
|
||||||
})}
|
})}
|
||||||
</p>
|
</p>
|
||||||
@ -134,10 +134,15 @@ export function MediaCard(props: MediaCardProps) {
|
|||||||
let link = canLink
|
let link = canLink
|
||||||
? `/media/${encodeURIComponent(TMDBMediaToId(props.media))}`
|
? `/media/${encodeURIComponent(TMDBMediaToId(props.media))}`
|
||||||
: "#";
|
: "#";
|
||||||
if (canLink && props.series)
|
if (canLink && props.series) {
|
||||||
link += `/${encodeURIComponent(props.series.seasonId)}/${encodeURIComponent(
|
if (props.series.season === 0 && !props.series.episodeId) {
|
||||||
props.series.episodeId
|
link += `/${encodeURIComponent(props.series.seasonId)}`;
|
||||||
)}`;
|
} else {
|
||||||
|
link += `/${encodeURIComponent(
|
||||||
|
props.series.seasonId
|
||||||
|
)}/${encodeURIComponent(props.series.episodeId)}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!props.linkable) return <span>{content}</span>;
|
if (!props.linkable) return <span>{content}</span>;
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user