Skip to content

Commit e10dbe4

Browse files
authored
Merge pull request #395 from bcc-code/fix/shorts
Fix
2 parents ddcb3fa + d17b1d9 commit e10dbe4

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

workflows/export/generate_short.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package export
22

33
import (
44
"fmt"
5+
"regexp"
56
"strings"
67
"time"
78

@@ -33,6 +34,8 @@ type GenerateShortDataParams struct {
3334
DebugMode bool `json:"DebugMode"`
3435
}
3536

37+
var badChars = regexp.MustCompile(`[^a-zA-Z0-9-]`)
38+
3639
func validationError(msg string) error {
3740
return temporal.NewApplicationError(msg, "ValidationError")
3841
}
@@ -57,6 +60,11 @@ func GenerateShort(ctx workflow.Context, params GenerateShortDataParams) (*Gener
5760
return nil, validationError("InSeconds must be < OutSeconds")
5861
}
5962

63+
outputPath, err := paths.Parse(params.OutputDirPath)
64+
if err != nil {
65+
return nil, err
66+
}
67+
6068
exportData, err := wfutils.Execute(ctx, activities.Vidispine.GetExportDataActivity, vsactivity.GetExportDataParams{
6169
VXID: params.VXID,
6270
Languages: []string{"nor", "deu", "eng"},
@@ -89,7 +97,8 @@ func GenerateShort(ctx workflow.Context, params GenerateShortDataParams) (*Gener
8997
return nil, err
9098
}
9199

92-
titleWithShort := exportData.Title + "_short"
100+
titleWithShort := badChars.ReplaceAllString(exportData.Title, "_") + "_short"
101+
93102
clip := exportData.Clips[0]
94103
clip.InSeconds = params.InSeconds
95104
clip.OutSeconds = params.OutSeconds
@@ -165,7 +174,7 @@ func GenerateShort(ctx workflow.Context, params GenerateShortDataParams) (*Gener
165174
}
166175
}
167176

168-
shortVideoPath := tempFolder.Append(titleWithShort + "_cropped.mov")
177+
shortVideoPath := outputPath.Append(titleWithShort + "_cropped.mov")
169178

170179
var subtitlePaths *paths.Path
171180
if s, ok := clipResult.SubtitleFiles["no"]; ok {

0 commit comments

Comments
 (0)