INTERACT FORUM

Windows => Television => Topic started by: jachin99 on September 25, 2019, 11:30:13 am

Title: TV Post Processing
Post by: jachin99 on September 25, 2019, 11:30:13 am
Is there a way to run a postprocessing script after a recording ends in MC?  I want to trigger a script that cuts commercials.  Thanks.
Title: Re: TV Post Processing
Post by: jachin99 on September 25, 2019, 11:38:11 am
I found a thread describing how to do this per recording but I'm not sure how to do it for all recordings. 

Edit: I might have figured this out but we will see. 
Title: Re: TV Post Processing
Post by: muzicman0 on October 03, 2019, 04:58:36 pm
If you can't get it to work globally, you can script it.  Below is my powershell script to do exactly what you want.  You would have to do 3 things to make it work:

1. Change the $watcher.path variable to your recorded TV path
2. Change the path to your copy of Comskip
3. Set the execution policy for Powershell (here (https://blog.netspi.com/15-ways-to-bypass-the-powershell-execution-policy/) is a great resource I found online)

Code: [Select]
### SET FOLDER TO WATCH + FILES TO WATCH + SUBFOLDERS YES/NO
    $watcher = New-Object System.IO.FileSystemWatcher
    $watcher.Path = "D:\OneDrive\Recorded TV"
    $watcher.Filter = "*.ts"
    $watcher.IncludeSubdirectories = $true
    $watcher.EnableRaisingEvents = $true 

### DEFINE ACTIONS AFTER AN EVENT IS DETECTED
    $action = { $path = $Event.SourceEventArgs.FullPath
                $changeType = $Event.SourceEventArgs.ChangeType
                Start-Process -FilePath "C:\Users\Steven Wittwer\Documents\Comskip\comskip.exe" -ArgumentList `"$path`"
                Write-Host "$(Get-Date), ComSkip Processing started on $path"

              }

 
### DECIDE WHICH EVENTS SHOULD BE WATCHED
    Register-ObjectEvent $watcher "Created" -Action $action
#    Register-ObjectEvent $watcher "Changed" -Action $action
#    Register-ObjectEvent $watcher "Deleted" -Action $action
#    Register-ObjectEvent $watcher "Renamed" -Action $action
    while ($true) {sleep 5}

What this does is monitor for any new .ts files, and will run comskip on them.  I run the script on startup.