types.ts
| 1 | export interface MediaFile { |
| 2 | metadata: { |
| 3 | duration: number; |
| 4 | }; |
| 5 | } |
| 6 | |
| 7 | export interface Directory { |
| 8 | files: FileListing; |
| 9 | } |
| 10 | |
| 11 | //Scanned = we know which children exist |
| 12 | //Unknown = either: |
| 13 | // - not scanned (is a subdirectory and recursive=false) |
| 14 | // - only partially exists, because some deeper file was scannend, and this entry only exists as a link |
| 15 | export interface DirectoryWithStatus { |
| 16 | files: FileListingWithStatus; |
| 17 | status: "Scanned" | "Unknown"; |
| 18 | } |
| 19 | |
| 20 | export type FileListing = Map<string, Directory | MediaFile>; |
| 21 | export type FileListingWithStatus = Map<string, DirectoryWithStatus | MediaFile>; |
| 22 | |
| 23 | export enum MediaFormat { |
| 24 | "opus/ogg" = "opus/ogg", |
| 25 | "opus/webm" = "opus/webm", |
| 26 | mp3 = "mp3", |
| 27 | "vorbis/ogg" = "vorbis/ogg", |
| 28 | "vorbis/webm" = "vorbis/webm", |
| 29 | } |
| 30 |