TmdbDiscoverItem type + browser api types
This commit is contained in:
@@ -461,6 +461,13 @@ export interface TmdbSearchMultiResult extends TmdbMovie {
|
||||
known_for?: any[]
|
||||
}
|
||||
|
||||
/** TMDB discover result - union of movie and tv with optional media_type. */
|
||||
export type TmdbDiscoverItem =
|
||||
| TmdbMovie
|
||||
| TmdbTvShow
|
||||
| (TmdbMovie & { media_type: string })
|
||||
| (TmdbTvShow & { media_type: string })
|
||||
|
||||
/* ────────────────────────────────────────────────────────────── */
|
||||
/* Fetcher */
|
||||
/* ────────────────────────────────────────────────────────────── */
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { getTmdbImageUrl } from '../api/tmdb'
|
||||
import type { BaseItemDto } from '../api/types'
|
||||
import type { TmdbDiscoverItem } from '../api/tmdb'
|
||||
|
||||
/**
|
||||
* Convert a TMDB result row (movie / tv / multi) into a synthetic
|
||||
@@ -10,7 +11,7 @@ import type { BaseItemDto } from '../api/types'
|
||||
* clicking opens the existing detail page instead of the synthetic one.
|
||||
*/
|
||||
export function mapTmdbToJf(
|
||||
items: any[],
|
||||
items: TmdbDiscoverItem[],
|
||||
libraryMap?: Map<string, { id: string; name: string; type: string }>,
|
||||
): BaseItemDto[] {
|
||||
return items.map(m => {
|
||||
@@ -37,7 +38,7 @@ export function mapTmdbToJf(
|
||||
_tmdbBackdrop: m.backdrop_path ? getTmdbImageUrl(m.backdrop_path, 'w780') : undefined,
|
||||
_inLibrary: !!local,
|
||||
_tmdbId: String(m.id),
|
||||
} as any as BaseItemDto
|
||||
} as unknown as BaseItemDto
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Vendored
+58
@@ -8,3 +8,61 @@ interface ImportMetaEnv {
|
||||
interface ImportMeta {
|
||||
readonly env: ImportMetaEnv
|
||||
}
|
||||
|
||||
/* ── Browser API extensions ── */
|
||||
|
||||
interface Navigator {
|
||||
mediaCapabilities?: {
|
||||
decodingInfo(configuration: unknown): Promise<unknown>
|
||||
}
|
||||
}
|
||||
|
||||
interface VideoPlaybackQuality {
|
||||
droppedVideoFrames: number
|
||||
}
|
||||
|
||||
interface HTMLVideoElement {
|
||||
getVideoPlaybackQuality?(): VideoPlaybackQuality
|
||||
audioTracks?: { length: number; [i: number]: { enabled: boolean } }
|
||||
mozPreservesPitch?: boolean
|
||||
webkitPreservesPitch?: boolean
|
||||
}
|
||||
|
||||
interface Document {
|
||||
pictureInPictureElement?: Element | null
|
||||
exitPictureInPicture?(): Promise<void>
|
||||
}
|
||||
|
||||
interface Window {
|
||||
webkitAudioContext?: typeof AudioContext
|
||||
SubtitlesOctopus?: unknown
|
||||
}
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-empty-object-type */
|
||||
declare module 'react' {
|
||||
interface CSSProperties {
|
||||
WebkitUserSelect?: string
|
||||
}
|
||||
}
|
||||
|
||||
/* ── Extended Jellyfin item with synthetic TMDB fields ── */
|
||||
|
||||
import type { BaseItemDto } from '@jellyfin/sdk/lib/generated-client/models'
|
||||
|
||||
type SyntheticBaseItemDto = BaseItemDto & {
|
||||
_tmdbPoster?: string
|
||||
_tmdbBackdrop?: string
|
||||
_inLibrary?: boolean
|
||||
_tmdbId?: string
|
||||
_kind?: string
|
||||
}
|
||||
|
||||
declare module '@jellyfin/sdk/lib/generated-client/models' {
|
||||
interface BaseItemDto {
|
||||
_tmdbPoster?: string
|
||||
_tmdbBackdrop?: string
|
||||
_inLibrary?: boolean
|
||||
_tmdbId?: string
|
||||
_kind?: string
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user