Skip to content

Commit 040daca

Browse files
committed
Add temp folder
1 parent 842b680 commit 040daca

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

workflows/export/generate_short.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,12 @@ func GenerateShort(ctx workflow.Context, params GenerateShortDataParams) (*Gener
6464
activityOptions := wfutils.GetDefaultActivityOptions()
6565
ctx = workflow.WithActivityOptions(ctx, activityOptions)
6666

67-
outputDir := paths.MustParse(params.OutputDirPath)
67+
tempFolder, err := wfutils.GetWorkflowTempFolder(ctx)
68+
if err != nil {
69+
return nil, err
70+
}
6871

69-
subtitlesOutputDir := outputDir.Append("subtitles")
72+
subtitlesOutputDir := tempFolder.Append("subtitles")
7073
err = wfutils.CreateFolder(ctx, subtitlesOutputDir)
7174
if err != nil {
7275
return nil, err
@@ -101,7 +104,7 @@ func GenerateShort(ctx workflow.Context, params GenerateShortDataParams) (*Gener
101104

102105
mergeExportDataParams := MergeExportDataParams{
103106
ExportData: &data,
104-
TempDir: outputDir,
107+
TempDir: tempFolder,
105108
SubtitlesDir: subtitlesOutputDir,
106109
MakeVideo: true,
107110
MakeAudio: false,
@@ -118,8 +121,8 @@ func GenerateShort(ctx workflow.Context, params GenerateShortDataParams) (*Gener
118121
}
119122

120123
submitJobParams := activities.SubmitShortJobInput{
121-
InputPath: clipResult.VideoFile.Local(),
122-
OutputPath: outputDir.Local(),
124+
InputPath: clipResult.VideoFile.Linux(),
125+
OutputPath: tempFolder.Linux(),
123126
Model: "n",
124127
Debug: true,
125128
}
@@ -160,7 +163,7 @@ func GenerateShort(ctx workflow.Context, params GenerateShortDataParams) (*Gener
160163
}
161164
}
162165

163-
shortVideoPath := outputDir.Append(titleWithShort + "_cropped.mp4")
166+
shortVideoPath := tempFolder.Append(titleWithShort + "_cropped.mp4")
164167

165168
var cropRes activities.CropShortResult
166169
err = wfutils.Execute(ctx,

0 commit comments

Comments
 (0)