zaphyra's git: domsonic

subsonic web-client

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
55 
56 
57 
58 
59 
60 
61 
62 
63 
64 
65 
66 
67 
68 
69 
70 
71 
72 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
106 
107 
108 
109 
110 
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 
121 
122 
123 
124 
125 
126 
127 
128 
129 
130 
131 
132 
133 
134 
135 
136 
137 
138 
139 
140 
141 
142 
143 
144 
145 

export type Auth = {
  username: string
  salt: string;
  hash: string
}

export interface ServerInfo {
  name: string
  version: string
  openSubsonic: boolean
  extensions: string[]
}

export type StreamFormat = 'raw' | 'opus'
export type StreamSettings = {
  format: StreamFormat
  bitrate: number
}

export enum ReplayGainMode {
  None,   // No gain correction – play audio as-is
  Track,  // Normalise each track independently
  Album,  // Normalise relative to the full album (preserves dynamic contrast)
  _Length // Sentinel value – used to cycle through modes with modulo
}

export type ReplayGain = {
  trackGain: number // dB adjustment for a single track
  trackPeak: number // Peak sample value for a single track (0–1)
  albumGain: number // dB adjustment relative to the full album
  albumPeak: number // Peak sample value for the full album
}

export type SearchMode = null | 'artist' | 'album' | 'track'

export type AlbumSort =
	'a-z' |
	'recently-added'|
	'recently-played' |
	'most-played' |
	'random'

export interface AlbumArtist {
  id: string,
  name: string
}

export interface Track {
  id: string
  title: string
  duration: number
  size: number
  favourite: boolean
  image?: string
  url?: string
  track?: number
  album?: string
  albumId?: string
  artists: AlbumArtist[]
  isStream?: boolean
  isPodcast?: boolean
  isUnavailable?: boolean
  playCount?: number
  replayGain?: ReplayGain
}

export interface Genre {
  id: string
  name: string
  albumCount: number
  trackCount: number
}
export interface AlbumGenre {
  name: string
}

export interface Album {
  id: string
  name: string
  description?: string
  artists: {name: string, id: string}[]
  year: number
  favourite: boolean
  genres: AlbumGenre[]
  image?: string
  lastFmUrl?: string
  musicBrainzUrl?: string
  tracks?: Track[]
  releaseType?: string
}

export interface Artist {
  id: string
  name: string
  description?: string
  genres: AlbumGenre[]
  albumCount: number
  trackCount: number
  favourite: boolean
  lastFmUrl?: string
  musicBrainzUrl?: string
  topTracks?: Track[]
  similarArtist?: Artist[]
  albums?: Album[]
  image?: string
}

export interface SearchResult {
  artists: Artist[]
  albums: Album[]
  tracks: Track[]
}

export interface Directory {
  id: string
  name: string
  parent?: string
  tracks: Track[]
  directories: {
    id: string
    name: string
  }[]
}

export interface Playlist {
  id: string
  name: string
  comment: string
  owner?: string
  isPublic: boolean
  isReadOnly: boolean
  trackCount: number
  duration: number
  createdAt: string
  updatedAt: string
  image?: string
  tracks?: Track[]
}

export interface PlayQueue {
  tracks: Track[]
  currentTrack: number
  currentTrackPosition: number
}