Files
beStream/src/types/index.ts
kharonsec 766cbbce89
Some checks failed
CI / Lint & Type Check (push) Failing after 43s
CI / Tests (push) Successful in 1m0s
CI / Build Web (push) Has been skipped
CI / Security Scan (push) Successful in 46s
CI / Build Electron (Linux) (push) Has been skipped
CI / Build Tauri (ubuntu-latest) (push) Has been skipped
CI / Build Electron (Windows) (push) Has been cancelled
CI / Build Tauri (windows-latest) (push) Has been cancelled
Add local profiles, smart features, and Google Cast support
- Local Profiles: Profile selector, manager, avatar system, profile-aware stores
- Smart Features: Continue Watching, personalized recommendations, auto-quality, smart downloads
- Google Cast: Cast service with web SDK and Capacitor Android plugin interface
- Settings: New toggles for auto-quality and smart downloads

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:44:13 +01:00

259 lines
5.0 KiB
TypeScript

// YTS API Types
export interface Movie {
id: number;
url: string;
imdb_code: string;
title: string;
title_english: string;
title_long: string;
slug: string;
year: number;
rating: number;
runtime: number;
genres: string[];
summary: string;
description_full: string;
synopsis: string;
yt_trailer_code: string;
language: string;
mpa_rating: string;
background_image: string;
background_image_original: string;
small_cover_image: string;
medium_cover_image: string;
large_cover_image: string;
state: string;
torrents: Torrent[];
date_uploaded: string;
date_uploaded_unix: number;
}
export interface MovieDetails extends Movie {
download_count: number;
like_count: number;
description_intro: string;
cast?: CastMember[];
images?: MovieImages;
}
export interface Torrent {
url: string;
hash: string;
quality: string;
type: string;
is_repack: string;
video_codec: string;
bit_depth: string;
audio_channels: string;
seeds: number;
peers: number;
size: string;
size_bytes: number;
date_uploaded: string;
date_uploaded_unix: number;
}
export interface CastMember {
name: string;
character_name: string;
url_small_image: string;
imdb_code: string;
}
export interface MovieImages {
background_image: string;
background_image_original: string;
small_cover_image: string;
medium_cover_image: string;
large_cover_image: string;
}
export interface ParentalGuide {
type: string;
parental_guide_text: string;
}
// API Response Types
export interface ApiResponse<T> {
status: string;
status_message: string;
data: T;
}
export interface ListMoviesData {
movie_count: number;
limit: number;
page_number: number;
movies: Movie[];
}
export interface MovieDetailsData {
movie: MovieDetails;
}
export interface MovieSuggestionsData {
movie_count: number;
movies: Movie[];
}
export interface ParentalGuidesData {
parental_guides: ParentalGuide[];
}
// API Request Types
export interface ListMoviesParams {
limit?: number;
page?: number;
quality?: '480p' | '720p' | '1080p' | '1080p.x265' | '2160p' | '3D';
minimum_rating?: number;
query_term?: string;
genre?: string;
sort_by?: 'title' | 'year' | 'rating' | 'peers' | 'seeds' | 'download_count' | 'like_count' | 'date_added';
order_by?: 'desc' | 'asc';
with_rt_ratings?: boolean;
}
export interface MovieDetailsParams {
movie_id?: number;
imdb_id?: string;
with_images?: boolean;
with_cast?: boolean;
}
// App State Types
export interface WatchlistItem {
id: number;
movieId: number;
movie: Movie;
addedAt: Date;
}
export interface HistoryItem {
id: number;
movieId: number;
movie: Movie;
watchedAt: Date;
progress: number;
duration: number;
completed: boolean;
}
export interface DownloadItem {
id: string;
movieId: number;
movie: Movie;
torrent: Torrent;
progress: number;
downloadSpeed: number;
uploadSpeed: number;
peers: number;
status: 'queued' | 'downloading' | 'paused' | 'completed' | 'error';
filePath?: string;
startedAt: Date;
completedAt?: Date;
error?: string;
}
export interface Subtitle {
id: string;
language: string;
languageName: string;
url: string;
format: string;
}
export interface AppSettings {
preferredQuality: string;
preferredLanguage: string;
autoPlay: boolean;
autoDeleteStreams: boolean;
autoQuality: boolean;
autoDownloadNextEpisode: boolean;
notifications: boolean;
downloadPath: string;
maxConcurrentDownloads: number;
theme: 'dark' | 'light' | 'system';
}
// Profile Types
export interface Profile {
id: string;
name: string;
avatar: string; // avatar-1 through avatar-8
createdAt: number;
}
export const AVATAR_OPTIONS = [
'avatar-1', 'avatar-2', 'avatar-3', 'avatar-4',
'avatar-5', 'avatar-6', 'avatar-7', 'avatar-8',
] as const;
export type AvatarId = typeof AVATAR_OPTIONS[number];
// Recommendation Types
export interface RecommendationCache {
profileId: string;
recommendations: Movie[];
generatedAt: number;
basedOnGenres: string[];
}
// Torrent Types
export interface TorrentInfo {
infoHash: string;
magnetURI: string;
name: string;
progress: number;
downloadSpeed: number;
uploadSpeed: number;
numPeers: number;
downloaded: number;
uploaded: number;
length: number;
ready: boolean;
files: TorrentFile[];
}
export interface TorrentFile {
name: string;
path: string;
length: number;
progress: number;
selected: boolean;
}
// Genre list
export const GENRES = [
'Action',
'Adventure',
'Animation',
'Biography',
'Comedy',
'Crime',
'Documentary',
'Drama',
'Family',
'Fantasy',
'Film-Noir',
'History',
'Horror',
'Music',
'Musical',
'Mystery',
'Romance',
'Sci-Fi',
'Short',
'Sport',
'Thriller',
'War',
'Western',
] as const;
export type Genre = typeof GENRES[number];
// Note: TRACKERS array has been removed from frontend
// Trackers are only used in the backend (server/src/services/torrentManager.js)
// Frontend should not build magnet URIs directly - use the backend API instead