fix: Radarr & Sonarr requests fail due to wrong indexerId, fix: Invalid backdrop urls

This commit is contained in:
Aleksi Lassila
2023-08-15 15:12:17 +03:00
parent 4732cc1c47
commit 3cba296db1
11 changed files with 36 additions and 32 deletions

View File

@@ -10,7 +10,7 @@ import type Card from './Card.svelte';
import { TMDB_BACKDROP_SMALL } from '$lib/constants';
export const fetchCardTmdbMovieProps = async (movie: TmdbMovie2): Promise<ComponentProps<Card>> => {
const backdropUri = getTmdbMovieBackdrop(movie.id || 0);
const backdropUri = await getTmdbMovieBackdrop(movie.id || 0);
const movieAny = movie as any;
const genres =
@@ -25,7 +25,7 @@ export const fetchCardTmdbMovieProps = async (movie: TmdbMovie2): Promise<Compon
title: movie.title || '',
genres,
runtimeMinutes: movie.runtime,
backdropUrl: TMDB_BACKDROP_SMALL + (await backdropUri) || '',
backdropUrl: backdropUri ? TMDB_BACKDROP_SMALL + backdropUri : '',
rating: movie.vote_average || 0
};
};
@@ -33,7 +33,7 @@ export const fetchCardTmdbMovieProps = async (movie: TmdbMovie2): Promise<Compon
export const fetchCardTmdbSeriesProps = async (
series: TmdbSeries2
): Promise<ComponentProps<Card>> => {
const backdropUri = getTmdbSeriesBackdrop(series.id || 0);
const backdropUri = await getTmdbSeriesBackdrop(series.id || 0);
const seriesAny = series as any;
const genres =
@@ -48,7 +48,7 @@ export const fetchCardTmdbSeriesProps = async (
title: series.name || '',
genres,
runtimeMinutes: series.episode_run_time?.[0],
backdropUrl: TMDB_BACKDROP_SMALL + (await backdropUri) || '',
backdropUrl: backdropUri ? TMDB_BACKDROP_SMALL + backdropUri : '',
rating: series.vote_average || 0,
type: 'series'
};