mirror of
https://github.com/sct/overseerr.git
synced 2025-09-27 04:22:37 +02:00
feat(frontend): add french language file
also expanded translation coverage (still lots to do!)
This commit is contained in:
@@ -6,18 +6,8 @@ import TheMovieDb, {
|
||||
} from '../api/themoviedb';
|
||||
import { mapMovieResult, mapTvResult, mapPersonResult } from '../models/Search';
|
||||
import Media from '../entity/Media';
|
||||
|
||||
const isMovie = (
|
||||
movie: TmdbMovieResult | TmdbTvResult | TmdbPersonResult
|
||||
): movie is TmdbMovieResult => {
|
||||
return (movie as TmdbMovieResult).title !== undefined;
|
||||
};
|
||||
|
||||
const isPerson = (
|
||||
person: TmdbMovieResult | TmdbTvResult | TmdbPersonResult
|
||||
): person is TmdbPersonResult => {
|
||||
return (person as TmdbPersonResult).known_for !== undefined;
|
||||
};
|
||||
import { isMovie, isPerson } from '../utils/typeHelpers';
|
||||
import { MediaType } from '../constants/media';
|
||||
|
||||
const discoverRoutes = Router();
|
||||
|
||||
@@ -65,7 +55,9 @@ discoverRoutes.get('/movies/upcoming', async (req, res) => {
|
||||
results: data.results.map((result) =>
|
||||
mapMovieResult(
|
||||
result,
|
||||
media.find((req) => req.tmdbId === result.id)
|
||||
media.find(
|
||||
(med) => med.tmdbId === result.id && med.mediaType === MediaType.MOVIE
|
||||
)
|
||||
)
|
||||
),
|
||||
});
|
||||
@@ -90,7 +82,9 @@ discoverRoutes.get('/tv', async (req, res) => {
|
||||
results: data.results.map((result) =>
|
||||
mapTvResult(
|
||||
result,
|
||||
media.find((req) => req.tmdbId === result.id)
|
||||
media.find(
|
||||
(med) => med.tmdbId === result.id && med.mediaType === MediaType.TV
|
||||
)
|
||||
)
|
||||
),
|
||||
});
|
||||
@@ -116,13 +110,16 @@ discoverRoutes.get('/trending', async (req, res) => {
|
||||
isMovie(result)
|
||||
? mapMovieResult(
|
||||
result,
|
||||
media.find((req) => req.tmdbId === result.id)
|
||||
media.find(
|
||||
(req) =>
|
||||
req.tmdbId === result.id && req.mediaType === MediaType.MOVIE
|
||||
)
|
||||
)
|
||||
: isPerson(result)
|
||||
? mapPersonResult(result)
|
||||
: mapTvResult(
|
||||
result,
|
||||
media.find((req) => req.tmdbId === result.id)
|
||||
media.find((req) => req.tmdbId === result.id && MediaType.TV)
|
||||
)
|
||||
),
|
||||
});
|
||||
|
@@ -133,6 +133,17 @@ settingsRoutes.post('/radarr', (req, res) => {
|
||||
const lastItem = settings.radarr[settings.radarr.length - 1];
|
||||
newRadarr.id = lastItem ? lastItem.id + 1 : 0;
|
||||
|
||||
// If we are setting this as the default, clear any previous defaults for the same type first
|
||||
// ex: if is4k is true, it will only remove defaults for other servers that have is4k set to true
|
||||
// and are the default
|
||||
if (req.body.isDefault) {
|
||||
settings.radarr
|
||||
.filter((radarrInstance) => radarrInstance.is4k === req.body.is4k)
|
||||
.forEach((radarrInstance) => {
|
||||
radarrInstance.isDefault = false;
|
||||
});
|
||||
}
|
||||
|
||||
settings.radarr = [...settings.radarr, newRadarr];
|
||||
settings.save();
|
||||
|
||||
@@ -181,6 +192,17 @@ settingsRoutes.put<{ id: string }>('/radarr/:id', (req, res) => {
|
||||
.json({ status: '404', message: 'Settings instance not found' });
|
||||
}
|
||||
|
||||
// If we are setting this as the default, clear any previous defaults for the same type first
|
||||
// ex: if is4k is true, it will only remove defaults for other servers that have is4k set to true
|
||||
// and are the default
|
||||
if (req.body.isDefault) {
|
||||
settings.radarr
|
||||
.filter((radarrInstance) => radarrInstance.is4k === req.body.is4k)
|
||||
.forEach((radarrInstance) => {
|
||||
radarrInstance.isDefault = false;
|
||||
});
|
||||
}
|
||||
|
||||
settings.radarr[radarrIndex] = {
|
||||
...req.body,
|
||||
id: Number(req.params.id),
|
||||
@@ -252,6 +274,17 @@ settingsRoutes.post('/sonarr', (req, res) => {
|
||||
const lastItem = settings.sonarr[settings.sonarr.length - 1];
|
||||
newSonarr.id = lastItem ? lastItem.id + 1 : 0;
|
||||
|
||||
// If we are setting this as the default, clear any previous defaults for the same type first
|
||||
// ex: if is4k is true, it will only remove defaults for other servers that have is4k set to true
|
||||
// and are the default
|
||||
if (req.body.isDefault) {
|
||||
settings.sonarr
|
||||
.filter((sonarrInstance) => sonarrInstance.is4k === req.body.is4k)
|
||||
.forEach((sonarrInstance) => {
|
||||
sonarrInstance.isDefault = false;
|
||||
});
|
||||
}
|
||||
|
||||
settings.sonarr = [...settings.sonarr, newSonarr];
|
||||
settings.save();
|
||||
|
||||
@@ -300,6 +333,17 @@ settingsRoutes.put<{ id: string }>('/sonarr/:id', (req, res) => {
|
||||
.json({ status: '404', message: 'Settings instance not found' });
|
||||
}
|
||||
|
||||
// If we are setting this as the default, clear any previous defaults for the same type first
|
||||
// ex: if is4k is true, it will only remove defaults for other servers that have is4k set to true
|
||||
// and are the default
|
||||
if (req.body.isDefault) {
|
||||
settings.sonarr
|
||||
.filter((sonarrInstance) => sonarrInstance.is4k === req.body.is4k)
|
||||
.forEach((sonarrInstance) => {
|
||||
sonarrInstance.isDefault = false;
|
||||
});
|
||||
}
|
||||
|
||||
settings.sonarr[sonarrIndex] = {
|
||||
...req.body,
|
||||
id: Number(req.params.id),
|
||||
|
Reference in New Issue
Block a user