add republishing on non-available videos

enhanced logging
This commit is contained in:
Niko Storni 2019-08-30 19:35:04 +02:00
parent 3c3ea2138e
commit 7d38aa7b29
2 changed files with 12 additions and 3 deletions

View file

@ -576,11 +576,12 @@ func (s *Sync) updateRemoteDB(claims []jsonrpc.Claim) (total, fixed, removed int
} }
_, ok := videoIDMap[vID] _, ok := videoIDMap[vID]
if !ok && sv.Published { 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) idsToRemove = append(idsToRemove, vID)
} }
} }
if s.Manager.removeDBUnpublished && len(idsToRemove) > 0 { if s.Manager.removeDBUnpublished && len(idsToRemove) > 0 {
log.Infof("removing: %s", strings.Join(idsToRemove, ","))
err := s.Manager.apiConfig.DeleteVideos(idsToRemove) err := s.Manager.apiConfig.DeleteVideos(idsToRemove)
if err != nil { if err != nil {
return count, fixed, len(idsToRemove), err 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", "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", "giving up after 0 fragment retries",
"download error: ERROR: Sorry about that",
} }
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")

View file

@ -519,8 +519,15 @@ func (v *YoutubeVideo) reprocess(daemon *jsonrpc.Client, params SyncParams, exis
videoSize = uint64(existingVideoData.Size) videoSize = uint64(existingVideoData.Size)
} else { } else {
log.Infof("%s: the video must be republished as we can't get the right size", v.ID()) 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 if !v.mocked {
return nil, errors.Err("the video must be republished as we can't get the right size") _, 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)) v.size = util.PtrToInt64(int64(videoSize))