Skip to content

Commit

Permalink
fix Various Artists
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaarey committed Jun 12, 2024
1 parent 76e2693 commit b2bf894
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1300,11 +1300,16 @@ func rip(albumId string, token string, storefront string, userToken string) erro
"{ArtistName}", "Apple Music",
"{ArtistId}", "",
).Replace(config.ArtistFolderFormat)
} else {
} else if len(meta.Data[0].Relationships.Artists.Data) > 0 {
singerFoldername = strings.NewReplacer(
"{ArtistName}", meta.Data[0].Attributes.ArtistName,
"{ArtistId}", meta.Data[0].Relationships.Artists.Data[0].ID,
).Replace(config.ArtistFolderFormat)
} else {
singerFoldername = strings.NewReplacer(
"{ArtistName}", meta.Data[0].Attributes.ArtistName,
"{ArtistId}", "",
).Replace(config.ArtistFolderFormat)
}
if strings.HasSuffix(singerFoldername, ".") {
singerFoldername = strings.ReplaceAll(singerFoldername, ".", "")
Expand Down
7 changes: 6 additions & 1 deletion main_atmos.go
Original file line number Diff line number Diff line change
Expand Up @@ -1246,11 +1246,16 @@ func rip(albumId string, token string, storefront string, userToken string) erro
"{ArtistName}", "Apple Music",
"{ArtistId}", "",
).Replace(config.ArtistFolderFormat)
} else {
} else if len(meta.Data[0].Relationships.Artists.Data) > 0 {
singerFoldername = strings.NewReplacer(
"{ArtistName}", meta.Data[0].Attributes.ArtistName,
"{ArtistId}", meta.Data[0].Relationships.Artists.Data[0].ID,
).Replace(config.ArtistFolderFormat)
} else {
singerFoldername = strings.NewReplacer(
"{ArtistName}", meta.Data[0].Attributes.ArtistName,
"{ArtistId}", "",
).Replace(config.ArtistFolderFormat)
}
if strings.HasSuffix(singerFoldername, ".") {
singerFoldername = strings.ReplaceAll(singerFoldername, ".", "")
Expand Down
7 changes: 6 additions & 1 deletion main_select.go
Original file line number Diff line number Diff line change
Expand Up @@ -1191,11 +1191,16 @@ func rip(albumId string, token string, storefront string, userToken string) erro
"{ArtistName}", "Apple Music",
"{ArtistId}", "",
).Replace(config.ArtistFolderFormat)
} else {
} else if len(meta.Data[0].Relationships.Artists.Data) > 0 {
singerFoldername = strings.NewReplacer(
"{ArtistName}", meta.Data[0].Attributes.ArtistName,
"{ArtistId}", meta.Data[0].Relationships.Artists.Data[0].ID,
).Replace(config.ArtistFolderFormat)
} else {
singerFoldername = strings.NewReplacer(
"{ArtistName}", meta.Data[0].Attributes.ArtistName,
"{ArtistId}", "",
).Replace(config.ArtistFolderFormat)
}
if strings.HasSuffix(singerFoldername, ".") {
singerFoldername = strings.ReplaceAll(singerFoldername, ".", "")
Expand Down

0 comments on commit b2bf894

Please sign in to comment.