fix playlist not have tag

This commit is contained in:
zhaarey 2025-01-13 18:00:20 +08:00
parent 42c0aa0e5a
commit 33502a5975

25
main.go
View File

@ -815,10 +815,6 @@ func rip(albumId string, token string, storefront string, userToken string) erro
func writeMP4Tags(trackPath string, meta *structs.AutoGenerated, trackNum, trackTotal int) error {
index := trackNum - 1
albumID, err := strconv.ParseUint(meta.Data[0].ID, 10, 32)
if err != nil {
return err
}
t := &mp4tag.MP4Tags{
Title: meta.Data[0].Relationships.Tracks.Data[index].Attributes.Name,
@ -835,13 +831,20 @@ func writeMP4Tags(trackPath string, meta *structs.AutoGenerated, trackNum, track
"LABEL": meta.Data[0].Attributes.RecordLabel,
"UPC": meta.Data[0].Attributes.Upc,
},
ItunesAlbumID: int32(albumID),
Composer: meta.Data[0].Relationships.Tracks.Data[index].Attributes.ComposerName,
ComposerSort: meta.Data[0].Relationships.Tracks.Data[index].Attributes.ComposerName,
Date: meta.Data[0].Attributes.ReleaseDate,
CustomGenre: meta.Data[0].Relationships.Tracks.Data[index].Attributes.GenreNames[0],
Copyright: meta.Data[0].Attributes.Copyright,
Publisher: meta.Data[0].Attributes.RecordLabel,
Composer: meta.Data[0].Relationships.Tracks.Data[index].Attributes.ComposerName,
ComposerSort: meta.Data[0].Relationships.Tracks.Data[index].Attributes.ComposerName,
Date: meta.Data[0].Attributes.ReleaseDate,
CustomGenre: meta.Data[0].Relationships.Tracks.Data[index].Attributes.GenreNames[0],
Copyright: meta.Data[0].Attributes.Copyright,
Publisher: meta.Data[0].Attributes.RecordLabel,
}
if !strings.Contains(meta.Data[0].ID, "pl.") {
albumID, err := strconv.ParseUint(meta.Data[0].ID, 10, 32)
if err != nil {
return err
}
t.ItunesAlbumID = int32(albumID)
}
if len(meta.Data[0].Relationships.Artists.Data) > 0 {