mirror of
https://git.sr.ht/~joren/streamrip-go
synced 2026-06-17 15:05:39 +02:00
unify folder naming with resolved audio profiles across providers
This commit is contained in:
@@ -275,11 +275,13 @@ func (c *Client) GetDownloadable(ctx context.Context, item string, quality int)
|
||||
}
|
||||
|
||||
ext := qobuzDownloadExtension(resp, quality, streamURL)
|
||||
profile := qobuzAudioProfile(resp, quality, ext)
|
||||
|
||||
return &provider.Downloadable{
|
||||
URL: streamURL,
|
||||
Extension: ext,
|
||||
Source: "qobuz",
|
||||
Audio: profile,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -318,6 +320,81 @@ func qobuzDownloadExtension(resp map[string]any, quality int, streamURL string)
|
||||
return "mp3"
|
||||
}
|
||||
|
||||
func qobuzAudioProfile(resp map[string]any, requestedQuality int, ext string) provider.AudioProfile {
|
||||
if formatID, ok := intValue(resp["format_id"]); ok {
|
||||
switch formatID {
|
||||
case 5:
|
||||
return provider.AudioProfile{
|
||||
Container: "MP3",
|
||||
Codec: "MP3",
|
||||
Quality: "HIGH",
|
||||
BitDepth: 16,
|
||||
SamplingRate: "44.1",
|
||||
BitrateKbps: 320,
|
||||
}
|
||||
case 6:
|
||||
return provider.AudioProfile{
|
||||
Container: "FLAC",
|
||||
Codec: "FLAC",
|
||||
Quality: "LOSSLESS",
|
||||
BitDepth: 16,
|
||||
SamplingRate: "44.1",
|
||||
}
|
||||
case 7:
|
||||
return provider.AudioProfile{
|
||||
Container: "FLAC",
|
||||
Codec: "FLAC",
|
||||
Quality: "HI_RES",
|
||||
BitDepth: 24,
|
||||
SamplingRate: "96",
|
||||
}
|
||||
case 27:
|
||||
return provider.AudioProfile{
|
||||
Container: "FLAC",
|
||||
Codec: "FLAC",
|
||||
Quality: "HI_RES",
|
||||
BitDepth: 24,
|
||||
SamplingRate: "192",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if strings.EqualFold(ext, "mp3") {
|
||||
bitrate := 128
|
||||
if requestedQuality >= 1 {
|
||||
bitrate = 320
|
||||
}
|
||||
return provider.AudioProfile{
|
||||
Container: "MP3",
|
||||
Codec: "MP3",
|
||||
Quality: "HIGH",
|
||||
BitDepth: 16,
|
||||
SamplingRate: "44.1",
|
||||
BitrateKbps: bitrate,
|
||||
}
|
||||
}
|
||||
|
||||
quality := "LOSSLESS"
|
||||
bitDepth := 16
|
||||
sampling := "44.1"
|
||||
if requestedQuality >= 4 {
|
||||
quality = "HI_RES"
|
||||
bitDepth = 24
|
||||
sampling = "192"
|
||||
} else if requestedQuality >= 3 {
|
||||
quality = "HI_RES"
|
||||
bitDepth = 24
|
||||
sampling = "96"
|
||||
}
|
||||
return provider.AudioProfile{
|
||||
Container: "FLAC",
|
||||
Codec: "FLAC",
|
||||
Quality: quality,
|
||||
BitDepth: bitDepth,
|
||||
SamplingRate: sampling,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user