rename ytsync endpoints
enable video tracking
This commit is contained in:
parent
302e080b95
commit
f688091775
2 changed files with 12 additions and 12 deletions
12
manager.go
12
manager.go
|
@ -94,7 +94,7 @@ type apiSyncUpdateResponse struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s SyncManager) setChannelSyncStatus(channelID string, status string) error {
|
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{
|
res, _ := http.PostForm(endpoint, url.Values{
|
||||||
"channel_id": {channelID},
|
"channel_id": {channelID},
|
||||||
|
@ -123,12 +123,12 @@ const (
|
||||||
VideoSStatusFailed = "failed"
|
VideoSStatusFailed = "failed"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s SyncManager) MarkVideoStatus(channelID string, videoID string, status string, claimID string, claimName string, details string) error {
|
func (s SyncManager) MarkVideoStatus(channelID string, videoID string, status string, claimID string, claimName string, failureReason string) error {
|
||||||
endpoint := s.ApiURL + "/yt/track_video"
|
endpoint := s.ApiURL + "/yt/video_status"
|
||||||
|
|
||||||
vals := url.Values{
|
vals := url.Values{
|
||||||
"youtube_channel_id": {channelID},
|
"youtube_channel_id": {channelID},
|
||||||
"youtube_video_id": {videoID},
|
"video_id": {videoID},
|
||||||
"status": {status},
|
"status": {status},
|
||||||
"auth_token": {s.ApiToken},
|
"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_id", claimID)
|
||||||
vals.Add("claim_name", claimName)
|
vals.Add("claim_name", claimName)
|
||||||
}
|
}
|
||||||
if details != "" {
|
if failureReason != "" {
|
||||||
vals.Add("details", details)
|
vals.Add("failure_reason", failureReason)
|
||||||
}
|
}
|
||||||
res, _ := http.PostForm(endpoint, vals)
|
res, _ := http.PostForm(endpoint, vals)
|
||||||
defer res.Body.Close()
|
defer res.Body.Close()
|
||||||
|
|
12
ytsync.go
12
ytsync.go
|
@ -164,7 +164,7 @@ func (s *Sync) FullCycle() (e error) {
|
||||||
} else {
|
} else {
|
||||||
// the cli will return long before the daemon effectively stops. we must observe the processes running
|
// the cli will return long before the daemon effectively stops. we must observe the processes running
|
||||||
// before moving the wallet
|
// before moving the wallet
|
||||||
var waitTimeout time.Duration = 60 * 8
|
waitTimeout := 8 * time.Minute
|
||||||
processDeathError := waitForDaemonProcess(waitTimeout)
|
processDeathError := waitForDaemonProcess(waitTimeout)
|
||||||
if processDeathError != nil {
|
if processDeathError != nil {
|
||||||
logShutdownError(processDeathError)
|
logShutdownError(processDeathError)
|
||||||
|
@ -337,10 +337,10 @@ func (s *Sync) startWorker(workerNum int) {
|
||||||
}
|
}
|
||||||
SendErrorToSlack("Video failed after %d retries, skipping. Stack: %s", tryCount, logMsg)
|
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 {
|
if err != nil {
|
||||||
SendErrorToSlack("Failed to mark video on the database: %s", err.Error())
|
SendErrorToSlack("Failed to mark video on the database: %s", err.Error())
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -508,14 +508,14 @@ func (s *Sync) processVideo(v video) (err error) {
|
||||||
log.Println(v.ID() + " is old: skipping")
|
log.Println(v.ID() + " is old: skipping")
|
||||||
return nil
|
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 {
|
if err != nil {
|
||||||
return err
|
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 {
|
if err != nil {
|
||||||
SendErrorToSlack("Failed to mark video on the database: %s", err.Error())
|
SendErrorToSlack("Failed to mark video on the database: %s", err.Error())
|
||||||
}*/
|
}
|
||||||
err = s.db.SetPublished(v.ID())
|
err = s.db.SetPublished(v.ID())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue