add get-m3u8-mode
This commit is contained in:
parent
433c96200d
commit
4e04d960c3
@ -16,6 +16,8 @@ force-api: false
|
|||||||
decrypt-m3u8-port: "127.0.0.1:10020"
|
decrypt-m3u8-port: "127.0.0.1:10020"
|
||||||
get-m3u8-port: "127.0.0.1:20020"
|
get-m3u8-port: "127.0.0.1:20020"
|
||||||
get-m3u8-from-device: true
|
get-m3u8-from-device: true
|
||||||
|
#set 'all' to retrieve all m3u8, and set 'hires' to only detect hires m3u8.
|
||||||
|
get-m3u8-mode: hires # all hires
|
||||||
alac-max: 192000 #192000 96000 48000 44100
|
alac-max: 192000 #192000 96000 48000 44100
|
||||||
atmos-max: 2768 #2768 2448
|
atmos-max: 2768 #2768 2448
|
||||||
limit-max: 200
|
limit-max: 200
|
||||||
|
34
main.go
34
main.go
@ -72,6 +72,7 @@ type Config struct {
|
|||||||
Check string `yaml:"check"`
|
Check string `yaml:"check"`
|
||||||
DecryptM3u8Port string `yaml:"decrypt-m3u8-port"`
|
DecryptM3u8Port string `yaml:"decrypt-m3u8-port"`
|
||||||
GetM3u8Port string `yaml:"get-m3u8-port"`
|
GetM3u8Port string `yaml:"get-m3u8-port"`
|
||||||
|
GetM3u8Mode string `yaml:"get-m3u8-mode"`
|
||||||
GetM3u8FromDevice bool `yaml:"get-m3u8-from-device"`
|
GetM3u8FromDevice bool `yaml:"get-m3u8-from-device"`
|
||||||
AlacMax int `yaml:"alac-max"`
|
AlacMax int `yaml:"alac-max"`
|
||||||
AtmosMax int `yaml:"atmos-max"`
|
AtmosMax int `yaml:"atmos-max"`
|
||||||
@ -1353,6 +1354,15 @@ func writeLyrics(sanAlbumFolder, filename string, lrc string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func contains(slice []string, item string) bool {
|
||||||
|
for _, v := range slice {
|
||||||
|
if v == item {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func rip(albumId string, token string, storefront string, userToken string) error {
|
func rip(albumId string, token string, storefront string, userToken string) error {
|
||||||
var Codec string
|
var Codec string
|
||||||
if dl_atmos {
|
if dl_atmos {
|
||||||
@ -1405,10 +1415,20 @@ func rip(albumId string, token string, storefront string, userToken string) erro
|
|||||||
if manifest1.Attributes.ExtendedAssetUrls.EnhancedHls == "" {
|
if manifest1.Attributes.ExtendedAssetUrls.EnhancedHls == "" {
|
||||||
fmt.Println("Unavailable.\n")
|
fmt.Println("Unavailable.\n")
|
||||||
} else {
|
} else {
|
||||||
EnhancedHls_m3u8, err := checkM3u8(meta.Data[0].Relationships.Tracks.Data[0].ID, "album")
|
needCheck := false
|
||||||
|
|
||||||
|
if config.GetM3u8Mode == "all" {
|
||||||
|
needCheck = true
|
||||||
|
} else if config.GetM3u8Mode == "hires" && contains(meta.Data[0].Relationships.Tracks.Data[0].Attributes.AudioTraits, "hi-res-lossless") {
|
||||||
|
needCheck = true
|
||||||
|
}
|
||||||
|
var EnhancedHls_m3u8 string
|
||||||
|
if needCheck {
|
||||||
|
EnhancedHls_m3u8, err = checkM3u8(meta.Data[0].Relationships.Tracks.Data[0].ID, "album")
|
||||||
if strings.HasSuffix(EnhancedHls_m3u8, ".m3u8") {
|
if strings.HasSuffix(EnhancedHls_m3u8, ".m3u8") {
|
||||||
manifest1.Attributes.ExtendedAssetUrls.EnhancedHls = EnhancedHls_m3u8
|
manifest1.Attributes.ExtendedAssetUrls.EnhancedHls = EnhancedHls_m3u8
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Quality, err = extractMediaQuality(manifest1.Attributes.ExtendedAssetUrls.EnhancedHls)
|
Quality, err = extractMediaQuality(manifest1.Attributes.ExtendedAssetUrls.EnhancedHls)
|
||||||
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)
|
||||||
@ -1567,10 +1587,20 @@ func rip(albumId string, token string, storefront string, userToken string) erro
|
|||||||
fmt.Println("Unavailable.")
|
fmt.Println("Unavailable.")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
EnhancedHls_m3u8, err := checkM3u8(track.ID, "song")
|
needCheck := false
|
||||||
|
|
||||||
|
if config.GetM3u8Mode == "all" {
|
||||||
|
needCheck = true
|
||||||
|
} else if config.GetM3u8Mode == "hires" && contains(track.Attributes.AudioTraits, "hi-res-lossless") {
|
||||||
|
needCheck = true
|
||||||
|
}
|
||||||
|
var EnhancedHls_m3u8 string
|
||||||
|
if needCheck {
|
||||||
|
EnhancedHls_m3u8, err = checkM3u8(track.ID, "song")
|
||||||
if strings.HasSuffix(EnhancedHls_m3u8, ".m3u8") {
|
if strings.HasSuffix(EnhancedHls_m3u8, ".m3u8") {
|
||||||
manifest.Attributes.ExtendedAssetUrls.EnhancedHls = EnhancedHls_m3u8
|
manifest.Attributes.ExtendedAssetUrls.EnhancedHls = EnhancedHls_m3u8
|
||||||
}
|
}
|
||||||
|
}
|
||||||
var Quality string
|
var Quality string
|
||||||
if strings.Contains(config.SongFileFormat, "Quality") {
|
if strings.Contains(config.SongFileFormat, "Quality") {
|
||||||
if dl_atmos {
|
if dl_atmos {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user