[enhancement]: parse replaygain from subsonic endpoints where available
This commit is contained in:
parent
ef87a8c2a7
commit
c36f0a055d
2 changed files with 22 additions and 2 deletions
|
@ -75,7 +75,13 @@ const normalizeSong = (
|
||||||
discNumber: item.discNumber || 1,
|
discNumber: item.discNumber || 1,
|
||||||
discSubtitle: null,
|
discSubtitle: null,
|
||||||
duration: item.duration ? item.duration * 1000 : 0,
|
duration: item.duration ? item.duration * 1000 : 0,
|
||||||
gain: null,
|
gain:
|
||||||
|
item.replayGain && (item.replayGain.albumGain || item.replayGain.trackGain)
|
||||||
|
? {
|
||||||
|
album: item.replayGain.albumGain,
|
||||||
|
track: item.replayGain.trackGain,
|
||||||
|
}
|
||||||
|
: null,
|
||||||
genres: item.genre
|
genres: item.genre
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
|
@ -94,7 +100,13 @@ const normalizeSong = (
|
||||||
lyrics: null,
|
lyrics: null,
|
||||||
name: item.title,
|
name: item.title,
|
||||||
path: item.path,
|
path: item.path,
|
||||||
peak: null,
|
peak:
|
||||||
|
item.replayGain && (item.replayGain.albumPeak || item.replayGain.trackPeak)
|
||||||
|
? {
|
||||||
|
album: item.replayGain.albumPeak,
|
||||||
|
track: item.replayGain.trackPeak,
|
||||||
|
}
|
||||||
|
: null,
|
||||||
playCount: item?.playCount || 0,
|
playCount: item?.playCount || 0,
|
||||||
releaseDate: null,
|
releaseDate: null,
|
||||||
releaseYear: item.year ? String(item.year) : null,
|
releaseYear: item.year ? String(item.year) : null,
|
||||||
|
|
|
@ -53,6 +53,13 @@ const musicFolderList = z.object({
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const songGain = z.object({
|
||||||
|
albumGain: z.number().optional(),
|
||||||
|
albumPeak: z.number().optional(),
|
||||||
|
trackGain: z.number().optional(),
|
||||||
|
trackPeak: z.number().optional(),
|
||||||
|
});
|
||||||
|
|
||||||
const song = z.object({
|
const song = z.object({
|
||||||
album: z.string().optional(),
|
album: z.string().optional(),
|
||||||
albumId: z.string().optional(),
|
albumId: z.string().optional(),
|
||||||
|
@ -72,6 +79,7 @@ const song = z.object({
|
||||||
parent: z.string(),
|
parent: z.string(),
|
||||||
path: z.string(),
|
path: z.string(),
|
||||||
playCount: z.number().optional(),
|
playCount: z.number().optional(),
|
||||||
|
replayGain: songGain.optional(),
|
||||||
size: z.number(),
|
size: z.number(),
|
||||||
starred: z.boolean().optional(),
|
starred: z.boolean().optional(),
|
||||||
suffix: z.string(),
|
suffix: z.string(),
|
||||||
|
|
Reference in a new issue