From 7d38aa7b29567b4eabd3d5f9f2db1b8203076d67 Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Fri, 30 Aug 2019 19:35:04 +0200 Subject: [PATCH] add republishing on non-available videos enhanced logging --- manager/ytsync.go | 4 +++- sources/youtubeVideo.go | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/manager/ytsync.go b/manager/ytsync.go index 6caf8fe..744ffe7 100644 --- a/manager/ytsync.go +++ b/manager/ytsync.go @@ -576,11 +576,12 @@ func (s *Sync) updateRemoteDB(claims []jsonrpc.Claim) (total, fixed, removed int } _, ok := videoIDMap[vID] if !ok && sv.Published { - log.Debugf("%s: claims to be published but wasn't found in the list of claims and will be removed if --remove-db-unpublished was specified", vID) + log.Debugf("%s: claims to be published but wasn't found in the list of claims and will be removed if --remove-db-unpublished was specified (%t)", vID, s.Manager.removeDBUnpublished) idsToRemove = append(idsToRemove, vID) } } if s.Manager.removeDBUnpublished && len(idsToRemove) > 0 { + log.Infof("removing: %s", strings.Join(idsToRemove, ",")) err := s.Manager.apiConfig.DeleteVideos(idsToRemove) if err != nil { return count, fixed, len(idsToRemove), err @@ -774,6 +775,7 @@ func (s *Sync) startWorker(workerNum int) { "the video must be republished as we can't get the right size", "HTTP Error 403", "giving up after 0 fragment retries", + "download error: ERROR: Sorry about that", } if util.SubstringInSlice(err.Error(), errorsNoRetry) { log.Println("This error should not be retried at all") diff --git a/sources/youtubeVideo.go b/sources/youtubeVideo.go index 09551b3..09d35f9 100644 --- a/sources/youtubeVideo.go +++ b/sources/youtubeVideo.go @@ -519,8 +519,15 @@ func (v *YoutubeVideo) reprocess(daemon *jsonrpc.Client, params SyncParams, exis videoSize = uint64(existingVideoData.Size) } else { log.Infof("%s: the video must be republished as we can't get the right size", v.ID()) - //return v.downloadAndPublish(daemon, params) //TODO: actually republish the video. NB: the current claim should be abandoned first - return nil, errors.Err("the video must be republished as we can't get the right size") + if !v.mocked { + _, err = daemon.StreamAbandon(currentClaim.Txid, currentClaim.Nout, nil, true) + if err != nil { + return nil, errors.Err(err) + } + return v.downloadAndPublish(daemon, params) + + } + return nil, errors.Err("the video must be republished as we can't get the right size but it doesn't exist on youtube anymore") } } v.size = util.PtrToInt64(int64(videoSize))