feat(api): plex tv sync and recently added sync

This commit is contained in:
sct
2020-11-11 09:02:28 +00:00
parent 16221a46a7
commit 1390cc1f13
19 changed files with 554 additions and 76 deletions

View File

@@ -649,6 +649,38 @@ class TheMovieDb {
);
}
}
public async getShowByTvdbId({
tvdbId,
language = 'en-US',
}: {
tvdbId: number;
language?: string;
}): Promise<TmdbTvDetails> {
try {
const extResponse = await this.getByExternalId({
externalId: tvdbId,
type: 'tvdb',
});
if (extResponse.tv_results[0]) {
const tvshow = await this.getTvShow({
tvId: extResponse.tv_results[0].id,
language,
});
return tvshow;
}
throw new Error(
`[TMDB] Failed to find a tv show with the provided TVDB id: ${tvdbId}`
);
} catch (e) {
throw new Error(
`[TMDB] Failed to get tv show by external tvdb ID: ${e.message}`
);
}
}
}
export default TheMovieDb;