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