fix
This commit is contained in:
parent
85629866b6
commit
01a8beecaf
@ -25,3 +25,5 @@ artist-folder-format: "{ArtistName}"
|
||||
explicit-choice : "[E]"
|
||||
clean-choice : "[C]"
|
||||
apple-master-choice : "[M]"
|
||||
#if set true,Quality will change to [ALAC 24B-96.0kHz] [Atmos 768kbps]
|
||||
add-codec: false
|
||||
|
8
main.go
8
main.go
@ -56,6 +56,7 @@ type Config struct {
|
||||
Check string `yaml:"check"`
|
||||
GetM3u8FromDevice bool `yaml:"get-m3u8-from-device"`
|
||||
AlacMax int `yaml:"alac-max"`
|
||||
AddCodec bool `yaml:"add-codec"`
|
||||
}
|
||||
|
||||
var config Config
|
||||
@ -1200,6 +1201,9 @@ func rip(albumId string, token string, storefront string, userToken string) erro
|
||||
if err != nil {
|
||||
fmt.Println("Failed to extract quality from manifest.\n", err)
|
||||
}
|
||||
if config.AddCodec{
|
||||
Quality=fmt.Sprintf("ALAC %s", Quality)
|
||||
}
|
||||
}
|
||||
var albumFolder string
|
||||
if strings.Contains(albumId, "pl.") {
|
||||
@ -1272,8 +1276,10 @@ func rip(albumId string, token string, storefront string, userToken string) erro
|
||||
fmt.Println("Failed to extract quality from manifest.\n", err)
|
||||
continue
|
||||
}
|
||||
if config.AddCodec{
|
||||
Quality=fmt.Sprintf("ALAC %s", Quality)
|
||||
}
|
||||
}
|
||||
|
||||
songName := strings.NewReplacer(
|
||||
"{SongId}", track.ID,
|
||||
"{SongNumer}", fmt.Sprintf("%02d", trackNum),
|
||||
|
@ -52,6 +52,7 @@ type Config struct {
|
||||
CleanChoice string `yaml:"clean-choice"`
|
||||
AppleMasterChoice string `yaml:"apple-master-choice"`
|
||||
AtmosMax int `yaml:"atmos-max"`
|
||||
AddCodec bool `yaml:"add-codec"`
|
||||
}
|
||||
|
||||
var config Config
|
||||
@ -1144,12 +1145,16 @@ func rip(albumId string, token string, storefront string, userToken string) erro
|
||||
singerFolder = filepath.Join(config.AlacSaveFolder, forbiddenNames.ReplaceAllString(singerFoldername, "_"))
|
||||
}
|
||||
var albumFolder string
|
||||
Quality:=fmt.Sprintf("%dkbps", config.AtmosMax-2000)
|
||||
if config.AddCodec{
|
||||
Quality=fmt.Sprintf("Atmos %dkbps", config.AtmosMax-2000)
|
||||
}
|
||||
if strings.Contains(albumId, "pl.") {
|
||||
albumFolder = strings.NewReplacer(
|
||||
"{ArtistName}", "Apple Music",
|
||||
"{PlaylistName}", meta.Data[0].Attributes.Name,
|
||||
"{PlaylistId}", albumId,
|
||||
"{Quality}","Atmos",
|
||||
"{Quality}",Quality,
|
||||
).Replace(config.PlaylistFolderFormat)
|
||||
}else{
|
||||
albumFolder = strings.NewReplacer(
|
||||
@ -1160,7 +1165,7 @@ func rip(albumId string, token string, storefront string, userToken string) erro
|
||||
"{UPC}", meta.Data[0].Attributes.Upc,
|
||||
"{Copyright}", meta.Data[0].Attributes.Copyright,
|
||||
"{AlbumId}", albumId,
|
||||
"{Quality}","Atmos",
|
||||
"{Quality}",Quality,
|
||||
).Replace(config.AlbumFolderFormat)
|
||||
}
|
||||
if meta.Data[0].Attributes.IsMasteredForItunes{
|
||||
@ -1209,7 +1214,7 @@ func rip(albumId string, token string, storefront string, userToken string) erro
|
||||
"{SongName}", track.Attributes.Name,
|
||||
"{DiscNumber}", string(track.Attributes.DiscNumber),
|
||||
"{TrackNumber}", fmt.Sprintf("%02d", track.Attributes.TrackNumber),
|
||||
"{Quality}","",
|
||||
"{Quality}",Quality,
|
||||
).Replace(config.SongFileFormat)
|
||||
if track.Attributes.IsAppleDigitalMaster{
|
||||
if config.AppleMasterChoice != ""{
|
||||
|
@ -1152,7 +1152,7 @@ func rip(albumId string, token string, storefront string, userToken string) erro
|
||||
"{ArtistName}", "Apple Music",
|
||||
"{PlaylistName}", meta.Data[0].Attributes.Name,
|
||||
"{PlaylistId}", albumId,
|
||||
"{Quality}","",
|
||||
"{Quality}","ALAC",
|
||||
).Replace(config.PlaylistFolderFormat)
|
||||
}else{
|
||||
albumFolder = strings.NewReplacer(
|
||||
@ -1163,7 +1163,7 @@ func rip(albumId string, token string, storefront string, userToken string) erro
|
||||
"{UPC}", meta.Data[0].Attributes.Upc,
|
||||
"{Copyright}", meta.Data[0].Attributes.Copyright,
|
||||
"{AlbumId}", albumId,
|
||||
"{Quality}", "",
|
||||
"{Quality}", "ALAC",
|
||||
).Replace(config.AlbumFolderFormat)
|
||||
}
|
||||
if meta.Data[0].Attributes.IsMasteredForItunes{
|
||||
|
Loading…
x
Reference in New Issue
Block a user