fix(tmdb): fallback movie/show overview to English when none is available in requested locale (#928)

This PR adds a second call to TMDB to retried the overview in English if no overview is available in
the requested locale

fix #925
This commit is contained in:
Gauthier
2024-08-13 10:41:59 +02:00
committed by GitHub
parent 61dcd8e487
commit 12f908de7f
2 changed files with 18 additions and 4 deletions

View File

@@ -33,9 +33,15 @@ movieRoutes.get('/:id', async (req, res, next) => {
},
});
return res
.status(200)
.json(mapMovieDetails(tmdbMovie, media, onUserWatchlist));
const data = mapMovieDetails(tmdbMovie, media, onUserWatchlist);
// TMDB issue where it doesnt fallback to English when no overview is available in requested locale.
if (!data.overview) {
const tvEnglish = await tmdb.getMovie({ movieId: Number(req.params.id) });
data.overview = tvEnglish.overview;
}
return res.status(200).json(data);
} catch (e) {
logger.debug('Something went wrong retrieving movie', {
label: 'API',

View File

@@ -30,7 +30,15 @@ tvRoutes.get('/:id', async (req, res, next) => {
},
});
return res.status(200).json(mapTvDetails(tv, media, onUserWatchlist));
const data = mapTvDetails(tv, media, onUserWatchlist);
// TMDB issue where it doesnt fallback to English when no overview is available in requested locale.
if (!data.overview) {
const tvEnglish = await tmdb.getTvShow({ tvId: Number(req.params.id) });
data.overview = tvEnglish.overview;
}
return res.status(200).json(data);
} catch (e) {
logger.debug('Something went wrong retrieving series', {
label: 'API',