Merge pull request #1469 from Tagaishi/radarr-v5-poster-support

 Adds support for poster on Radarr v5's api
This commit is contained in:
Thomas Camlong
2023-10-25 12:53:06 +02:00
committed by GitHub
3 changed files with 13 additions and 1 deletions

View File

@@ -7,6 +7,9 @@
"useSonarrv4": {
"label": "Use Sonarr v4 API"
},
"useRadarrv5": {
"label": "Use Radarr v5 API"
},
"radarrReleaseType": {
"label": "Radarr release type",
"data":{

View File

@@ -134,7 +134,12 @@ export function LidarrMediaDisplay(props: any) {
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');
return (
<MediaDisplay
media={{
@@ -142,7 +147,7 @@ export function RadarrMediaDisplay(props: any) {
title: media.title ?? media.originalTitle,
overview: media.overview ?? '',
genres: media.genres ?? [],
poster: media.images.find((image: any) => image.coverType === 'poster')?.url,
poster: useRadarrv5 ? poster.remoteUrl : poster.url,
voteAverage: media.ratings.tmdb.value.toString(),
imdbId: media.imdbId,
type: 'movie',

View File

@@ -30,6 +30,10 @@ const definition = defineWidget({
type: 'switch',
defaultValue: false,
},
useRadarrv5: {
type: 'switch',
defaultValue: false,
},
radarrReleaseType: {
type: 'select',
defaultValue: 'inCinemas',