mirror of
https://github.com/p-stream/providers.git
synced 2026-03-11 17:55:36 +00:00
throw if media has not been released yet
This commit is contained in:
parent
7804b3bf91
commit
5af235ff74
1 changed files with 9 additions and 1 deletions
|
|
@ -76,6 +76,10 @@ async function getMovieMediaDetails(id: string): Promise<MovieMedia> {
|
|||
throw new Error(movie.status_message);
|
||||
}
|
||||
|
||||
if (!movie.release_date) {
|
||||
throw new Error(`${movie.title} has no release_date. Assuming unreleased`);
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'movie',
|
||||
title: movie.title,
|
||||
|
|
@ -99,6 +103,10 @@ async function getShowMediaDetails(id: string, seasonNumber: string, episodeNumb
|
|||
throw new Error(series.status_message);
|
||||
}
|
||||
|
||||
if (!series.first_air_date) {
|
||||
throw new Error(`${series.name} has no first_air_date. Assuming unaired`);
|
||||
}
|
||||
|
||||
response = await fetch(`https://api.themoviedb.org/3/tv/${id}/season/${seasonNumber}?api_key=${TMDB_API_KEY}`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
|
|
@ -126,7 +134,7 @@ async function getShowMediaDetails(id: string, seasonNumber: string, episodeNumb
|
|||
return {
|
||||
type: 'show',
|
||||
title: series.name,
|
||||
releaseYear: Number(series.first_air_date.split('-')[0]), // * Is this really what should go here?
|
||||
releaseYear: Number(series.first_air_date.split('-')[0]),
|
||||
tmdbId: id,
|
||||
episode: {
|
||||
number: episode.episode_number,
|
||||
|
|
|
|||
Loading…
Reference in a new issue