types.ts
⎇
Raw
1export interface Metadata {
2 duration: number;
3 trackNumber?: number;
4 title?: string;
5 artist?: string;
6 album?: string;
7 genre?: string[];
8 audioCodec?: string;
9 audioBitrate?: number;
10 videoCodec?: string;
11 videoBitrate?: number;
12 videoWidth?: number;
13 videoHeight?: number;
14 frameRate?: number;
15 interlaced?: boolean;
16 container?: string;
17 audioTracks?: { language?: string; default: boolean }[];
18}
19
20export interface IsVideoResponse {
21 isVideo: boolean;
22}
23
24export interface MediaFile {
25 metadata: Metadata;
26}
27
28export interface Directory {
29 files: FileListing;
30}
31
32//Scanned = we know which children exist
33//Unknown = either:
34// - not scanned (is a subdirectory and recursive=false)
35// - only partially exists, because some deeper file was scanned, and this entry only exists as a link
36export interface DirectoryWithStatus {
37 files: FileListingWithStatus;
38 status: "Scanned" | "Unknown";
39}
40
41export type FileListing = Record<string, Directory | MediaFile>;
42export type FileListingWithStatus = Record<string, DirectoryWithStatus | MediaFile>;
43
44export enum MediaContainer {
45 mp4 = "mp4",
46 webm = "webm",
47 mp3 = "mp3",
48 ogg = "ogg",
49}
50
51export enum VideoCodec {
52 none = "none",
53 av1 = "av1",
54 h264 = "h264",
55 h265 = "h265",
56 vp9 = "vp9",
57}
58
59export enum AudioCodec {
60 opus = "opus",
61 aac = "aac",
62 vorbis = "vorbis",
63 mp3 = "mp3",
64 flac = "flac",
65}
66
67export enum VideoEncodingSetting {
68 veryfast = "veryfast",
69 fast = "fast",
70 balanced = "balanced",
71 quality = "quality",
72}
73