From 5eb4365a595b395b37654982aefeedc2bae8e4b0 Mon Sep 17 00:00:00 2001 From: Tagaishi Date: Fri, 3 Nov 2023 21:07:37 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Auto=20handle=20sonarr=20and=20rada?= =?UTF-8?q?rr=20API=20differences=20(#1548)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/locales/en/modules/calendar.json | 6 ------ src/modules/common/MediaDisplay.tsx | 11 ++++++----- src/server/api/routers/calendar.ts | 3 +-- src/widgets/calendar/CalendarTile.tsx | 9 --------- 4 files changed, 7 insertions(+), 22 deletions(-) diff --git a/public/locales/en/modules/calendar.json b/public/locales/en/modules/calendar.json index 239dc8054..f35be3c0f 100644 --- a/public/locales/en/modules/calendar.json +++ b/public/locales/en/modules/calendar.json @@ -4,12 +4,6 @@ "description": "Displays a calendar with upcoming releases, from supported integrations.", "settings": { "title": "Settings for Calendar widget", - "useSonarrv4": { - "label": "Use Sonarr v4 API" - }, - "useRadarrv5": { - "label": "Use Radarr v5 API" - }, "radarrReleaseType": { "label": "Radarr release type", "data":{ diff --git a/src/modules/common/MediaDisplay.tsx b/src/modules/common/MediaDisplay.tsx index a7b7ae1f0..860fc0c99 100644 --- a/src/modules/common/MediaDisplay.tsx +++ b/src/modules/common/MediaDisplay.tsx @@ -18,6 +18,7 @@ export interface IMedia { episodetitle?: string; voteAverage?: string; poster?: string; + altPoster?: string; genres: string[]; seasonNumber?: number; plexUrl?: string; @@ -136,7 +137,6 @@ export function RadarrMediaDisplay(props: any) { const { media }: { media: any } = props; const { config } = useConfigContext(); const calendar = config?.widgets.find((w) => w.type === 'calendar'); - const useRadarrv5 = calendar?.properties.useRadarrv5 ?? false; // Find a poster CoverType const poster = media.images.find((image: any) => image.coverType === 'poster'); @@ -147,7 +147,8 @@ export function RadarrMediaDisplay(props: any) { title: media.title ?? media.originalTitle, overview: media.overview ?? '', genres: media.genres ?? [], - poster: useRadarrv5 ? poster.remoteUrl : poster.url, + poster: poster.url, + altPoster: poster.remoteUrl, voteAverage: media.ratings.tmdb.value.toString(), imdbId: media.imdbId, type: 'movie', @@ -160,7 +161,6 @@ export function SonarrMediaDisplay(props: any) { const { media }: { media: any } = props; const { config } = useConfigContext(); const calendar = config?.widgets.find((w) => w.type === 'calendar'); - const useSonarrv4 = calendar?.properties.useSonarrv4 ?? false; // Find a poster CoverType const poster = media.series.images.find((image: any) => image.coverType === 'poster'); @@ -172,7 +172,8 @@ export function SonarrMediaDisplay(props: any) { genres: media.series.genres ?? [], overview: media.overview ?? media.series.overview ?? '', title: media.series.title, - poster: useSonarrv4 ? poster.remoteUrl : poster.url, + poster: poster.url, + altPoster: poster.remoteUrl, episodeNumber: media.episodeNumber, seasonNumber: media.seasonNumber, episodetitle: media.title, @@ -191,7 +192,7 @@ export function MediaDisplay({ media }: { media: IMedia }) { return ( - + diff --git a/src/server/api/routers/calendar.ts b/src/server/api/routers/calendar.ts index 5c43262ee..362a2320f 100644 --- a/src/server/api/routers/calendar.ts +++ b/src/server/api/routers/calendar.ts @@ -15,7 +15,6 @@ export const calendarRouter = createTRPCRouter({ month: z.number().min(1).max(12), year: z.number().min(1900).max(2300), options: z.object({ - useSonarrv4: z.boolean().optional().default(false), showUnmonitored: z.boolean().optional().default(false), }), }) @@ -35,7 +34,7 @@ export const calendarRouter = createTRPCRouter({ ); const integrationTypeEndpointMap = new Map([ - ['sonarr', input.options.useSonarrv4 ? '/api/v3/calendar' : '/api/calendar'], + ['sonarr', '/api/v3/calendar'], ['radarr', '/api/v3/calendar'], ['lidarr', '/api/v1/calendar'], ['readarr', '/api/v1/calendar'], diff --git a/src/widgets/calendar/CalendarTile.tsx b/src/widgets/calendar/CalendarTile.tsx index fe4c087f9..8fd45b77c 100644 --- a/src/widgets/calendar/CalendarTile.tsx +++ b/src/widgets/calendar/CalendarTile.tsx @@ -26,14 +26,6 @@ const definition = defineWidget({ type: 'switch', defaultValue: false, }, - useSonarrv4: { - type: 'switch', - defaultValue: false, - }, - useRadarrv5: { - type: 'switch', - defaultValue: false, - }, radarrReleaseType: { type: 'select', defaultValue: 'inCinemas', @@ -78,7 +70,6 @@ function CalendarTile({ widget }: CalendarTileProps) { month: month.getMonth() + 1, year: month.getFullYear(), options: { - useSonarrv4: widget.properties.useSonarrv4, showUnmonitored: widget.properties.showUnmonitored, }, },