mirror of
https://git.sr.ht/~joren/streamrip-go
synced 2026-08-17 09:38:39 +02:00
fix: playlist cover art, compilation tag, and year
- ripPlaylist/ripTrackCollection: pre-fetch playlist artwork once, embed in all tracks - ripTrack: skip per-track album cover when playlist embed is provided - buildTagMetadata: set COMPILATION=1 and year from playlist publish_date - beatport: normalize playlistMetadata to include date fields for year extraction - qobuz: normalize playlist image_rectangle to standard image map
This commit is contained in:
@@ -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 {
|
||||
name := jsonutil.StringFromAny(raw["name"])
|
||||
return map[string]any{
|
||||
"id": jsonutil.StringFromAny(raw["id"]),
|
||||
"name": name,
|
||||
"title": name,
|
||||
"tracks_count": firstPositiveInt(jsonutil.IntFromAny(raw["track_count"]), len(tracks)),
|
||||
"image": imageMap(raw["image"]),
|
||||
"tracks": map[string]any{"items": tracks},
|
||||
"id": jsonutil.StringFromAny(raw["id"]),
|
||||
"name": name,
|
||||
"title": name,
|
||||
"tracks_count": firstPositiveInt(jsonutil.IntFromAny(raw["track_count"]), len(tracks)),
|
||||
"image": imageMap(raw["image"]),
|
||||
"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},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -613,11 +613,13 @@ func (c *Client) getPlaylist(ctx context.Context, playlistID string) (map[string
|
||||
|
||||
total, _ := intValue(resp["tracks_count"])
|
||||
if total <= pageLimit {
|
||||
normalizePlaylistImage(resp)
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
tracksObj, ok := mapValue(resp["tracks"])
|
||||
if !ok {
|
||||
normalizePlaylistImage(resp)
|
||||
return resp, nil
|
||||
}
|
||||
items, ok := tracksObj["items"].([]any)
|
||||
@@ -653,9 +655,25 @@ func (c *Client) getPlaylist(ctx context.Context, playlistID string) (map[string
|
||||
|
||||
tracksObj["items"] = items
|
||||
resp["tracks"] = tracksObj
|
||||
normalizePlaylistImage(resp)
|
||||
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) {
|
||||
pageLimit := 500
|
||||
params := url.Values{}
|
||||
|
||||
Reference in New Issue
Block a user