Created
August 1, 2017 22:08
-
-
Save flavioribeiro/b4957d08637cf95ce569fe472ee2530f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/service/captions.go b/service/captions.go | |
index 8ffdf7e..096474f 100644 | |
--- a/service/captions.go | |
+++ b/service/captions.go | |
@@ -88,6 +88,7 @@ func (s *MediaFactoryService) triggerCaptionsJob(ctx context.Context, jobStatus | |
func (s *MediaFactoryService) getCaptionsStatus(ctx context.Context, scoopID string) (*captionsStatus, error) { | |
var status captionsStatus | |
+ | |
url := fmt.Sprintf("%s/captions/%s", s.captionsAPIEndpoint, scoopID) | |
result := s.makeJSONServiceRequest(ctx, &serviceRequestOptions{ | |
method: "GET", | |
@@ -111,7 +112,7 @@ func (s *MediaFactoryService) getCaptionsStatus(ctx context.Context, scoopID str | |
} | |
func shouldGetCaptionsStatus(jobStatus *jobStatusPayload) bool { | |
- return jobStatus.Metadata["captions"] != nil && len(jobStatus.Renditions) > 0 | |
+ return jobStatus.Metadata["captions"] != nil && jobStatus.Stage == "Distribution" && jobStatus.Status == "Finished" && len(jobStatus.Renditions) > 0 | |
} | |
func (s *MediaFactoryService) addCaptionsStatusToJobStatus(ctx context.Context, jobStatus *jobStatusPayload) { | |
diff --git a/service/pipeline.go b/service/pipeline.go | |
index 14e8e5c..a62c4c3 100644 | |
--- a/service/pipeline.go | |
+++ b/service/pipeline.go | |
@@ -666,6 +666,10 @@ func (s *MediaFactoryService) getPipelineJobsStatus(ctx context.Context, jobID s | |
logger.WithError(err).Debug("making get pipeline job request: got preset map data: error") | |
return jobStatus, swagger.NewErrorResponse(err) | |
} | |
+ | |
+ logger.Debug("making get captions job request: adding captions status to job status") | |
+ s.addCaptionsStatusToJobStatus(ctx, &jobStatus) | |
+ | |
err = s.addDistributionStageDetailsToJobStatus(ctx, presetMaps, &jobStatus) | |
logger.Debug("making get pipeline job request: adding distribution details to job status") | |
if err != nil { | |
@@ -673,9 +677,6 @@ func (s *MediaFactoryService) getPipelineJobsStatus(ctx context.Context, jobID s | |
return jobStatus, swagger.NewErrorResponse(err) | |
} | |
- logger.Debug("making get captions job request: adding captions status to job status") | |
- s.addCaptionsStatusToJobStatus(ctx, &jobStatus) | |
- | |
return jobStatus, nil | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment