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