@@ -321,7 +321,7 @@ func runAnalyzeFootage(cmd *cobra.Command, args []string) error {
321321 os .MkdirAll (camDir , 0755 )
322322
323323 // Get seekpoints for activity-aware frame selection
324- activityTimes := getActivityTimes (cfg , camUUID , startMs , endMs , includeMotion )
324+ activityTimes := getActivityTimes (cfg , camUUID , startMs , endMs , includeMotion , nil )
325325
326326 // Select frames: prioritize activity, optionally fill remainder evenly
327327 frameTimes := selectFrameTimes (startMs , endMs , interval , activityTimes , fill )
@@ -380,7 +380,35 @@ func runAnalyzeFootage(cmd *cobra.Command, args []string) error {
380380
381381// ─── Frame Selection ────────────────────────────────────────────────
382382
383- func getActivityTimes (cfg config.Config , cameraUUID string , startMs , endMs int64 , includeMotion bool ) []int64 {
383+ // activityAliases maps user-friendly names to ActivityEnum values.
384+ var activityAliases = map [string ]string {
385+ "human" : "MOTION_HUMAN" ,
386+ "vehicle" : "MOTION_CAR" ,
387+ "car" : "MOTION_CAR" ,
388+ "animal" : "MOTION_ANIMAL" ,
389+ "face" : "FACE" ,
390+ "licenseplate" : "LICENSEPLATE" ,
391+ "motion" : "MOTION" ,
392+ "tamper" : "TAMPER" ,
393+ "sound" : "SOUND_LOUD" ,
394+ "gunshot" : "SOUND_GUN_SHOT" ,
395+ }
396+
397+ // resolveActivityTypes converts user-friendly names to ActivityEnum values.
398+ // Unrecognized values are passed through as-is (assumed to be raw enum values).
399+ func resolveActivityTypes (types []string ) []string {
400+ var resolved []string
401+ for _ , t := range types {
402+ if mapped , ok := activityAliases [strings .ToLower (strings .TrimSpace (t ))]; ok {
403+ resolved = append (resolved , mapped )
404+ } else {
405+ resolved = append (resolved , strings .TrimSpace (t ))
406+ }
407+ }
408+ return resolved
409+ }
410+
411+ func getActivityTimes (cfg config.Config , cameraUUID string , startMs , endMs int64 , includeMotion bool , activityTypes []string ) []int64 {
384412 startSec := startMs / 1000
385413 durationSec := (endMs - startMs ) / 1000
386414
@@ -389,7 +417,7 @@ func getActivityTimes(cfg config.Config, cameraUUID string, startMs, endMs int64
389417 "startTime" : startSec ,
390418 "duration" : durationSec ,
391419 }
392- if includeMotion {
420+ if includeMotion || len ( activityTypes ) > 0 {
393421 params ["includeAnyMotion" ] = "true"
394422 }
395423
@@ -401,12 +429,26 @@ func getActivityTimes(cfg config.Config, cameraUUID string, startMs, endMs int64
401429
402430 seekpoints , _ := resp ["footageSeekPoints" ].([]any )
403431 fmt .Fprintf (os .Stderr , " Seekpoints found: %d\n " , len (seekpoints ))
432+
433+ // Build filter set
434+ filterSet := make (map [string ]bool , len (activityTypes ))
435+ for _ , at := range activityTypes {
436+ filterSet [at ] = true
437+ }
438+
404439 var times []int64
405440 for _ , sp := range seekpoints {
406441 s , ok := sp .(map [string ]any )
407442 if ! ok {
408443 continue
409444 }
445+ // Filter by activity type if specified
446+ if len (filterSet ) > 0 {
447+ activity , _ := s ["a" ].(string )
448+ if ! filterSet [activity ] {
449+ continue
450+ }
451+ }
410452 ts , _ := s ["ts" ].(float64 )
411453 if ts > 0 {
412454 times = append (times , int64 (ts ))
0 commit comments