add select Sampling rate
This commit is contained in:
parent
2a4e557acb
commit
019689bfe7
@ -9,3 +9,5 @@ atmos-save-folder: AM-DL-Atmos downloads
|
||||
check: ""
|
||||
force-api: false
|
||||
get-m3u8-from-device: false
|
||||
alac-max: 192000 #192000 96000 48000 44100
|
||||
atmos-max: 2768 #2768 2448
|
||||
|
7
main.go
7
main.go
@ -48,6 +48,7 @@ type Config struct {
|
||||
ForceApi bool `yaml:"force-api"`
|
||||
Check string `yaml:"check"`
|
||||
GetM3u8FromDevice bool `yaml:"get-m3u8-from-device"`
|
||||
AlacMax int `yaml:"alac-max"`
|
||||
}
|
||||
|
||||
var config Config
|
||||
@ -1495,6 +1496,11 @@ func extractMedia(b string) (string, []string, error) {
|
||||
if variant.Codecs == "alac" {
|
||||
split := strings.Split(variant.Audio, "-")
|
||||
length := len(split)
|
||||
length_int,err := strconv.Atoi(split[length-2])
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
if length_int <= config.AlacMax{
|
||||
fmt.Printf("%s-bit / %s Hz\n", split[length-1], split[length-2])
|
||||
streamUrlTemp, err := masterUrl.Parse(variant.URI)
|
||||
if err != nil {
|
||||
@ -1504,6 +1510,7 @@ func extractMedia(b string) (string, []string, error) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if streamUrl == nil {
|
||||
return "", nil, errors.New("no alac codec found")
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ type Config struct {
|
||||
CoverFormat string `yaml:"cover-format"`
|
||||
AlacSaveFolder string `yaml:"alac-save-folder"`
|
||||
AtmosSaveFolder string `yaml:"atmos-save-folder"`
|
||||
AtmosMax int `yaml:"atmos-max"`
|
||||
}
|
||||
|
||||
var config Config
|
||||
@ -1363,6 +1364,13 @@ func extractMedia(b string) (string, []string, error) {
|
||||
})
|
||||
for _, variant := range master.Variants {
|
||||
if variant.Codecs == "ec-3" {
|
||||
split := strings.Split(variant.Audio, "-")
|
||||
length := len(split)
|
||||
length_int,err := strconv.Atoi(split[length-1])
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
if length_int <= config.AtmosMax{
|
||||
fmt.Printf("%s\n", variant.Audio)
|
||||
streamUrlTemp, err := masterUrl.Parse(variant.URI)
|
||||
if err != nil {
|
||||
@ -1372,6 +1380,7 @@ func extractMedia(b string) (string, []string, error) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if streamUrl == nil {
|
||||
return "", nil, errors.New("no ec-3 codec found")
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ type Config struct {
|
||||
CoverFormat string `yaml:"cover-format"`
|
||||
AlacSaveFolder string `yaml:"alac-save-folder"`
|
||||
AtmosSaveFolder string `yaml:"atmos-save-folder"`
|
||||
AlacMax int `yaml:"alac-max"`
|
||||
}
|
||||
|
||||
var config Config
|
||||
@ -1415,6 +1416,11 @@ func extractMedia(b string) (string, []string, error) {
|
||||
if variant.Codecs == "alac" {
|
||||
split := strings.Split(variant.Audio, "-")
|
||||
length := len(split)
|
||||
length_int,err := strconv.Atoi(split[length-2])
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
if length_int <= config.AlacMax{
|
||||
fmt.Printf("%s-bit / %s Hz\n", split[length-1], split[length-2])
|
||||
streamUrlTemp, err := masterUrl.Parse(variant.URI)
|
||||
if err != nil {
|
||||
@ -1424,6 +1430,7 @@ func extractMedia(b string) (string, []string, error) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if streamUrl == nil {
|
||||
return "", nil, errors.New("no alac codec found")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user