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 | } |
| 14 | |
| 15 | export interface MediaFile { |
| 16 | metadata: Metadata; |
| 17 | } |
| 18 | |
| 19 | export 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 |
| 27 | export interface DirectoryWithStatus { |
| 28 | files: FileListingWithStatus; |
| 29 | status: "Scanned" | "Unknown"; |
| 30 | } |
| 31 | |
| 32 | export type FileListing = Map<string, Directory | MediaFile>; |
| 33 | export type FileListingWithStatus = Map<string, DirectoryWithStatus | MediaFile>; |
| 34 | |
| 35 | export enum MediaContainer { |
| 36 | mp3 = "mp3", |
| 37 | webm = "webm", |
| 38 | ogg = "ogg", |
| 39 | } |
| 40 | |
| 41 | export enum VideoCodec { |
| 42 | none = "none", |
| 43 | av1 = "av1", |
| 44 | vp8 = "vp8", |
| 45 | vp9 = "vp9", |
| 46 | theora = "theora", |
| 47 | } |
| 48 | |
| 49 | export enum AudioCodec { |
| 50 | none = "none", |
| 51 | mp3 = "mp3", |
| 52 | opus = "opus", |
| 53 | vorbis = "vorbis", |
| 54 | } |
| 55 | |
| 56 | export enum VideoEncodingSetting { |
| 57 | veryfast = "veryfast", |
| 58 | fast = "fast", |
| 59 | balanced = "balanced", |
| 60 | quality = "quality", |
| 61 | } |
| 62 |