mirror of
https://github.com/zhaarey/apple-music-downloader.git
synced 2025-10-23 15:11:05 +00:00
correct AlbumArtist for playlist
This commit is contained in:
18
main.go
18
main.go
@@ -318,7 +318,7 @@ func checkArtist(artistUrl string, token string, relationship string) ([]string,
|
||||
|
||||
func getMeta(albumId string, token string, storefront string) (*structs.AutoGenerated, error) {
|
||||
var mtype string
|
||||
var page int
|
||||
var next string
|
||||
if strings.Contains(albumId, "pl.") {
|
||||
mtype = "playlists"
|
||||
} else {
|
||||
@@ -334,7 +334,7 @@ func getMeta(albumId string, token string, storefront string) (*structs.AutoGene
|
||||
query := url.Values{}
|
||||
query.Set("omit[resource]", "autos")
|
||||
query.Set("include", "tracks,artists,record-labels")
|
||||
query.Set("include[songs]", "artists")
|
||||
query.Set("include[songs]", "artists,albums")
|
||||
query.Set("fields[artists]", "name,artwork")
|
||||
query.Set("fields[albums:albums]", "artistName,artwork,name,releaseDate,url")
|
||||
query.Set("fields[record-labels]", "name")
|
||||
@@ -357,11 +357,9 @@ func getMeta(albumId string, token string, storefront string) (*structs.AutoGene
|
||||
if strings.Contains(albumId, "pl.") {
|
||||
obj.Data[0].Attributes.ArtistName = "Apple Music"
|
||||
if len(obj.Data[0].Relationships.Tracks.Next) > 0 {
|
||||
page = 0
|
||||
next = obj.Data[0].Relationships.Tracks.Next
|
||||
for {
|
||||
page = page + 100
|
||||
pageStr := strconv.Itoa(page)
|
||||
req, err := http.NewRequest("GET", fmt.Sprintf("https://amp-api.music.apple.com/v1/catalog/%s/%s/%s/tracks?offset=%s&l=%s", storefront, mtype, albumId, pageStr, Config.Language), nil)
|
||||
req, err := http.NewRequest("GET", fmt.Sprintf("https://amp-api.music.apple.com/%s&l=%s&include=albums", next, Config.Language), nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -384,7 +382,8 @@ func getMeta(albumId string, token string, storefront string) (*structs.AutoGene
|
||||
for _, value := range obj2.Data {
|
||||
obj.Data[0].Relationships.Tracks.Data = append(obj.Data[0].Relationships.Tracks.Data, value)
|
||||
}
|
||||
if len(obj2.Next) == 0 {
|
||||
next = obj2.Next
|
||||
if len(next) == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -1123,8 +1122,8 @@ func writeMP4Tags(trackPath, lrc string, meta *structs.AutoGenerated, trackNum,
|
||||
t.TrackTotal = int16(trackTotal)
|
||||
t.Album = meta.Data[0].Relationships.Tracks.Data[index].Attributes.AlbumName
|
||||
t.AlbumSort = meta.Data[0].Relationships.Tracks.Data[index].Attributes.AlbumName
|
||||
t.AlbumArtist = meta.Data[0].Relationships.Tracks.Data[index].Attributes.ArtistName
|
||||
t.AlbumArtistSort = meta.Data[0].Relationships.Tracks.Data[index].Attributes.ArtistName
|
||||
t.AlbumArtist = meta.Data[0].Relationships.Tracks.Data[index].Relationships.Albums.Data[0].Attributes.ArtistName
|
||||
t.AlbumArtistSort = meta.Data[0].Relationships.Tracks.Data[index].Relationships.Albums.Data[0].Attributes.ArtistName
|
||||
} else {
|
||||
t.DiscNumber = int16(meta.Data[0].Relationships.Tracks.Data[index].Attributes.DiscNumber)
|
||||
t.DiscTotal = int16(meta.Data[0].Relationships.Tracks.Data[trackTotal-1].Attributes.DiscNumber)
|
||||
@@ -1526,7 +1525,6 @@ func extractMvAudio(c string) (string, error) {
|
||||
return audioStreams[0].URL, nil
|
||||
}
|
||||
|
||||
|
||||
func checkM3u8(b string, f string) (string, error) {
|
||||
var EnhancedHls string
|
||||
if Config.GetM3u8FromDevice {
|
||||
|
||||
Reference in New Issue
Block a user