From f7f0231c80caa127c0317a7cd1224d6d9d1813af Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Mon, 10 Jun 2019 21:59:42 +0200 Subject: [PATCH] add VideoUpgradeFailed staus --- manager/manager.go | 7 ++++--- manager/ytsync.go | 7 +++++-- sources/youtubeVideo.go | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/manager/manager.go b/manager/manager.go index b08b601..8ad0c36 100644 --- a/manager/manager.go +++ b/manager/manager.go @@ -91,9 +91,10 @@ const ( var SyncStatuses = []string{StatusPending, StatusPendingEmail, StatusPendingUpgrade, StatusQueued, StatusSyncing, StatusSynced, StatusFailed, StatusFinalized, StatusAbandoned} const ( - VideoStatusPublished = "published" - VideoStatusFailed = "failed" - VideoStatusUnpublished = "unpublished" + VideoStatusPublished = "published" + VideoStatusFailed = "failed" + VideoStatusUpgradeFailed = "upgradefailed" + VideoStatusUnpublished = "unpublished" ) func (s *SyncManager) Start() error { diff --git a/manager/ytsync.go b/manager/ytsync.go index 786f472..95b84be 100644 --- a/manager/ytsync.go +++ b/manager/ytsync.go @@ -711,9 +711,12 @@ func (s *Sync) startWorker(workerNum int) { existingClaimSize = &existingClaim.Size } } - + videoStatus := VideoStatusFailed + if strings.Contains(err.Error(), "upgrade failed") { + videoStatus = VideoStatusUpgradeFailed + } s.AppendSyncedVideo(v.ID(), false, err.Error(), "") - err = s.Manager.apiConfig.MarkVideoStatus(s.YoutubeChannelID, v.ID(), VideoStatusFailed, existingClaimID, existingClaimName, err.Error(), existingClaimSize, 0) + err = s.Manager.apiConfig.MarkVideoStatus(s.YoutubeChannelID, v.ID(), videoStatus, existingClaimID, existingClaimName, err.Error(), existingClaimSize, 0) if err != nil { SendErrorToSlack("Failed to mark video on the database: %s", err.Error()) } diff --git a/sources/youtubeVideo.go b/sources/youtubeVideo.go index 5e96ce7..6143485 100644 --- a/sources/youtubeVideo.go +++ b/sources/youtubeVideo.go @@ -378,7 +378,7 @@ func (v *YoutubeVideo) Sync(daemon *jsonrpc.Client, params SyncParams, existingV v.lbryChannelID = params.ChannelID if reprocess && existingVideoData != nil && existingVideoData.Published { summary, err := v.reprocess(daemon, params, existingVideoData) - return summary, err + return summary, errors.Prefix("upgrade failed", err) } return v.downloadAndPublish(daemon, params) }