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:
@@ -33,9 +33,15 @@ movieRoutes.get('/:id', async (req, res, next) => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return res
|
const data = mapMovieDetails(tmdbMovie, media, onUserWatchlist);
|
||||||
.status(200)
|
|
||||||
.json(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) {
|
} catch (e) {
|
||||||
logger.debug('Something went wrong retrieving movie', {
|
logger.debug('Something went wrong retrieving movie', {
|
||||||
label: 'API',
|
label: 'API',
|
||||||
|
|||||||
@@ -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) {
|
} catch (e) {
|
||||||
logger.debug('Something went wrong retrieving series', {
|
logger.debug('Something went wrong retrieving series', {
|
||||||
label: 'API',
|
label: 'API',
|
||||||
|
|||||||
Reference in New Issue
Block a user