From f6286359cfd2ed93fc692aa2efda37310e02c11c Mon Sep 17 00:00:00 2001 From: Fallenbagel <98979876+Fallenbagel@users.noreply.github.com> Date: Wed, 27 Sep 2023 10:02:42 +0500 Subject: [PATCH 1/2] feat: select default seriesType for anime (#3627) * feat: select default seriesType for anime Added flexibility to set default anime series type in service settings. Now you can choose 'standard' for anime if you prefer it, making it easier to use features like searching for season packs on Sonarr. fix #3626 * feat: extracted translations --- server/entity/MediaRequest.ts | 2 +- server/lib/settings.ts | 1 + src/components/Settings/SonarrModal/index.tsx | 24 +++++++++++++++++++ src/i18n/locale/en.json | 1 + 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/server/entity/MediaRequest.ts b/server/entity/MediaRequest.ts index e980860c6c..a96635c01e 100644 --- a/server/entity/MediaRequest.ts +++ b/server/entity/MediaRequest.ts @@ -984,7 +984,7 @@ export class MediaRequest { (keyword) => keyword.id === ANIME_KEYWORD_ID ) ) { - seriesType = 'anime'; + seriesType = sonarrSettings.seriesType; } let rootFolder = diff --git a/server/lib/settings.ts b/server/lib/settings.ts index 36dbb10972..8bbec7b49a 100644 --- a/server/lib/settings.ts +++ b/server/lib/settings.ts @@ -69,6 +69,7 @@ export interface RadarrSettings extends DVRSettings { } export interface SonarrSettings extends DVRSettings { + seriesType: 'standard' | 'daily' | 'anime'; activeAnimeProfileId?: number; activeAnimeProfileName?: string; activeAnimeDirectory?: string; diff --git a/src/components/Settings/SonarrModal/index.tsx b/src/components/Settings/SonarrModal/index.tsx index 6c61d5dbfe..467b4a3ad0 100644 --- a/src/components/Settings/SonarrModal/index.tsx +++ b/src/components/Settings/SonarrModal/index.tsx @@ -43,6 +43,7 @@ const messages = defineMessages({ qualityprofile: 'Quality Profile', languageprofile: 'Language Profile', rootfolder: 'Root Folder', + seriesType: 'Anime Series Type', animequalityprofile: 'Anime Quality Profile', animelanguageprofile: 'Anime Language Profile', animerootfolder: 'Anime Root Folder', @@ -244,6 +245,7 @@ const SonarrModal = ({ onClose, sonarr, onSave }: SonarrModalProps) => { activeProfileId: sonarr?.activeProfileId, activeLanguageProfileId: sonarr?.activeLanguageProfileId, rootFolder: sonarr?.activeDirectory, + seriesType: sonarr?.seriesType, activeAnimeProfileId: sonarr?.activeAnimeProfileId, activeAnimeLanguageProfileId: sonarr?.activeAnimeLanguageProfileId, activeAnimeRootFolder: sonarr?.activeAnimeDirectory, @@ -280,6 +282,7 @@ const SonarrModal = ({ onClose, sonarr, onSave }: SonarrModalProps) => { : undefined, activeProfileName: profileName, activeDirectory: values.rootFolder, + seriesType: values.seriesType, activeAnimeProfileId: values.activeAnimeProfileId ? Number(values.activeAnimeProfileId) : undefined, @@ -723,6 +726,27 @@ const SonarrModal = ({ onClose, sonarr, onSave }: SonarrModalProps) => { /> +
+ +
+
+ + + + +
+
+ {errors.seriesType && touched.seriesType && ( +
{errors.seriesType}
+ )} +
+
+ +
+
+ + + + +
+
+ {errors.seriesType && touched.seriesType && ( +
{errors.seriesType}
+ )} +
-
diff --git a/src/i18n/locale/en.json b/src/i18n/locale/en.json index a664042eeb..0c4d8ada37 100644 --- a/src/i18n/locale/en.json +++ b/src/i18n/locale/en.json @@ -831,6 +831,7 @@ "components.Settings.SettingsUsers.userSettingsDescription": "Configure global and default user settings.", "components.Settings.SettingsUsers.users": "Users", "components.Settings.SonarrModal.add": "Add Server", + "components.Settings.SonarrModal.animeSeriesType": "Anime Series Type", "components.Settings.SonarrModal.animeTags": "Anime Tags", "components.Settings.SonarrModal.animelanguageprofile": "Anime Language Profile", "components.Settings.SonarrModal.animequalityprofile": "Anime Quality Profile", @@ -860,7 +861,7 @@ "components.Settings.SonarrModal.selectQualityProfile": "Select quality profile", "components.Settings.SonarrModal.selectRootFolder": "Select root folder", "components.Settings.SonarrModal.selecttags": "Select tags", - "components.Settings.SonarrModal.seriesType": "Anime Series Type", + "components.Settings.SonarrModal.seriesType": "Series Type", "components.Settings.SonarrModal.server4k": "4K Server", "components.Settings.SonarrModal.servername": "Server Name", "components.Settings.SonarrModal.ssl": "Use SSL",