- Introduced new `library` module in the API routes to handle media library requests. - Enhanced `AppState` to include a media provider for library interactions. - Defined new `IMediaProvider` trait methods for listing collections, series, and genres. - Implemented Jellyfin media provider methods for fetching collections and series. - Added frontend components for selecting series and displaying filter previews. - Created hooks for fetching collections, series, and genres from the library. - Updated media filter to support series name and search term. - Enhanced API client to handle new library-related endpoints.
163 lines
3.4 KiB
TypeScript
163 lines
3.4 KiB
TypeScript
// API response and request types matching the backend DTOs
|
|
|
|
export type ContentType = "movie" | "episode" | "short";
|
|
|
|
export type FillStrategy = "best_fit" | "sequential" | "random";
|
|
|
|
export interface MediaFilter {
|
|
content_type?: ContentType | null;
|
|
genres: string[];
|
|
decade?: number | null;
|
|
tags: string[];
|
|
min_duration_secs?: number | null;
|
|
max_duration_secs?: number | null;
|
|
collections: string[];
|
|
/** Filter by TV series name, e.g. "iCarly". Use with Sequential strategy. */
|
|
series_name?: string | null;
|
|
/** Free-text search, used for library browsing only. */
|
|
search_term?: string | null;
|
|
}
|
|
|
|
// Library browsing
|
|
|
|
export interface CollectionResponse {
|
|
id: string;
|
|
name: string;
|
|
collection_type?: string | null;
|
|
}
|
|
|
|
export interface SeriesResponse {
|
|
id: string;
|
|
name: string;
|
|
episode_count: number;
|
|
genres: string[];
|
|
year?: number | null;
|
|
}
|
|
|
|
export interface LibraryItemResponse {
|
|
id: string;
|
|
title: string;
|
|
content_type: ContentType;
|
|
duration_secs: number;
|
|
series_name?: string | null;
|
|
season_number?: number | null;
|
|
episode_number?: number | null;
|
|
year?: number | null;
|
|
genres: string[];
|
|
}
|
|
|
|
export interface RecyclePolicy {
|
|
cooldown_days?: number | null;
|
|
cooldown_generations?: number | null;
|
|
min_available_ratio: number;
|
|
}
|
|
|
|
export type BlockContent =
|
|
| { type: "algorithmic"; filter: MediaFilter; strategy: FillStrategy }
|
|
| { type: "manual"; items: string[] };
|
|
|
|
export interface ProgrammingBlock {
|
|
id: string;
|
|
name: string;
|
|
/** "HH:MM:SS" */
|
|
start_time: string;
|
|
duration_mins: number;
|
|
content: BlockContent;
|
|
}
|
|
|
|
export interface ScheduleConfig {
|
|
blocks: ProgrammingBlock[];
|
|
}
|
|
|
|
// Config
|
|
|
|
export interface ConfigResponse {
|
|
allow_registration: boolean;
|
|
}
|
|
|
|
// Auth
|
|
|
|
export interface TokenResponse {
|
|
access_token: string;
|
|
token_type: string;
|
|
expires_in: number;
|
|
}
|
|
|
|
export interface UserResponse {
|
|
id: string;
|
|
email: string;
|
|
created_at: string;
|
|
}
|
|
|
|
// Channels
|
|
|
|
export interface ChannelResponse {
|
|
id: string;
|
|
owner_id: string;
|
|
name: string;
|
|
description?: string | null;
|
|
timezone: string;
|
|
schedule_config: ScheduleConfig;
|
|
recycle_policy: RecyclePolicy;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
export interface CreateChannelRequest {
|
|
name: string;
|
|
timezone: string;
|
|
description?: string;
|
|
}
|
|
|
|
export interface UpdateChannelRequest {
|
|
name?: string;
|
|
description?: string;
|
|
timezone?: string;
|
|
schedule_config?: ScheduleConfig;
|
|
recycle_policy?: RecyclePolicy;
|
|
}
|
|
|
|
// Media & Schedule
|
|
|
|
export interface MediaItemResponse {
|
|
id: string;
|
|
title: string;
|
|
content_type: ContentType;
|
|
duration_secs: number;
|
|
description?: string | null;
|
|
genres: string[];
|
|
tags: string[];
|
|
year?: number | null;
|
|
/** Episodes only: the parent TV show name. */
|
|
series_name?: string | null;
|
|
/** Episodes only: season number (1-based). */
|
|
season_number?: number | null;
|
|
/** Episodes only: episode number within the season (1-based). */
|
|
episode_number?: number | null;
|
|
}
|
|
|
|
export interface ScheduledSlotResponse {
|
|
id: string;
|
|
block_id: string;
|
|
item: MediaItemResponse;
|
|
/** RFC3339 */
|
|
start_at: string;
|
|
/** RFC3339 */
|
|
end_at: string;
|
|
}
|
|
|
|
export interface ScheduleResponse {
|
|
id: string;
|
|
channel_id: string;
|
|
generation: number;
|
|
generated_at: string;
|
|
valid_from: string;
|
|
valid_until: string;
|
|
slots: ScheduledSlotResponse[];
|
|
}
|
|
|
|
export interface CurrentBroadcastResponse {
|
|
slot: ScheduledSlotResponse;
|
|
offset_secs: number;
|
|
}
|