Compare commits

...
5 Commits
Author SHA1 Message Date
Niko Storni c193dae95a temporary throttling of channels to sync for tom to review them 2019-07-22 16:16:23 -04:00
Niko Storni 0c47510785 revert quoting paths 2019-07-22 02:51:13 +02:00
Niko Storni 8f556a86c8 fix missing fragments for good
never retry them again
2019-07-22 02:45:38 +02:00
Niko Storni 64ab2490fe fix bugs
improve debugging
2019-07-22 02:27:14 +02:00
Niko Storni 1760935edf don't retry missing fragments
lower syncing quality for now
2019-07-22 02:09:18 +02:00
3 changed files with 21 additions and 4 deletions

No files matched your search

+2
View File
@@ -153,6 +153,8 @@ func (s *SyncManager) Start() error {
queuesToSync = append(queuesToSync, StatusSyncing, StatusQueued)
}
for _, q := range queuesToSync {
//temporary override for sync-until to give tom the time to review the channels
s.syncProperties.SyncUntil = time.Now().AddDate(0, 0, -1).Unix()
channels, err := s.apiConfig.FetchChannels(q, s.syncProperties)
if err != nil {
return err
+2
View File
@@ -657,6 +657,7 @@ func (s *Sync) startWorker(workerNum int) {
"have blocked it on copyright grounds",
"the video must be republished as we can't get the right size",
"HTTP Error 403",
"giving up after 0 fragment retries",
}
if util.SubstringInSlice(err.Error(), errorsNoRetry) {
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",
"Watch this video on YouTube.",
"have blocked it on copyright grounds",
"giving up after 0 fragment retries",
}
if ok && !sv.Published && util.SubstringInSlice(sv.FailureReason, neverRetryFailures) {
log.Println(v.ID() + " can't ever be published")
+17 -4
View File
@@ -190,17 +190,25 @@ func (v *YoutubeVideo) download(useIPv6 bool) error {
log.Debugln(v.id + " already exists at " + videoPath)
return nil
}
qualities := []string{
//"1080",
"720",
"480",
"320",
}
qualityIndex := 0
ytdlArgs := []string{
"--no-progress",
"--max-filesize",
fmt.Sprintf("%dM", v.maxVideoSize),
"--match-filter",
fmt.Sprintf("duration <= %d", int(math.Round(v.maxVideoLength*3600))),
"-fbestvideo[ext=mp4][height<=1080]+bestaudio[ext!=webm]",
"-o" + strings.TrimSuffix(v.getFullPath(), ".mp4"),
"--merge-output-format",
"mp4",
"--abort-on-unavailable-fragment",
"--fragment-retries",
"0",
}
sourceAddress, err := ipManager.GetNextIP(useIPv6)
if err != nil {
@@ -239,9 +247,11 @@ func (v *YoutubeVideo) download(useIPv6 bool) error {
)
}
ytdlArgs = append(ytdlArgs, "https://www.youtube.com/watch?v="+v.ID())
cmd := exec.Command("youtube-dl", ytdlArgs...)
runcmd:
argsWithFilters := append(ytdlArgs, "-fbestvideo[ext=mp4][height<="+qualities[qualityIndex]+"]+bestaudio[ext!=webm]")
cmd := exec.Command("youtube-dl", argsWithFilters...)
log.Printf("Running command and waiting for it to finish...")
log.Printf("Running command youtube-dl %s", strings.Join(argsWithFilters, " "))
stderr, err := cmd.StderrPipe()
if err != nil {
@@ -263,6 +273,9 @@ func (v *YoutubeVideo) download(useIPv6 bool) error {
if strings.Contains(err.Error(), "exit status 1") {
if strings.Contains(string(errorLog), "HTTP Error 429") {
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))
}