diff --git a/manager.go b/manager.go index 51c8a27..a9bc274 100644 --- a/manager.go +++ b/manager.go @@ -94,7 +94,7 @@ type apiSyncUpdateResponse struct { } func (s SyncManager) setChannelSyncStatus(channelID string, status string) error { - endpoint := s.ApiURL + "/yt/sync_update" + endpoint := s.ApiURL + "/yt/channel_status" res, _ := http.PostForm(endpoint, url.Values{ "channel_id": {channelID}, @@ -123,12 +123,12 @@ const ( VideoSStatusFailed = "failed" ) -func (s SyncManager) MarkVideoStatus(channelID string, videoID string, status string, claimID string, claimName string, details string) error { - endpoint := s.ApiURL + "/yt/track_video" +func (s SyncManager) MarkVideoStatus(channelID string, videoID string, status string, claimID string, claimName string, failureReason string) error { + endpoint := s.ApiURL + "/yt/video_status" vals := url.Values{ "youtube_channel_id": {channelID}, - "youtube_video_id": {videoID}, + "video_id": {videoID}, "status": {status}, "auth_token": {s.ApiToken}, } @@ -140,8 +140,8 @@ func (s SyncManager) MarkVideoStatus(channelID string, videoID string, status st vals.Add("claim_id", claimID) vals.Add("claim_name", claimName) } - if details != "" { - vals.Add("details", details) + if failureReason != "" { + vals.Add("failure_reason", failureReason) } res, _ := http.PostForm(endpoint, vals) defer res.Body.Close() diff --git a/ytsync.go b/ytsync.go index efd0271..4ad2d14 100644 --- a/ytsync.go +++ b/ytsync.go @@ -164,7 +164,7 @@ func (s *Sync) FullCycle() (e error) { } else { // the cli will return long before the daemon effectively stops. we must observe the processes running // before moving the wallet - var waitTimeout time.Duration = 60 * 8 + waitTimeout := 8 * time.Minute processDeathError := waitForDaemonProcess(waitTimeout) if processDeathError != nil { logShutdownError(processDeathError) @@ -337,10 +337,10 @@ func (s *Sync) startWorker(workerNum int) { } SendErrorToSlack("Video failed after %d retries, skipping. Stack: %s", tryCount, logMsg) } - /*err = s.Manager.MarkVideoStatus(s.YoutubeChannelID, v.ID(), VideoSStatusFailed, "", "", err.Error()) + err = s.Manager.MarkVideoStatus(s.YoutubeChannelID, v.ID(), VideoSStatusFailed, "", "", err.Error()) if err != nil { SendErrorToSlack("Failed to mark video on the database: %s", err.Error()) - }*/ + } } break } @@ -508,14 +508,14 @@ func (s *Sync) processVideo(v video) (err error) { log.Println(v.ID() + " is old: skipping") return nil } - _, err = v.Sync(s.daemon, s.claimAddress, publishAmount, s.LbryChannelName) + summary, err := v.Sync(s.daemon, s.claimAddress, publishAmount, s.LbryChannelName) if err != nil { return err } - /*err = s.Manager.MarkVideoStatus(s.YoutubeChannelID, v.ID(), VideoStatusPublished, summary.ClaimID, summary.ClaimName, "") + err = s.Manager.MarkVideoStatus(s.YoutubeChannelID, v.ID(), VideoStatusPublished, summary.ClaimID, summary.ClaimName, "") if err != nil { SendErrorToSlack("Failed to mark video on the database: %s", err.Error()) - }*/ + } err = s.db.SetPublished(v.ID()) if err != nil { return err