fix apple master tag
This commit is contained in:
parent
5f528e76a9
commit
fa02c77ff8
7
main.go
7
main.go
@ -5,7 +5,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"gopkg.in/yaml.v2"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
@ -23,6 +22,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"gopkg.in/yaml.v2"
|
||||||
|
|
||||||
"github.com/abema/go-mp4"
|
"github.com/abema/go-mp4"
|
||||||
"github.com/beevik/etree"
|
"github.com/beevik/etree"
|
||||||
"github.com/grafov/m3u8"
|
"github.com/grafov/m3u8"
|
||||||
@ -36,6 +37,7 @@ const (
|
|||||||
var (
|
var (
|
||||||
forbiddenNames = regexp.MustCompile(`[/\\<>:"|?*]`)
|
forbiddenNames = regexp.MustCompile(`[/\\<>:"|?*]`)
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
MediaUserToken string `yaml:"media-user-token"`
|
MediaUserToken string `yaml:"media-user-token"`
|
||||||
SaveLrcFile bool `yaml:"save-lrc-file"`
|
SaveLrcFile bool `yaml:"save-lrc-file"`
|
||||||
@ -76,6 +78,7 @@ type SongInfo struct {
|
|||||||
alacParam *Alac
|
alacParam *Alac
|
||||||
samples []SampleInfo
|
samples []SampleInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadConfig() error {
|
func loadConfig() error {
|
||||||
// 读取config.yaml文件内容
|
// 读取config.yaml文件内容
|
||||||
data, err := ioutil.ReadFile("config.yaml")
|
data, err := ioutil.ReadFile("config.yaml")
|
||||||
@ -1217,7 +1220,7 @@ func rip(albumId string, token string, storefront string, userToken string) erro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stringsToJoin := []string{}
|
stringsToJoin := []string{}
|
||||||
if meta.Data[0].Attributes.IsAppleDigitalMaster{
|
if meta.Data[0].Attributes.IsAppleDigitalMaster || meta.Data[0].Attributes.IsMasteredForItunes {
|
||||||
if config.AppleMasterChoice != "" {
|
if config.AppleMasterChoice != "" {
|
||||||
stringsToJoin = append(stringsToJoin, config.AppleMasterChoice)
|
stringsToJoin = append(stringsToJoin, config.AppleMasterChoice)
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,8 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"gopkg.in/yaml.v2"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/beevik/etree"
|
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math"
|
"math"
|
||||||
@ -23,6 +21,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/beevik/etree"
|
||||||
|
"gopkg.in/yaml.v2"
|
||||||
|
|
||||||
"github.com/abema/go-mp4"
|
"github.com/abema/go-mp4"
|
||||||
"github.com/grafov/m3u8"
|
"github.com/grafov/m3u8"
|
||||||
)
|
)
|
||||||
@ -35,6 +36,7 @@ const (
|
|||||||
var (
|
var (
|
||||||
forbiddenNames = regexp.MustCompile(`[/\\<>:"|?*]`)
|
forbiddenNames = regexp.MustCompile(`[/\\<>:"|?*]`)
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
MediaUserToken string `yaml:"media-user-token"`
|
MediaUserToken string `yaml:"media-user-token"`
|
||||||
SaveLrcFile bool `yaml:"save-lrc-file"`
|
SaveLrcFile bool `yaml:"save-lrc-file"`
|
||||||
@ -1145,7 +1147,7 @@ func rip(albumId string, token string, storefront string, userToken string) erro
|
|||||||
}
|
}
|
||||||
singerFolder := filepath.Join(config.AtmosSaveFolder, forbiddenNames.ReplaceAllString(singerFoldername, "_"))
|
singerFolder := filepath.Join(config.AtmosSaveFolder, forbiddenNames.ReplaceAllString(singerFoldername, "_"))
|
||||||
stringsToJoin := []string{}
|
stringsToJoin := []string{}
|
||||||
if meta.Data[0].Attributes.IsAppleDigitalMaster{
|
if meta.Data[0].Attributes.IsAppleDigitalMaster || meta.Data[0].Attributes.IsMasteredForItunes {
|
||||||
if config.AppleMasterChoice != "" {
|
if config.AppleMasterChoice != "" {
|
||||||
stringsToJoin = append(stringsToJoin, config.AppleMasterChoice)
|
stringsToJoin = append(stringsToJoin, config.AppleMasterChoice)
|
||||||
}
|
}
|
||||||
@ -1179,7 +1181,6 @@ func rip(albumId string, token string, storefront string, userToken string) erro
|
|||||||
"{ArtistName}", meta.Data[0].Attributes.ArtistName,
|
"{ArtistName}", meta.Data[0].Attributes.ArtistName,
|
||||||
"{AlbumName}", meta.Data[0].Attributes.Name,
|
"{AlbumName}", meta.Data[0].Attributes.Name,
|
||||||
"{UPC}", meta.Data[0].Attributes.Upc,
|
"{UPC}", meta.Data[0].Attributes.Upc,
|
||||||
"{RecordLabel}", meta.Data[0].Attributes.RecordLabel,
|
|
||||||
"{Copyright}", meta.Data[0].Attributes.Copyright,
|
"{Copyright}", meta.Data[0].Attributes.Copyright,
|
||||||
"{AlbumId}", albumId,
|
"{AlbumId}", albumId,
|
||||||
"{Quality}", Quality,
|
"{Quality}", Quality,
|
||||||
|
@ -5,10 +5,8 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"gopkg.in/yaml.v2"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/beevik/etree"
|
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math"
|
"math"
|
||||||
@ -24,6 +22,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/beevik/etree"
|
||||||
|
"gopkg.in/yaml.v2"
|
||||||
|
|
||||||
"github.com/abema/go-mp4"
|
"github.com/abema/go-mp4"
|
||||||
"github.com/grafov/m3u8"
|
"github.com/grafov/m3u8"
|
||||||
)
|
)
|
||||||
@ -36,6 +37,7 @@ const (
|
|||||||
var (
|
var (
|
||||||
forbiddenNames = regexp.MustCompile(`[/\\<>:"|?*]`)
|
forbiddenNames = regexp.MustCompile(`[/\\<>:"|?*]`)
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
MediaUserToken string `yaml:"media-user-token"`
|
MediaUserToken string `yaml:"media-user-token"`
|
||||||
SaveLrcFile bool `yaml:"save-lrc-file"`
|
SaveLrcFile bool `yaml:"save-lrc-file"`
|
||||||
@ -1203,7 +1205,7 @@ 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, "_"))
|
||||||
stringsToJoin := []string{}
|
stringsToJoin := []string{}
|
||||||
if meta.Data[0].Attributes.IsAppleDigitalMaster{
|
if meta.Data[0].Attributes.IsAppleDigitalMaster || meta.Data[0].Attributes.IsMasteredForItunes {
|
||||||
if config.AppleMasterChoice != "" {
|
if config.AppleMasterChoice != "" {
|
||||||
stringsToJoin = append(stringsToJoin, config.AppleMasterChoice)
|
stringsToJoin = append(stringsToJoin, config.AppleMasterChoice)
|
||||||
}
|
}
|
||||||
@ -1250,7 +1252,6 @@ func rip(albumId string, token string, storefront string, userToken string) erro
|
|||||||
"{ArtistName}", meta.Data[0].Attributes.ArtistName,
|
"{ArtistName}", meta.Data[0].Attributes.ArtistName,
|
||||||
"{AlbumName}", meta.Data[0].Attributes.Name,
|
"{AlbumName}", meta.Data[0].Attributes.Name,
|
||||||
"{UPC}", meta.Data[0].Attributes.Upc,
|
"{UPC}", meta.Data[0].Attributes.Upc,
|
||||||
"{RecordLabel}", meta.Data[0].Attributes.RecordLabel,
|
|
||||||
"{Copyright}", meta.Data[0].Attributes.Copyright,
|
"{Copyright}", meta.Data[0].Attributes.Copyright,
|
||||||
"{AlbumId}", albumId,
|
"{AlbumId}", albumId,
|
||||||
"{Quality}", Quality,
|
"{Quality}", Quality,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user