Skip to content

Instantly share code, notes, and snippets.

@flavioribeiro
Created August 1, 2017 22:08
Show Gist options
  • Select an option

  • Save flavioribeiro/b4957d08637cf95ce569fe472ee2530f to your computer and use it in GitHub Desktop.

Select an option

Save flavioribeiro/b4957d08637cf95ce569fe472ee2530f to your computer and use it in GitHub Desktop.

Revisions

  1. flavioribeiro created this gist Aug 1, 2017.
    46 changes: 46 additions & 0 deletions foo.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    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
    }