mirror of
https://git.sr.ht/~joren/streamrip-go
synced 2026-08-24 18:48:21 +02:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8590a5b6b6
|
||
|
|
eb7854bac3
|
||
|
|
5f61b1a3cf
|
+91
-19
@@ -11,6 +11,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"streamrip-go/internal/artwork"
|
"streamrip-go/internal/artwork"
|
||||||
"streamrip-go/internal/audio/convert"
|
"streamrip-go/internal/audio/convert"
|
||||||
@@ -58,6 +59,7 @@ type ripTrackOptions struct {
|
|||||||
forPlaylist bool
|
forPlaylist bool
|
||||||
playlistName string
|
playlistName string
|
||||||
playlistPos int
|
playlistPos int
|
||||||
|
playlistYear int
|
||||||
}
|
}
|
||||||
|
|
||||||
type folderAudioValues struct {
|
type folderAudioValues struct {
|
||||||
@@ -372,14 +374,22 @@ func (m *Main) ripTrackCollection(ctx context.Context, p provider.Client, source
|
|||||||
ids = append(ids, id)
|
ids = append(ids, id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var artRes artwork.Result
|
||||||
|
var playlistYear int
|
||||||
|
if playlistLike {
|
||||||
|
artRes, _ = artwork.Prepare(ctx, m.DL, folder, meta, m.Config.Session.Artwork, true)
|
||||||
|
playlistYear = extractYear(meta)
|
||||||
|
}
|
||||||
|
|
||||||
m.logf("%s: %s (%d tracks)\n", kind, name, len(ids))
|
m.logf("%s: %s (%d tracks)\n", kind, name, len(ids))
|
||||||
failures := 0
|
failures := 0
|
||||||
runOne := func(i int, trackID string) {
|
runOne := func(i int, trackID string) {
|
||||||
opts := ripTrackOptions{albumFolder: folder, index: i, total: len(ids)}
|
opts := ripTrackOptions{albumFolder: folder, albumEmbedCover: artRes.EmbedPath, index: i, total: len(ids)}
|
||||||
if playlistLike {
|
if playlistLike {
|
||||||
opts.forPlaylist = true
|
opts.forPlaylist = true
|
||||||
opts.playlistName = name
|
opts.playlistName = name
|
||||||
opts.playlistPos = i
|
opts.playlistPos = i
|
||||||
|
opts.playlistYear = playlistYear
|
||||||
}
|
}
|
||||||
if err := m.ripTrack(ctx, p, source, trackID, "", opts); err != nil {
|
if err := m.ripTrack(ctx, p, source, trackID, "", opts); err != nil {
|
||||||
failures++
|
failures++
|
||||||
@@ -404,11 +414,12 @@ func (m *Main) ripTrackCollection(ctx context.Context, p provider.Client, source
|
|||||||
go func(pos int, tid string) {
|
go func(pos int, tid string) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
defer func() { <-sem }()
|
defer func() { <-sem }()
|
||||||
opts := ripTrackOptions{albumFolder: folder, index: pos, total: len(ids)}
|
opts := ripTrackOptions{albumFolder: folder, albumEmbedCover: artRes.EmbedPath, index: pos, total: len(ids)}
|
||||||
if playlistLike {
|
if playlistLike {
|
||||||
opts.forPlaylist = true
|
opts.forPlaylist = true
|
||||||
opts.playlistName = name
|
opts.playlistName = name
|
||||||
opts.playlistPos = pos
|
opts.playlistPos = pos
|
||||||
|
opts.playlistYear = playlistYear
|
||||||
}
|
}
|
||||||
if err := m.ripTrack(ctx, p, source, tid, "", opts); err != nil {
|
if err := m.ripTrack(ctx, p, source, tid, "", opts); err != nil {
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
@@ -648,10 +659,7 @@ func (m *Main) ripAlbum(ctx context.Context, p provider.Client, source, albumID
|
|||||||
}
|
}
|
||||||
|
|
||||||
albumTitle := titleFromMetadata(albumMeta, albumID)
|
albumTitle := titleFromMetadata(albumMeta, albumID)
|
||||||
albumArtist := jsonutil.NestedString(albumMeta, "artist", "name")
|
albumArtist := extractAlbumArtist(albumMeta)
|
||||||
if albumArtist == "" {
|
|
||||||
albumArtist = "Unknown"
|
|
||||||
}
|
|
||||||
releaseDate := jsonutil.StringFromAny(albumMeta["release_date_original"])
|
releaseDate := jsonutil.StringFromAny(albumMeta["release_date_original"])
|
||||||
if releaseDate == "" {
|
if releaseDate == "" {
|
||||||
releaseDate = jsonutil.StringFromAny(albumMeta["release_date"])
|
releaseDate = jsonutil.StringFromAny(albumMeta["release_date"])
|
||||||
@@ -809,18 +817,24 @@ func (m *Main) ripPlaylist(ctx context.Context, p provider.Client, source, playl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
artRes, _ := artwork.Prepare(ctx, m.DL, folder, playlistMeta, m.Config.Session.Artwork, true)
|
||||||
|
|
||||||
|
playlistYear := extractYear(playlistMeta)
|
||||||
|
|
||||||
total := len(ids)
|
total := len(ids)
|
||||||
m.logf("Playlist: %s (%d tracks)\n", name, total)
|
m.logf("Playlist: %s (%d tracks)\n", name, total)
|
||||||
failures := 0
|
failures := 0
|
||||||
|
|
||||||
runOne := func(i int, id string) {
|
runOne := func(i int, id string) {
|
||||||
opts := ripTrackOptions{
|
opts := ripTrackOptions{
|
||||||
albumFolder: folder,
|
albumFolder: folder,
|
||||||
index: i,
|
albumEmbedCover: artRes.EmbedPath,
|
||||||
total: total,
|
index: i,
|
||||||
forPlaylist: true,
|
total: total,
|
||||||
playlistName: name,
|
forPlaylist: true,
|
||||||
playlistPos: i,
|
playlistName: name,
|
||||||
|
playlistPos: i,
|
||||||
|
playlistYear: playlistYear,
|
||||||
}
|
}
|
||||||
if err := m.ripTrack(ctx, p, source, id, "", opts); err != nil {
|
if err := m.ripTrack(ctx, p, source, id, "", opts); err != nil {
|
||||||
failures++
|
failures++
|
||||||
@@ -846,7 +860,7 @@ func (m *Main) ripPlaylist(ctx context.Context, p provider.Client, source, playl
|
|||||||
go func(pos int, tid string) {
|
go func(pos int, tid string) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
defer func() { <-sem }()
|
defer func() { <-sem }()
|
||||||
opts := ripTrackOptions{albumFolder: folder, index: pos, total: total, forPlaylist: true, playlistName: name, playlistPos: pos}
|
opts := ripTrackOptions{albumFolder: folder, albumEmbedCover: artRes.EmbedPath, index: pos, total: total, forPlaylist: true, playlistName: name, playlistPos: pos, playlistYear: playlistYear}
|
||||||
if err := m.ripTrack(ctx, p, source, tid, "", opts); err != nil {
|
if err := m.ripTrack(ctx, p, source, tid, "", opts); err != nil {
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
failures++
|
failures++
|
||||||
@@ -1013,7 +1027,7 @@ func (m *Main) ripTrack(ctx context.Context, p provider.Client, source, id, fall
|
|||||||
downloaded:
|
downloaded:
|
||||||
|
|
||||||
embedCoverPath := opts.albumEmbedCover
|
embedCoverPath := opts.albumEmbedCover
|
||||||
if opts.forPlaylist {
|
if opts.forPlaylist && embedCoverPath == "" {
|
||||||
parent := opts.albumFolder
|
parent := opts.albumFolder
|
||||||
if parent == "" {
|
if parent == "" {
|
||||||
parent = filepath.Dir(outPath)
|
parent = filepath.Dir(outPath)
|
||||||
@@ -1023,7 +1037,7 @@ downloaded:
|
|||||||
embedCoverPath = res.EmbedPath
|
embedCoverPath = res.EmbedPath
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if embedCoverPath == "" {
|
} else if !opts.forPlaylist && embedCoverPath == "" {
|
||||||
parent := opts.albumFolder
|
parent := opts.albumFolder
|
||||||
if parent == "" {
|
if parent == "" {
|
||||||
parent = filepath.Dir(outPath)
|
parent = filepath.Dir(outPath)
|
||||||
@@ -1224,10 +1238,7 @@ func (m *Main) trackOutputPath(source, id, title, ext string, d *provider.Downlo
|
|||||||
if albumID == "" {
|
if albumID == "" {
|
||||||
albumID = id
|
albumID = id
|
||||||
}
|
}
|
||||||
albumArtist := jsonutil.NestedString(trackMeta, "album", "artist", "name")
|
albumArtist := extractAlbumArtist(trackMetaAlbum(trackMeta))
|
||||||
if albumArtist == "" {
|
|
||||||
albumArtist = jsonutil.NestedString(trackMeta, "performer", "name")
|
|
||||||
}
|
|
||||||
albumYear := naming.YearFromDate(jsonutil.StringFromAny(trackMeta["release_date_original"]))
|
albumYear := naming.YearFromDate(jsonutil.StringFromAny(trackMeta["release_date_original"]))
|
||||||
if albumYear == "Unknown" {
|
if albumYear == "Unknown" {
|
||||||
albumYear = naming.YearFromDate(jsonutil.StringFromAny(trackMeta["release_date"]))
|
albumYear = naming.YearFromDate(jsonutil.StringFromAny(trackMeta["release_date"]))
|
||||||
@@ -1479,7 +1490,9 @@ func buildTagMetadata(trackMeta map[string]any, title, source, trackID string, o
|
|||||||
Artist: artist,
|
Artist: artist,
|
||||||
Artists: artistNames,
|
Artists: artistNames,
|
||||||
AlbumArtist: albumArtist,
|
AlbumArtist: albumArtist,
|
||||||
|
Compilation: opts.forPlaylist,
|
||||||
OmitDiscTags: opts.forPlaylist,
|
OmitDiscTags: opts.forPlaylist,
|
||||||
|
Year: opts.playlistYear,
|
||||||
TrackNumber: trackNumber,
|
TrackNumber: trackNumber,
|
||||||
DiscNumber: discNumber,
|
DiscNumber: discNumber,
|
||||||
TrackTotal: trackTotal,
|
TrackTotal: trackTotal,
|
||||||
@@ -1613,3 +1626,62 @@ func isFFmpegMissingError(err error) bool {
|
|||||||
}
|
}
|
||||||
return strings.Contains(strings.ToLower(err.Error()), "ffmpeg not found")
|
return strings.Contains(strings.ToLower(err.Error()), "ffmpeg not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func extractAlbumArtist(albumMeta map[string]any) string {
|
||||||
|
if artistsRaw, ok := albumMeta["artists"].([]any); ok {
|
||||||
|
names := make([]string, 0, len(artistsRaw))
|
||||||
|
for _, a := range artistsRaw {
|
||||||
|
artist, ok := a.(map[string]any)
|
||||||
|
if !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if name := jsonutil.StringFromAny(artist["name"]); name != "" {
|
||||||
|
names = append(names, name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(names) > 0 {
|
||||||
|
return displayArtistNames(names)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if names := stringSliceFromAny(albumMeta["artist_names"]); len(names) > 0 {
|
||||||
|
return displayArtistNames(names)
|
||||||
|
}
|
||||||
|
artist := jsonutil.NestedString(albumMeta, "artist", "name")
|
||||||
|
if artist != "" {
|
||||||
|
return artist
|
||||||
|
}
|
||||||
|
return "Unknown"
|
||||||
|
}
|
||||||
|
|
||||||
|
func displayArtistNames(names []string) string {
|
||||||
|
switch len(names) {
|
||||||
|
case 0:
|
||||||
|
return ""
|
||||||
|
case 1:
|
||||||
|
return names[0]
|
||||||
|
case 2:
|
||||||
|
return names[0] + " & " + names[1]
|
||||||
|
default:
|
||||||
|
return strings.Join(names[:len(names)-1], ", ") + " & " + names[len(names)-1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func extractYear(meta map[string]any) int {
|
||||||
|
date := jsonutil.FirstNonEmpty(
|
||||||
|
jsonutil.StringFromAny(meta["publish_date"]),
|
||||||
|
jsonutil.StringFromAny(meta["creation_date"]),
|
||||||
|
jsonutil.StringFromAny(meta["created_at"]),
|
||||||
|
jsonutil.StringFromAny(meta["release_date"]),
|
||||||
|
jsonutil.StringFromAny(meta["new_release_date"]),
|
||||||
|
)
|
||||||
|
if date == "" {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
if t, err := time.Parse(time.RFC3339, date); err == nil {
|
||||||
|
return t.Year()
|
||||||
|
}
|
||||||
|
if t, err := time.Parse("2006-01-02", date); err == nil {
|
||||||
|
return t.Year()
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ type Metadata struct {
|
|||||||
Artist string
|
Artist string
|
||||||
Artists []string
|
Artists []string
|
||||||
AlbumArtist string
|
AlbumArtist string
|
||||||
|
Compilation bool
|
||||||
OmitDiscTags bool
|
OmitDiscTags bool
|
||||||
|
Year int
|
||||||
TrackNumber int
|
TrackNumber int
|
||||||
DiscNumber int
|
DiscNumber int
|
||||||
TrackTotal int
|
TrackTotal int
|
||||||
@@ -197,6 +199,12 @@ func toTags(meta Metadata) map[string]string {
|
|||||||
if meta.DiscTotal > 0 {
|
if meta.DiscTotal > 0 {
|
||||||
tags["disctotal"] = strconv.Itoa(meta.DiscTotal)
|
tags["disctotal"] = strconv.Itoa(meta.DiscTotal)
|
||||||
}
|
}
|
||||||
|
if meta.Compilation {
|
||||||
|
tags["COMPILATION"] = "1"
|
||||||
|
}
|
||||||
|
if meta.Year > 0 {
|
||||||
|
tags["year"] = strconv.Itoa(meta.Year)
|
||||||
|
}
|
||||||
return tags
|
return tags
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -610,12 +610,15 @@ func (c *Client) releaseCollectionMetadata(raw map[string]any, releases []any) m
|
|||||||
func playlistMetadata(raw map[string]any, tracks []any) map[string]any {
|
func playlistMetadata(raw map[string]any, tracks []any) map[string]any {
|
||||||
name := jsonutil.StringFromAny(raw["name"])
|
name := jsonutil.StringFromAny(raw["name"])
|
||||||
return map[string]any{
|
return map[string]any{
|
||||||
"id": jsonutil.StringFromAny(raw["id"]),
|
"id": jsonutil.StringFromAny(raw["id"]),
|
||||||
"name": name,
|
"name": name,
|
||||||
"title": name,
|
"title": name,
|
||||||
"tracks_count": firstPositiveInt(jsonutil.IntFromAny(raw["track_count"]), len(tracks)),
|
"tracks_count": firstPositiveInt(jsonutil.IntFromAny(raw["track_count"]), len(tracks)),
|
||||||
"image": imageMap(raw["image"]),
|
"image": imageMap(raw["image"]),
|
||||||
"tracks": map[string]any{"items": tracks},
|
"publish_date": jsonutil.StringFromAny(raw["publish_date"]),
|
||||||
|
"new_release_date": jsonutil.StringFromAny(raw["new_release_date"]),
|
||||||
|
"release_date": jsonutil.StringFromAny(raw["release_date"]),
|
||||||
|
"tracks": map[string]any{"items": tracks},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -364,40 +364,60 @@ func qobuzDownloadExtension(resp map[string]any, quality int, streamURL string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func qobuzAudioProfile(resp map[string]any, requestedQuality int, ext string) provider.AudioProfile {
|
func qobuzAudioProfile(resp map[string]any, requestedQuality int, ext string) provider.AudioProfile {
|
||||||
|
exactBitDepth, _ := intValue(firstNonNil(resp["bit_depth"], resp["bits_depth"], resp["maximum_bit_depth"]))
|
||||||
|
exactSampling, _ := floatValue(firstNonNil(resp["sampling_rate"], resp["sample_rate"], resp["maximum_sampling_rate"]))
|
||||||
if formatID, ok := intValue(resp["format_id"]); ok {
|
if formatID, ok := intValue(resp["format_id"]); ok {
|
||||||
switch formatID {
|
switch formatID {
|
||||||
case 5:
|
case 5:
|
||||||
|
if exactBitDepth == 0 {
|
||||||
|
exactBitDepth = 16
|
||||||
|
}
|
||||||
|
if exactSampling == 0 {
|
||||||
|
exactSampling = 44.1
|
||||||
|
}
|
||||||
return provider.AudioProfile{
|
return provider.AudioProfile{
|
||||||
Container: "MP3",
|
Container: "MP3",
|
||||||
Codec: "MP3",
|
Codec: "MP3",
|
||||||
Quality: "HIGH",
|
Quality: "HIGH",
|
||||||
BitDepth: 16,
|
BitDepth: exactBitDepth,
|
||||||
SamplingRate: "44.1",
|
SamplingRate: formatSamplingRate(exactSampling),
|
||||||
BitrateKbps: 320,
|
BitrateKbps: 320,
|
||||||
}
|
}
|
||||||
case 6:
|
case 6:
|
||||||
|
if exactBitDepth == 0 {
|
||||||
|
exactBitDepth = 16
|
||||||
|
}
|
||||||
|
if exactSampling == 0 {
|
||||||
|
exactSampling = 44.1
|
||||||
|
}
|
||||||
return provider.AudioProfile{
|
return provider.AudioProfile{
|
||||||
Container: "FLAC",
|
Container: "FLAC",
|
||||||
Codec: "FLAC",
|
Codec: "FLAC",
|
||||||
Quality: "LOSSLESS",
|
Quality: "LOSSLESS",
|
||||||
BitDepth: 16,
|
BitDepth: exactBitDepth,
|
||||||
SamplingRate: "44.1",
|
SamplingRate: formatSamplingRate(exactSampling),
|
||||||
}
|
}
|
||||||
case 7:
|
case 7:
|
||||||
|
if exactBitDepth == 0 {
|
||||||
|
exactBitDepth = 24
|
||||||
|
}
|
||||||
return provider.AudioProfile{
|
return provider.AudioProfile{
|
||||||
Container: "FLAC",
|
Container: "FLAC",
|
||||||
Codec: "FLAC",
|
Codec: "FLAC",
|
||||||
Quality: "HI_RES",
|
Quality: "HI_RES",
|
||||||
BitDepth: 24,
|
BitDepth: exactBitDepth,
|
||||||
SamplingRate: "96",
|
SamplingRate: formatSamplingRate(exactSampling),
|
||||||
}
|
}
|
||||||
case 27:
|
case 27:
|
||||||
|
if exactBitDepth == 0 {
|
||||||
|
exactBitDepth = 24
|
||||||
|
}
|
||||||
return provider.AudioProfile{
|
return provider.AudioProfile{
|
||||||
Container: "FLAC",
|
Container: "FLAC",
|
||||||
Codec: "FLAC",
|
Codec: "FLAC",
|
||||||
Quality: "HI_RES",
|
Quality: "HI_RES",
|
||||||
BitDepth: 24,
|
BitDepth: exactBitDepth,
|
||||||
SamplingRate: "192",
|
SamplingRate: formatSamplingRate(exactSampling),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -438,6 +458,22 @@ func qobuzAudioProfile(resp map[string]any, requestedQuality int, ext string) pr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func firstNonNil(vals ...any) any {
|
||||||
|
for _, v := range vals {
|
||||||
|
if v != nil {
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func formatSamplingRate(v float64) string {
|
||||||
|
if v <= 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return strconv.FormatFloat(v, 'f', -1, 64)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Client) Close() error {
|
func (c *Client) Close() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -577,11 +613,13 @@ func (c *Client) getPlaylist(ctx context.Context, playlistID string) (map[string
|
|||||||
|
|
||||||
total, _ := intValue(resp["tracks_count"])
|
total, _ := intValue(resp["tracks_count"])
|
||||||
if total <= pageLimit {
|
if total <= pageLimit {
|
||||||
|
normalizePlaylistImage(resp)
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
tracksObj, ok := mapValue(resp["tracks"])
|
tracksObj, ok := mapValue(resp["tracks"])
|
||||||
if !ok {
|
if !ok {
|
||||||
|
normalizePlaylistImage(resp)
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
items, ok := tracksObj["items"].([]any)
|
items, ok := tracksObj["items"].([]any)
|
||||||
@@ -617,9 +655,25 @@ func (c *Client) getPlaylist(ctx context.Context, playlistID string) (map[string
|
|||||||
|
|
||||||
tracksObj["items"] = items
|
tracksObj["items"] = items
|
||||||
resp["tracks"] = tracksObj
|
resp["tracks"] = tracksObj
|
||||||
|
normalizePlaylistImage(resp)
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func normalizePlaylistImage(resp map[string]any) {
|
||||||
|
if resp["image"] != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
rect, ok := resp["image_rectangle"].([]any)
|
||||||
|
if !ok || len(rect) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
url, ok := rect[0].(string)
|
||||||
|
if !ok || url == "" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp["image"] = map[string]any{"original": url, "large": url}
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Client) getLabel(ctx context.Context, labelID string) (map[string]any, error) {
|
func (c *Client) getLabel(ctx context.Context, labelID string) (map[string]any, error) {
|
||||||
pageLimit := 500
|
pageLimit := 500
|
||||||
params := url.Values{}
|
params := url.Values{}
|
||||||
|
|||||||
@@ -371,6 +371,24 @@ func TestGetDownloadableUsesReturnedURLExtension(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestQobuzAudioProfileUsesExactReturnedQuality(t *testing.T) {
|
||||||
|
profile := qobuzAudioProfile(map[string]any{
|
||||||
|
"format_id": float64(7),
|
||||||
|
"bit_depth": float64(24),
|
||||||
|
"sampling_rate": float64(44.1),
|
||||||
|
}, 4, "flac")
|
||||||
|
if profile.BitDepth != 24 || profile.SamplingRate != "44.1" || profile.Quality != "HI_RES" {
|
||||||
|
t.Fatalf("unexpected profile: %+v", profile)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestQobuzAudioProfileAvoidsGuessingHiResSampleRate(t *testing.T) {
|
||||||
|
profile := qobuzAudioProfile(map[string]any{"format_id": float64(7)}, 4, "flac")
|
||||||
|
if profile.BitDepth != 24 || profile.SamplingRate != "" || profile.Quality != "HI_RES" {
|
||||||
|
t.Fatalf("unexpected profile: %+v", profile)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func qobuzSecretSig(requestTS, secret string) string {
|
func qobuzSecretSig(requestTS, secret string) string {
|
||||||
raw := "trackgetFileUrlformat_id27intentstreamtrack_id19512574" + requestTS + secret
|
raw := "trackgetFileUrlformat_id27intentstreamtrack_id19512574" + requestTS + secret
|
||||||
hash := md5.Sum([]byte(raw))
|
hash := md5.Sum([]byte(raw))
|
||||||
|
|||||||
Reference in New Issue
Block a user