obs-powershell icon indicating copy to clipboard operation
obs-powershell copied to clipboard

Watch-OBSDirectory

Open StartAutomating opened this issue 2 years ago • 0 comments
trafficstars

aka Watch-OBSRecordDirectory (which would be the default path to watch).

This command will watch a directory using an IO.FileSystemWatcher.

When file events are found, they should be aggregated to ensure that duplicates are not sent (as the .net class is notorious for this).

An -Action should able to be provided that will be run whenever the aggregated event occurs.

This helps enable #118.

In fact, it could in it's entirety with other built in functionality, for example:

Watch-OBSDirectory -Path .\WhereverVideosWouldShowUp -Action {
    # $event is an automatic variable
    # $event.MessageData would probably hold the file
    $file = $event.MessageData
    if ($file  -like '*.mp4') { # If it's an .mp4
          $file | Show-OBS -Force # show it
    }
}

StartAutomating avatar Jun 02 '23 23:06 StartAutomating