.upc metadata

This commit is contained in:
afkarxyz
2026-04-13 22:39:58 +07:00
parent 66e3f0e572
commit 5a3f819cef
9 changed files with 355 additions and 51 deletions
+12
View File
@@ -87,6 +87,17 @@ func GetSpotifyDataWithAPI(ctx context.Context, spotifyURL string, useAPI bool,
if err := json.Unmarshal(bodyBytes, &trackResp); err != nil {
return nil, fmt.Errorf("failed to decode track response: %w", err)
}
trackID := strings.TrimSpace(trackResp.Track.SpotifyID)
if trackID == "" {
trackID = strings.TrimSpace(id)
}
if trackID != "" {
if identifiers, _, err := lookupSpotifyTrackIdentifiersViaSpotFetchAPI(trackID, apiBaseURL); err == nil {
if identifiers.UPC != "" {
trackResp.Track.UPC = identifiers.UPC
}
}
}
data = trackResp
case "album":
var albumResp AlbumResponsePayload
@@ -156,6 +167,7 @@ func GetSpotifyDataWithAPI(ctx context.Context, spotifyURL string, useAPI bool,
DiscNumber: t.DiscNumber,
TotalDiscs: t.TotalDiscs,
ExternalURL: t.ExternalURL,
UPC: t.UPC,
Plays: t.Plays,
PreviewURL: t.PreviewURL,
IsExplicit: t.IsExplicit,