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}
9
10export interface MediaFile {
11 metadata: Metadata;
12}
13
14export interface Directory {
15 files: FileListing;
16}
17
18//Scanned = we know which children exist
19//Unknown = either:
20// - not scanned (is a subdirectory and recursive=false)
21// - only partially exists, because some deeper file was scannend, and this entry only exists as a link
22export interface DirectoryWithStatus {
23 files: FileListingWithStatus;
24 status: "Scanned" | "Unknown";
25}
26
27export type FileListing = Map<string, Directory | MediaFile>;
28export type FileListingWithStatus = Map<string, DirectoryWithStatus | MediaFile>;
29
30export enum MediaFormat {
31 "opus/ogg" = "opus/ogg",
32 "opus/webm" = "opus/webm",
33 mp3 = "mp3",
34 "vorbis/ogg" = "vorbis/ogg",
35 "vorbis/webm" = "vorbis/webm",
36}