do not apply limits if disabled
This commit is contained in:
parent
d5ed4ce753
commit
9d65fce6bc
1 changed files with 12 additions and 4 deletions
|
@ -199,10 +199,6 @@ func (v *YoutubeVideo) download(useIPv6 bool) error {
|
||||||
qualityIndex := 0
|
qualityIndex := 0
|
||||||
ytdlArgs := []string{
|
ytdlArgs := []string{
|
||||||
"--no-progress",
|
"--no-progress",
|
||||||
"--max-filesize",
|
|
||||||
fmt.Sprintf("%dM", v.maxVideoSize),
|
|
||||||
"--match-filter",
|
|
||||||
fmt.Sprintf("duration <= %d", int(math.Round(v.maxVideoLength*3600))),
|
|
||||||
"-o" + strings.TrimSuffix(v.getFullPath(), ".mp4"),
|
"-o" + strings.TrimSuffix(v.getFullPath(), ".mp4"),
|
||||||
"--merge-output-format",
|
"--merge-output-format",
|
||||||
"mp4",
|
"mp4",
|
||||||
|
@ -212,6 +208,18 @@ func (v *YoutubeVideo) download(useIPv6 bool) error {
|
||||||
"--fragment-retries",
|
"--fragment-retries",
|
||||||
"0",
|
"0",
|
||||||
}
|
}
|
||||||
|
if v.maxVideoSize > 0 {
|
||||||
|
ytdlArgs = append(ytdlArgs,
|
||||||
|
"--max-filesize",
|
||||||
|
fmt.Sprintf("%dM", v.maxVideoSize),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if v.maxVideoLength > 0 {
|
||||||
|
ytdlArgs = append(ytdlArgs,
|
||||||
|
"--match-filter",
|
||||||
|
fmt.Sprintf("duration <= %d", int(math.Round(v.maxVideoLength*3600))),
|
||||||
|
)
|
||||||
|
}
|
||||||
sourceAddress, err := ipManager.GetNextIP(useIPv6)
|
sourceAddress, err := ipManager.GetNextIP(useIPv6)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if sourceAddress == "throttled" {
|
if sourceAddress == "throttled" {
|
||||||
|
|
Loading…
Reference in a new issue