Skip to content

Commit

Permalink
paths and naming
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikvedvik committed Sep 13, 2023
1 parent 3d5130e commit 09b8eb5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
9 changes: 9 additions & 0 deletions services/vidispine/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package vidispine
import (
"errors"
"fmt"
"regexp"
"strconv"
"strings"

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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{},
Expand Down
7 changes: 5 additions & 2 deletions services/vidispine/shape_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package vidispine

import (
"github.com/samber/lo"
"net/url"
)

func (sr ShapeResult) GetShape(tag string) *Shape {
Expand All @@ -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
}
}

Expand Down
5 changes: 1 addition & 4 deletions workflows/asset_export-vx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 09b8eb5

Please sign in to comment.