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 container?: string;
13}
14
15export interface MediaFile {
16 metadata: Metadata;
17}
18
19export interface Directory {
20 files: FileListing;
21}
22
23//Scanned = we know which children exist
24//Unknown = either:
25// - not scanned (is a subdirectory and recursive=false)
26// - only partially exists, because some deeper file was scannend, and this entry only exists as a link
27export interface DirectoryWithStatus {
28 files: FileListingWithStatus;
29 status: "Scanned" | "Unknown";
30}
31
32export type FileListing = Map<string, Directory | MediaFile>;
33export type FileListingWithStatus = Map<string, DirectoryWithStatus | MediaFile>;
34
35export enum MediaContainer {
36 mp3 = "mp3",
37 webm = "webm",
38 ogg = "ogg",
39}
40
41export enum VideoCodec {
42 none = "none",
43 av1 = "av1",
44 vp8 = "vp8",
45 vp9 = "vp9",
46 theora = "theora",
47}
48
49export enum AudioCodec {
50 none = "none",
51 mp3 = "mp3",
52 opus = "opus",
53 vorbis = "vorbis",
54}
55
56export enum VideoEncodingSetting {
57 veryfast = "veryfast",
58 fast = "fast",
59 balanced = "balanced",
60 quality = "quality",
61}
62