mirror of
https://github.com/aleksilassila/reiverr.git
synced 2026-04-23 01:05:13 +02:00
Merge branch 'dev' into person-screen
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { browser } from '$app/environment';
|
||||
import { TMDB_API_KEY } from '$lib/constants';
|
||||
import { TMDB_API_KEY, TMDB_BACKDROP_SMALL } from '$lib/constants';
|
||||
import { settings } from '$lib/stores/settings.store';
|
||||
import createClient from 'openapi-fetch';
|
||||
import { get } from 'svelte/store';
|
||||
import type { operations, paths } from './tmdb.generated';
|
||||
import type { TitleType } from '$lib/types';
|
||||
|
||||
const CACHE_ONE_DAY = 'max-age=86400';
|
||||
const CACHE_FOUR_DAYS = 'max-age=345600';
|
||||
@@ -302,6 +303,36 @@ export const getTmdbItemBackdrop = (item: {
|
||||
item?.images?.backdrops?.[0]
|
||||
)?.file_path;
|
||||
|
||||
export const getPosterProps = async (
|
||||
item: {
|
||||
name?: string;
|
||||
title?: string;
|
||||
id?: number;
|
||||
vote_average?: number;
|
||||
number_of_seasons?: number;
|
||||
first_air_date?: string;
|
||||
poster_path?: string;
|
||||
},
|
||||
type: TitleType | undefined = undefined
|
||||
) => {
|
||||
const backdropUri = item.poster_path;
|
||||
const t =
|
||||
type ||
|
||||
(item?.number_of_seasons === undefined && item?.first_air_date === undefined
|
||||
? 'movie'
|
||||
: 'series');
|
||||
return {
|
||||
tmdbId: item.id || 0,
|
||||
title: item.title || item.name || '',
|
||||
// subtitle: item.subtitle || '',
|
||||
rating: item.vote_average || undefined,
|
||||
size: 'md',
|
||||
backdropUrl: backdropUri ? TMDB_BACKDROP_SMALL + backdropUri : '',
|
||||
type: t,
|
||||
orientation: 'portrait'
|
||||
} as const;
|
||||
};
|
||||
|
||||
export const getTmdbPerson = async (person_id: number) =>
|
||||
TmdbApiOpen.get('/3/person/{person_id}', {
|
||||
params: {
|
||||
|
||||
Reference in New Issue
Block a user