@@ -2,6 +2,7 @@ package export
22
33import (
44 "fmt"
5+ "github.com/bcc-code/bcc-media-flows/activities"
56 "strings"
67
78 "github.com/bcc-code/bcc-media-flows/utils"
@@ -104,6 +105,17 @@ func VXExport(ctx workflow.Context, params VXExportParams) ([]wfutils.ResultOrEr
104105 return nil , err
105106 }
106107
108+ if len (data .Clips ) == 0 {
109+ wfutils .SendTelegramText (ctx , telegramChat ,
110+ fmt .Sprintf ("No clips found for `%s`.\n Title: `%s`\n Destinations: `%s`\n \n RunID: `%s`" ,
111+ params .VXID ,
112+ data .Title ,
113+ strings .Join (params .Destinations , ", " ),
114+ workflow .GetInfo (ctx ).OriginalRunID ,
115+ ),
116+ )
117+ }
118+
107119 wfutils .SendTelegramText (ctx ,
108120 telegramChat ,
109121 fmt .Sprintf (
@@ -134,18 +146,29 @@ func VXExport(ctx workflow.Context, params VXExportParams) ([]wfutils.ResultOrEr
134146 return nil , err
135147 }
136148
149+ firstClip , err := paths .Parse (data .Clips [0 ].VideoFile )
150+ if err != nil {
151+ return nil , err
152+ }
153+
154+ fileInfo , err := wfutils .Execute (ctx , activities .Audio .AnalyzeFile , activities.AnalyzeFileParams {
155+ FilePath : firstClip ,
156+ }).Result (ctx )
157+
158+ if err != nil {
159+ return nil , err
160+ }
161+
137162 ctx = workflow .WithChildOptions (ctx , wfutils .GetVXDefaultWorkflowOptions (params .VXID ))
138163
139164 bmmOnly := len (params .Destinations ) == 1 && (params .Destinations [0 ] == AssetExportDestinationBMM .Value || params .Destinations [0 ] == AssetExportDestinationBMMIntegration .Value )
140165
141- audioOnly := (len (data .Clips ) > 0 && data .Clips [0 ].VideoFile == "" ) || bmmOnly
142-
143166 var mergeResult MergeExportDataResult
144167 err = workflow .ExecuteChildWorkflow (ctx , MergeExportData , MergeExportDataParams {
145168 ExportData : data ,
146169 TempDir : tempDir ,
147170 SubtitlesDir : subtitlesOutputDir ,
148- MakeVideo : ! audioOnly ,
171+ MakeVideo : ! bmmOnly && fileInfo . HasVideo ,
149172 MakeAudio : true ,
150173 MakeSubtitles : true ,
151174 MakeTranscript : true ,
0 commit comments