add select Sampling rate

pull/22/head
zhaarey 5 months ago
parent 2a4e557acb
commit 019689bfe7
  1. 2
      config.yaml
  2. 17
      main.go
  3. 19
      main_atmos.go
  4. 17
      main_select.go

@ -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

@ -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,13 +1496,19 @@ func extractMedia(b string) (string, []string, error) {
if variant.Codecs == "alac" {
split := strings.Split(variant.Audio, "-")
length := len(split)
fmt.Printf("%s-bit / %s Hz\n", split[length-1], split[length-2])
streamUrlTemp, err := masterUrl.Parse(variant.URI)
length_int,err := strconv.Atoi(split[length-2])
if err != nil {
panic(err)
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 {
panic(err)
}
streamUrl = streamUrlTemp
break
}
streamUrl = streamUrlTemp
break
}
}
if streamUrl == nil {

@ -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,13 +1364,21 @@ func extractMedia(b string) (string, []string, error) {
})
for _, variant := range master.Variants {
if variant.Codecs == "ec-3" {
fmt.Printf("%s\n", variant.Audio)
streamUrlTemp, err := masterUrl.Parse(variant.URI)
split := strings.Split(variant.Audio, "-")
length := len(split)
length_int,err := strconv.Atoi(split[length-1])
if err != nil {
panic(err)
return "", nil, err
}
if length_int <= config.AtmosMax{
fmt.Printf("%s\n", variant.Audio)
streamUrlTemp, err := masterUrl.Parse(variant.URI)
if err != nil {
panic(err)
}
streamUrl = streamUrlTemp
break
}
streamUrl = streamUrlTemp
break
}
}
if streamUrl == nil {

@ -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,13 +1416,19 @@ func extractMedia(b string) (string, []string, error) {
if variant.Codecs == "alac" {
split := strings.Split(variant.Audio, "-")
length := len(split)
fmt.Printf("%s-bit / %s Hz\n", split[length-1], split[length-2])
streamUrlTemp, err := masterUrl.Parse(variant.URI)
length_int,err := strconv.Atoi(split[length-2])
if err != nil {
panic(err)
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 {
panic(err)
}
streamUrl = streamUrlTemp
break
}
streamUrl = streamUrlTemp
break
}
}
if streamUrl == nil {

Loading…
Cancel
Save