fix missing fragments for good
never retry them again
This commit is contained in:
parent
64ab2490fe
commit
8f556a86c8
2 changed files with 8 additions and 6 deletions
|
@ -657,6 +657,7 @@ func (s *Sync) startWorker(workerNum int) {
|
||||||
"have blocked it on copyright grounds",
|
"have blocked it on copyright grounds",
|
||||||
"the video must be republished as we can't get the right size",
|
"the video must be republished as we can't get the right size",
|
||||||
"HTTP Error 403",
|
"HTTP Error 403",
|
||||||
|
"giving up after 0 fragment retries",
|
||||||
}
|
}
|
||||||
if util.SubstringInSlice(err.Error(), errorsNoRetry) {
|
if util.SubstringInSlice(err.Error(), errorsNoRetry) {
|
||||||
log.Println("This error should not be retried at all")
|
log.Println("This error should not be retried at all")
|
||||||
|
@ -863,6 +864,7 @@ func (s *Sync) processVideo(v video) (err error) {
|
||||||
"no compatible format available for this video",
|
"no compatible format available for this video",
|
||||||
"Watch this video on YouTube.",
|
"Watch this video on YouTube.",
|
||||||
"have blocked it on copyright grounds",
|
"have blocked it on copyright grounds",
|
||||||
|
"giving up after 0 fragment retries",
|
||||||
}
|
}
|
||||||
if ok && !sv.Published && util.SubstringInSlice(sv.FailureReason, neverRetryFailures) {
|
if ok && !sv.Published && util.SubstringInSlice(sv.FailureReason, neverRetryFailures) {
|
||||||
log.Println(v.ID() + " can't ever be published")
|
log.Println(v.ID() + " can't ever be published")
|
||||||
|
|
|
@ -203,7 +203,6 @@ func (v *YoutubeVideo) download(useIPv6 bool) error {
|
||||||
fmt.Sprintf("%dM", v.maxVideoSize),
|
fmt.Sprintf("%dM", v.maxVideoSize),
|
||||||
"--match-filter",
|
"--match-filter",
|
||||||
fmt.Sprintf("duration <= %d", int(math.Round(v.maxVideoLength*3600))),
|
fmt.Sprintf("duration <= %d", int(math.Round(v.maxVideoLength*3600))),
|
||||||
"-fbestvideo[ext=mp4][height<=" + qualities[qualityIndex] + "]+bestaudio[ext!=webm]",
|
|
||||||
"-o\"" + strings.TrimSuffix(v.getFullPath(), ".mp4") + "\"",
|
"-o\"" + strings.TrimSuffix(v.getFullPath(), ".mp4") + "\"",
|
||||||
"--merge-output-format",
|
"--merge-output-format",
|
||||||
"mp4",
|
"mp4",
|
||||||
|
@ -249,9 +248,10 @@ func (v *YoutubeVideo) download(useIPv6 bool) error {
|
||||||
}
|
}
|
||||||
ytdlArgs = append(ytdlArgs, "https://www.youtube.com/watch?v="+v.ID())
|
ytdlArgs = append(ytdlArgs, "https://www.youtube.com/watch?v="+v.ID())
|
||||||
runcmd:
|
runcmd:
|
||||||
cmd := exec.Command("youtube-dl", ytdlArgs...)
|
argsWithFilters := append(ytdlArgs, "-fbestvideo[ext=mp4][height<="+qualities[qualityIndex]+"]+bestaudio[ext!=webm]")
|
||||||
|
cmd := exec.Command("youtube-dl", argsWithFilters...)
|
||||||
|
|
||||||
log.Printf("Running command youtube-dl %s", strings.Join(ytdlArgs, " "))
|
log.Printf("Running command youtube-dl %s", strings.Join(argsWithFilters, " "))
|
||||||
|
|
||||||
stderr, err := cmd.StderrPipe()
|
stderr, err := cmd.StderrPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -273,11 +273,11 @@ runcmd:
|
||||||
if strings.Contains(err.Error(), "exit status 1") {
|
if strings.Contains(err.Error(), "exit status 1") {
|
||||||
if strings.Contains(string(errorLog), "HTTP Error 429") {
|
if strings.Contains(string(errorLog), "HTTP Error 429") {
|
||||||
ipManager.SetIpThrottled(sourceAddress, v.stopGroup)
|
ipManager.SetIpThrottled(sourceAddress, v.stopGroup)
|
||||||
|
} else if strings.Contains(string(errorLog), "giving up after 0 fragment retries") && qualityIndex < len(qualities)-1 {
|
||||||
|
qualityIndex++
|
||||||
|
goto runcmd
|
||||||
}
|
}
|
||||||
return errors.Err(string(errorLog))
|
return errors.Err(string(errorLog))
|
||||||
} else if strings.Contains(string(errorLog), "giving up after 0 fragment retries") && qualityIndex < len(qualities)-1 {
|
|
||||||
qualityIndex++
|
|
||||||
goto runcmd
|
|
||||||
}
|
}
|
||||||
return errors.Err(err)
|
return errors.Err(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue