aboutsummaryrefslogtreecommitdiff
path: root/web/script/player/jhls.d.ts
blob: 73c1e3cf0d4420c5f5c77d257554e8291181f15c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
    This file is part of jellything (https://codeberg.org/metamuffin/jellything)
    which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
    Copyright (C) 2024 metamuffin <metamuffin.org>
*/

export interface JhlsTrackIndex {
    segments: TimeRange[],
    extra_profiles: EncodingProfile[],
}

export interface TimeRange { start: number, end: number }

export interface NodePublic {
    kind: NodeKind,
    title?: string,
    tagline?: string,
    description?: string,
    id?: string,
    path: string[],
    children: string[],
    release_date?: string,
    index?: number,
    media?: MediaInfo,
    ratings: { [key in Rating]: number },
    // might be incomplete
}

export type NodeKind = "movie"
    | "video"
    | "collection"
    | "channel"
    | "show"
    | "series"
    | "season"
    | "episode"

export type Rating = "imdb"
    | "tmdb"
    | "rotten_tomatoes"
    | "metacritic"
    | "youtube_views"
    | "youtube_likes"
    | "youtube_followers"

export interface MediaInfo {
    duration: number,
    tracks: SourceTrack[],
    chapters: Chapter[],
}

export interface Chapter {
    time_start?: number,
    time_end?: number,
    labels: { [key: string]: string }
}

export interface SourceTrack {
    kind: SourceTrackKind,
    name: string,
    codec: string,
    language: string,
}
export type SourceTrackKind = {
    video: {
        width: number,
        height: number,
        fps: number,
    }
}
    | {
        audio: {
            channels: number,
            sample_rate: number,
            bit_depth: number,
        }
    } | "subtitles";

export interface EncodingProfile {
    video?: {
        codec: string,
        preset: number,
        bitrate: number,
        width: number,
    },
    audio?: {
        codec: string,
        bitrate: number,
        sample_rate?: number,
    },
    subtitles?: {
        codec: string,
    },
}

export interface NodeUserData {
    watched: WatchedState
}
export type WatchedState = "none" | "watched" | "pending" | { progress: number }

export interface JvttCue extends TimeRange {
    content: string
}