diff --git a/services/vidispine/export.go b/services/vidispine/export.go index 2092a189..238afd16 100644 --- a/services/vidispine/export.go +++ b/services/vidispine/export.go @@ -3,6 +3,7 @@ package vidispine import ( "errors" "fmt" + "regexp" "strconv" "strings" @@ -290,6 +291,9 @@ func getEmbeddedAudio(c *Client, clip *Clip, languagesToExport []string) (*Clip, return clip, nil } +var nonAlphanumeric = regexp.MustCompile("[^a-zA-Z0-9_]+") +var consecutiveUnderscores = regexp.MustCompile("_+") + // GetDataForExport returns the data needed to export the item with the given VXID // If exportSubclip is true, the subclip will be exported, otherwise the whole clip func (c *Client) GetDataForExport(itemVXID string) (*ExportData, error) { @@ -321,6 +325,11 @@ func (c *Client) GetDataForExport(itemVXID string) (*ExportData, error) { // TODO: This appears to define the shape used for export. Validate how and where this is used // exportFormat := meta.Get("portal_mf868653", "original") + // clean up the title + title = strings.ReplaceAll(title, " ", "_") + title = nonAlphanumeric.ReplaceAllString(title, "") + title = consecutiveUnderscores.ReplaceAllString(title, "_") + out := ExportData{ Title: title, Clips: []*Clip{}, diff --git a/services/vidispine/shape_result.go b/services/vidispine/shape_result.go index 91f28286..c9a7b4cf 100644 --- a/services/vidispine/shape_result.go +++ b/services/vidispine/shape_result.go @@ -2,6 +2,7 @@ package vidispine import ( "github.com/samber/lo" + "net/url" ) func (sr ShapeResult) GetShape(tag string) *Shape { @@ -16,13 +17,15 @@ func (sr ShapeResult) GetShape(tag string) *Shape { func (s Shape) GetPath() string { // Cut off the "file://" prefix for _, fc := range s.ContainerComponent.File { - return fc.URI[0][7:] + p, _ := url.PathUnescape(fc.URI[0][7:]) + return p } // Does this make sense, can it be multiple files??? for _, bc := range s.BinaryComponent { for _, f := range bc.File { - return f.URI[0][7:] + p, _ := url.PathUnescape(f.URI[0][7:]) + return p } } diff --git a/workflows/asset_export-vx.go b/workflows/asset_export-vx.go index da50039b..6e784cdf 100644 --- a/workflows/asset_export-vx.go +++ b/workflows/asset_export-vx.go @@ -270,14 +270,11 @@ type MergeExportDataParams struct { func MergeExportData(ctx workflow.Context, params MergeExportDataParams) (*MergeExportDataResult, error) { logger := workflow.GetLogger(ctx) logger.Info("Starting MergeExportData") - - options := GetDefaultActivityOptions() - ctx = workflow.WithActivityOptions(ctx, options) - data := params.ExportData mergeInput, audioMergeInputs, subtitleMergeInputs := exportDataToMergeInputs(data, params.TempPath, params.OutputPath) + options := GetDefaultActivityOptions() options.TaskQueue = utils.GetTranscodeQueue() ctx = workflow.WithActivityOptions(ctx, options) var err error