feat: improve metadata implementation for track

This commit is contained in:
2026-02-17 11:18:53 +01:00
parent 5b557f1b1f
commit 1504e29919
4 changed files with 140 additions and 50 deletions

115
lib/types.go Normal file
View File

@@ -0,0 +1,115 @@
package lib
import "time"
type Copyright struct {
Items []map[string]interface{} `json:"items"`
TotalCount int64 `json:"totalCount"`
}
type ColorRaw struct {
Hex string `json:"hex"`
}
type ExtractedColors struct {
ColorRaw ColorRaw `json:"colorRaw"`
}
type CoverArt struct {
ExtractedColors ExtractedColors `json:"extractedColors"`
Sources []map[string]interface{} `json:"sources"`
}
type Date struct {
IsoString time.Time `json:"isoString"`
Precision string `json:"precision"`
Year int64 `json:"year"`
}
type SharingInfo struct {
ShareId string `json:"shareId"`
ShareUrl string `json:"shareUrl"`
}
type Tracks struct {
Items []map[string]interface{} `json:"items"`
TotalCount int64 `json:"totalCount"`
}
type AlbumOfTrack struct {
Copyright Copyright `json:"copyright"`
CourtesyLine string `json:"courtesyLine"`
CoverArt CoverArt `json:"coverArt"`
Date Date `json:"date"`
Id string `json:"id"`
Name string `json:"name"`
Playability Playability `json:"playability"`
SharingInfo SharingInfo `json:"sharingInfo"`
Tracks Tracks `json:"tracks"`
Type string `json:"type"`
Uri string `json:"uri"`
}
type AudioAssociations struct {
TypeName string `json:"__typename"`
Items []interface{} `json:"items"`
}
type VideoAssociations struct {
TotalCount int64 `json:"totalCount"`
}
type AssociationsV3 struct {
AudioAssociations AudioAssociations `json:"audioAssociations"`
VideoAssociations VideoAssociations `json:"videoAssociations"`
}
type ContentRating struct {
Label string `json:"label"`
}
type Duration struct {
TotalMilliseconds int64 `json:"totalMilliseconds"`
}
type FirstArtist struct {
Items []map[string]interface{} `json:"items"`
TotalCount int64 `json:"totalCount"`
}
type OtherArtists struct {
Items []interface{} `json:"items"`
}
type Playability struct {
Playable bool `json:"playable"`
Reason string `json:"reason"`
}
type TrackUnion struct {
TypeName string `json:"__typename"`
AlbumOfTrack AlbumOfTrack `json:"albumOfTrack"`
AssociationsV3 AssociationsV3 `json:"associationsV3"`
ContentRating ContentRating `json:"contentRating"`
Duration Duration `json:"duration"`
FirstArtist FirstArtist `json:"firstArtist"`
Id string `json:"id"`
MediaType string `json:"mediaType"`
Name string `json:"name"`
OtherArtists OtherArtists `json:"otherArtists"`
Playability Playability `json:"playability"`
Playcount string `json:"playcount"`
Saved bool `json:"saved"`
SharingInfo interface{} `json:"sharingInfo"`
TrackNumber int64 `json:"trackNumber"`
Uri string `json:"uri"`
VisualIdentity interface{} `json:"visualIdentity"`
}
type Data struct {
TrackUnion TrackUnion `json:"trackUnion"`
}
type TrackMetadata struct {
Data Data `json:"data"`
}