fix playlist dl
This commit is contained in:
parent
2373452bf2
commit
85629866b6
@ -14,6 +14,8 @@ atmos-max: 2768 #2768 2448
|
|||||||
#{AlbumId} {AlbumName} {ArtistName} {ReleaseDate} {ReleaseYear} {UPC} {Copyright} {Quality}
|
#{AlbumId} {AlbumName} {ArtistName} {ReleaseDate} {ReleaseYear} {UPC} {Copyright} {Quality}
|
||||||
#example: {ReleaseYear} - {ArtistName} - {AlbumName}({AlbumId})({UPC})({Copyright})
|
#example: {ReleaseYear} - {ArtistName} - {AlbumName}({AlbumId})({UPC})({Copyright})
|
||||||
album-folder-format: "{AlbumName}"
|
album-folder-format: "{AlbumName}"
|
||||||
|
#{PlaylistId} {PlaylistName} {ArtistName} {Quality}
|
||||||
|
playlist-folder-format: "{PlaylistName}"
|
||||||
#{SongId} {SongNumer} {SongName} {DiscNumber} {TrackNumber} {Quality}
|
#{SongId} {SongNumer} {SongName} {DiscNumber} {TrackNumber} {Quality}
|
||||||
#example: Disk {DiscNumber} - Track {TrackNumber} {SongName} [{Quality}]"
|
#example: Disk {DiscNumber} - Track {TrackNumber} {SongName} [{Quality}]"
|
||||||
song-file-format: "{SongNumer}. {SongName}"
|
song-file-format: "{SongNumer}. {SongName}"
|
||||||
|
47
main.go
47
main.go
@ -46,6 +46,7 @@ type Config struct {
|
|||||||
AlacSaveFolder string `yaml:"alac-save-folder"`
|
AlacSaveFolder string `yaml:"alac-save-folder"`
|
||||||
AtmosSaveFolder string `yaml:"atmos-save-folder"`
|
AtmosSaveFolder string `yaml:"atmos-save-folder"`
|
||||||
AlbumFolderFormat string `yaml:"album-folder-format"`
|
AlbumFolderFormat string `yaml:"album-folder-format"`
|
||||||
|
PlaylistFolderFormat string `yaml:"playlist-folder-format"`
|
||||||
ArtistFolderFormat string `yaml:"artist-folder-format"`
|
ArtistFolderFormat string `yaml:"artist-folder-format"`
|
||||||
SongFileFormat string `yaml:"song-file-format"`
|
SongFileFormat string `yaml:"song-file-format"`
|
||||||
ExplicitChoice string `yaml:"explicit-choice"`
|
ExplicitChoice string `yaml:"explicit-choice"`
|
||||||
@ -1163,10 +1164,18 @@ func rip(albumId string, token string, storefront string, userToken string) erro
|
|||||||
}
|
}
|
||||||
singerFolder:=""
|
singerFolder:=""
|
||||||
if config.ArtistFolderFormat != ""{
|
if config.ArtistFolderFormat != ""{
|
||||||
singerFoldername := strings.NewReplacer(
|
var singerFoldername string
|
||||||
"{ArtistName}", meta.Data[0].Attributes.ArtistName,
|
if strings.Contains(albumId, "pl.") {
|
||||||
"{ArtistId}", meta.Data[0].Relationships.Artists.Data[0].ID,
|
singerFoldername = strings.NewReplacer(
|
||||||
).Replace(config.ArtistFolderFormat)
|
"{ArtistName}", "Apple Music",
|
||||||
|
"{ArtistId}", "",
|
||||||
|
).Replace(config.ArtistFolderFormat)
|
||||||
|
}else{
|
||||||
|
singerFoldername = strings.NewReplacer(
|
||||||
|
"{ArtistName}", meta.Data[0].Attributes.ArtistName,
|
||||||
|
"{ArtistId}", meta.Data[0].Relationships.Artists.Data[0].ID,
|
||||||
|
).Replace(config.ArtistFolderFormat)
|
||||||
|
}
|
||||||
if strings.HasSuffix(singerFoldername, ".") {
|
if strings.HasSuffix(singerFoldername, ".") {
|
||||||
singerFoldername = strings.ReplaceAll(singerFoldername, ".", "")
|
singerFoldername = strings.ReplaceAll(singerFoldername, ".", "")
|
||||||
}
|
}
|
||||||
@ -1192,16 +1201,26 @@ func rip(albumId string, token string, storefront string, userToken string) erro
|
|||||||
fmt.Println("Failed to extract quality from manifest.\n", err)
|
fmt.Println("Failed to extract quality from manifest.\n", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
albumFolder := strings.NewReplacer(
|
var albumFolder string
|
||||||
"{ReleaseDate}", meta.Data[0].Attributes.ReleaseDate,
|
if strings.Contains(albumId, "pl.") {
|
||||||
"{ReleaseYear}", meta.Data[0].Attributes.ReleaseDate[:4],
|
albumFolder = strings.NewReplacer(
|
||||||
"{ArtistName}", meta.Data[0].Attributes.ArtistName,
|
"{ArtistName}", "Apple Music",
|
||||||
"{AlbumName}", meta.Data[0].Attributes.Name,
|
"{PlaylistName}", meta.Data[0].Attributes.Name,
|
||||||
"{UPC}", meta.Data[0].Attributes.Upc,
|
"{PlaylistId}", albumId,
|
||||||
"{Copyright}", meta.Data[0].Attributes.Copyright,
|
"{Quality}",Quality,
|
||||||
"{AlbumId}", albumId,
|
).Replace(config.PlaylistFolderFormat)
|
||||||
"{Quality}", Quality,
|
}else{
|
||||||
).Replace(config.AlbumFolderFormat)
|
albumFolder = strings.NewReplacer(
|
||||||
|
"{ReleaseDate}", meta.Data[0].Attributes.ReleaseDate,
|
||||||
|
"{ReleaseYear}", meta.Data[0].Attributes.ReleaseDate[:4],
|
||||||
|
"{ArtistName}", meta.Data[0].Attributes.ArtistName,
|
||||||
|
"{AlbumName}", meta.Data[0].Attributes.Name,
|
||||||
|
"{UPC}", meta.Data[0].Attributes.Upc,
|
||||||
|
"{Copyright}", meta.Data[0].Attributes.Copyright,
|
||||||
|
"{AlbumId}", albumId,
|
||||||
|
"{Quality}", Quality,
|
||||||
|
).Replace(config.AlbumFolderFormat)
|
||||||
|
}
|
||||||
if meta.Data[0].Attributes.IsMasteredForItunes{
|
if meta.Data[0].Attributes.IsMasteredForItunes{
|
||||||
if config.AppleMasterChoice != ""{
|
if config.AppleMasterChoice != ""{
|
||||||
albumFolder = fmt.Sprintf("%s %s", albumFolder,config.AppleMasterChoice)
|
albumFolder = fmt.Sprintf("%s %s", albumFolder,config.AppleMasterChoice)
|
||||||
|
@ -45,6 +45,7 @@ type Config struct {
|
|||||||
AlacSaveFolder string `yaml:"alac-save-folder"`
|
AlacSaveFolder string `yaml:"alac-save-folder"`
|
||||||
AtmosSaveFolder string `yaml:"atmos-save-folder"`
|
AtmosSaveFolder string `yaml:"atmos-save-folder"`
|
||||||
AlbumFolderFormat string `yaml:"album-folder-format"`
|
AlbumFolderFormat string `yaml:"album-folder-format"`
|
||||||
|
PlaylistFolderFormat string `yaml:"playlist-folder-format"`
|
||||||
ArtistFolderFormat string `yaml:"artist-folder-format"`
|
ArtistFolderFormat string `yaml:"artist-folder-format"`
|
||||||
SongFileFormat string `yaml:"song-file-format"`
|
SongFileFormat string `yaml:"song-file-format"`
|
||||||
ExplicitChoice string `yaml:"explicit-choice"`
|
ExplicitChoice string `yaml:"explicit-choice"`
|
||||||
@ -1123,10 +1124,18 @@ func rip(albumId string, token string, storefront string, userToken string) erro
|
|||||||
}
|
}
|
||||||
singerFolder:=""
|
singerFolder:=""
|
||||||
if config.ArtistFolderFormat != ""{
|
if config.ArtistFolderFormat != ""{
|
||||||
singerFoldername := strings.NewReplacer(
|
var singerFoldername string
|
||||||
"{ArtistName}", meta.Data[0].Attributes.ArtistName,
|
if strings.Contains(albumId, "pl.") {
|
||||||
"{ArtistId}", meta.Data[0].Relationships.Artists.Data[0].ID,
|
singerFoldername = strings.NewReplacer(
|
||||||
).Replace(config.ArtistFolderFormat)
|
"{ArtistName}", "Apple Music",
|
||||||
|
"{ArtistId}", "",
|
||||||
|
).Replace(config.ArtistFolderFormat)
|
||||||
|
}else{
|
||||||
|
singerFoldername = strings.NewReplacer(
|
||||||
|
"{ArtistName}", meta.Data[0].Attributes.ArtistName,
|
||||||
|
"{ArtistId}", meta.Data[0].Relationships.Artists.Data[0].ID,
|
||||||
|
).Replace(config.ArtistFolderFormat)
|
||||||
|
}
|
||||||
if strings.HasSuffix(singerFoldername, ".") {
|
if strings.HasSuffix(singerFoldername, ".") {
|
||||||
singerFoldername = strings.ReplaceAll(singerFoldername, ".", "")
|
singerFoldername = strings.ReplaceAll(singerFoldername, ".", "")
|
||||||
}
|
}
|
||||||
@ -1134,16 +1143,26 @@ func rip(albumId string, token string, storefront string, userToken string) erro
|
|||||||
fmt.Println(singerFoldername)
|
fmt.Println(singerFoldername)
|
||||||
singerFolder = filepath.Join(config.AlacSaveFolder, forbiddenNames.ReplaceAllString(singerFoldername, "_"))
|
singerFolder = filepath.Join(config.AlacSaveFolder, forbiddenNames.ReplaceAllString(singerFoldername, "_"))
|
||||||
}
|
}
|
||||||
albumFolder := strings.NewReplacer(
|
var albumFolder string
|
||||||
"{ReleaseDate}", meta.Data[0].Attributes.ReleaseDate,
|
if strings.Contains(albumId, "pl.") {
|
||||||
"{ReleaseYear}", meta.Data[0].Attributes.ReleaseDate[:4],
|
albumFolder = strings.NewReplacer(
|
||||||
"{ArtistName}", meta.Data[0].Attributes.ArtistName,
|
"{ArtistName}", "Apple Music",
|
||||||
"{AlbumName}", meta.Data[0].Attributes.Name,
|
"{PlaylistName}", meta.Data[0].Attributes.Name,
|
||||||
"{UPC}", meta.Data[0].Attributes.Upc,
|
"{PlaylistId}", albumId,
|
||||||
"{Copyright}", meta.Data[0].Attributes.Copyright,
|
"{Quality}","Atmos",
|
||||||
"{AlbumId}", albumId,
|
).Replace(config.PlaylistFolderFormat)
|
||||||
"{Quality}","",
|
}else{
|
||||||
).Replace(config.AlbumFolderFormat)
|
albumFolder = strings.NewReplacer(
|
||||||
|
"{ReleaseDate}", meta.Data[0].Attributes.ReleaseDate,
|
||||||
|
"{ReleaseYear}", meta.Data[0].Attributes.ReleaseDate[:4],
|
||||||
|
"{ArtistName}", meta.Data[0].Attributes.ArtistName,
|
||||||
|
"{AlbumName}", meta.Data[0].Attributes.Name,
|
||||||
|
"{UPC}", meta.Data[0].Attributes.Upc,
|
||||||
|
"{Copyright}", meta.Data[0].Attributes.Copyright,
|
||||||
|
"{AlbumId}", albumId,
|
||||||
|
"{Quality}","Atmos",
|
||||||
|
).Replace(config.AlbumFolderFormat)
|
||||||
|
}
|
||||||
if meta.Data[0].Attributes.IsMasteredForItunes{
|
if meta.Data[0].Attributes.IsMasteredForItunes{
|
||||||
if config.AppleMasterChoice != ""{
|
if config.AppleMasterChoice != ""{
|
||||||
albumFolder = fmt.Sprintf("%s %s", albumFolder,config.AppleMasterChoice)
|
albumFolder = fmt.Sprintf("%s %s", albumFolder,config.AppleMasterChoice)
|
||||||
@ -1159,7 +1178,6 @@ func rip(albumId string, token string, storefront string, userToken string) erro
|
|||||||
albumFolder = fmt.Sprintf("%s %s", albumFolder,config.CleanChoice)
|
albumFolder = fmt.Sprintf("%s %s", albumFolder,config.CleanChoice)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
albumFolder = fmt.Sprintf("%s [Atmos]", albumFolder)
|
|
||||||
if strings.HasSuffix(albumFolder, ".") {
|
if strings.HasSuffix(albumFolder, ".") {
|
||||||
albumFolder = strings.ReplaceAll(albumFolder, ".", "")
|
albumFolder = strings.ReplaceAll(albumFolder, ".", "")
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ type Config struct {
|
|||||||
AlacSaveFolder string `yaml:"alac-save-folder"`
|
AlacSaveFolder string `yaml:"alac-save-folder"`
|
||||||
AtmosSaveFolder string `yaml:"atmos-save-folder"`
|
AtmosSaveFolder string `yaml:"atmos-save-folder"`
|
||||||
AlbumFolderFormat string `yaml:"album-folder-format"`
|
AlbumFolderFormat string `yaml:"album-folder-format"`
|
||||||
|
PlaylistFolderFormat string `yaml:"playlist-folder-format"`
|
||||||
ArtistFolderFormat string `yaml:"artist-folder-format"`
|
ArtistFolderFormat string `yaml:"artist-folder-format"`
|
||||||
SongFileFormat string `yaml:"song-file-format"`
|
SongFileFormat string `yaml:"song-file-format"`
|
||||||
ExplicitChoice string `yaml:"explicit-choice"`
|
ExplicitChoice string `yaml:"explicit-choice"`
|
||||||
@ -1126,10 +1127,18 @@ func rip(albumId string, token string, storefront string, userToken string) erro
|
|||||||
}
|
}
|
||||||
singerFolder:=""
|
singerFolder:=""
|
||||||
if config.ArtistFolderFormat != ""{
|
if config.ArtistFolderFormat != ""{
|
||||||
singerFoldername := strings.NewReplacer(
|
var singerFoldername string
|
||||||
"{ArtistName}", meta.Data[0].Attributes.ArtistName,
|
if strings.Contains(albumId, "pl.") {
|
||||||
"{ArtistId}", meta.Data[0].Relationships.Artists.Data[0].ID,
|
singerFoldername = strings.NewReplacer(
|
||||||
).Replace(config.ArtistFolderFormat)
|
"{ArtistName}", "Apple Music",
|
||||||
|
"{ArtistId}", "",
|
||||||
|
).Replace(config.ArtistFolderFormat)
|
||||||
|
}else{
|
||||||
|
singerFoldername = strings.NewReplacer(
|
||||||
|
"{ArtistName}", meta.Data[0].Attributes.ArtistName,
|
||||||
|
"{ArtistId}", meta.Data[0].Relationships.Artists.Data[0].ID,
|
||||||
|
).Replace(config.ArtistFolderFormat)
|
||||||
|
}
|
||||||
if strings.HasSuffix(singerFoldername, ".") {
|
if strings.HasSuffix(singerFoldername, ".") {
|
||||||
singerFoldername = strings.ReplaceAll(singerFoldername, ".", "")
|
singerFoldername = strings.ReplaceAll(singerFoldername, ".", "")
|
||||||
}
|
}
|
||||||
@ -1137,16 +1146,26 @@ func rip(albumId string, token string, storefront string, userToken string) erro
|
|||||||
fmt.Println(singerFoldername)
|
fmt.Println(singerFoldername)
|
||||||
singerFolder = filepath.Join(config.AlacSaveFolder, forbiddenNames.ReplaceAllString(singerFoldername, "_"))
|
singerFolder = filepath.Join(config.AlacSaveFolder, forbiddenNames.ReplaceAllString(singerFoldername, "_"))
|
||||||
}
|
}
|
||||||
albumFolder := strings.NewReplacer(
|
var albumFolder string
|
||||||
"{ReleaseDate}", meta.Data[0].Attributes.ReleaseDate,
|
if strings.Contains(albumId, "pl.") {
|
||||||
"{ReleaseYear}", meta.Data[0].Attributes.ReleaseDate[:4],
|
albumFolder = strings.NewReplacer(
|
||||||
"{ArtistName}", meta.Data[0].Attributes.ArtistName,
|
"{ArtistName}", "Apple Music",
|
||||||
"{AlbumName}", meta.Data[0].Attributes.Name,
|
"{PlaylistName}", meta.Data[0].Attributes.Name,
|
||||||
"{UPC}", meta.Data[0].Attributes.Upc,
|
"{PlaylistId}", albumId,
|
||||||
"{Copyright}", meta.Data[0].Attributes.Copyright,
|
"{Quality}","",
|
||||||
"{AlbumId}", albumId,
|
).Replace(config.PlaylistFolderFormat)
|
||||||
"{Quality}","",
|
}else{
|
||||||
).Replace(config.AlbumFolderFormat)
|
albumFolder = strings.NewReplacer(
|
||||||
|
"{ReleaseDate}", meta.Data[0].Attributes.ReleaseDate,
|
||||||
|
"{ReleaseYear}", meta.Data[0].Attributes.ReleaseDate[:4],
|
||||||
|
"{ArtistName}", meta.Data[0].Attributes.ArtistName,
|
||||||
|
"{AlbumName}", meta.Data[0].Attributes.Name,
|
||||||
|
"{UPC}", meta.Data[0].Attributes.Upc,
|
||||||
|
"{Copyright}", meta.Data[0].Attributes.Copyright,
|
||||||
|
"{AlbumId}", albumId,
|
||||||
|
"{Quality}", "",
|
||||||
|
).Replace(config.AlbumFolderFormat)
|
||||||
|
}
|
||||||
if meta.Data[0].Attributes.IsMasteredForItunes{
|
if meta.Data[0].Attributes.IsMasteredForItunes{
|
||||||
if config.AppleMasterChoice != ""{
|
if config.AppleMasterChoice != ""{
|
||||||
albumFolder = fmt.Sprintf("%s %s", albumFolder,config.AppleMasterChoice)
|
albumFolder = fmt.Sprintf("%s %s", albumFolder,config.AppleMasterChoice)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user