Does the dvr refresh it's files at a certain interval?


I noticed that if I remove commercials from a file it wont update the length of the file until I manually refresh. Does it ever go back and refresh files it’s already recorded?

MCEBuddy - Channels DVR files

It currently does not.


I just made this command to refresh every file completed from the log. Any negatives to running this nightly?

cat ~/channels-dvr/data/channels-dvr.log | grep “Running commercial detection on file” | sed -n ‘s/^.file/file/p’ | sed 's/([^)])//g’ | sed “s/file //g” | sed ‘s/[[:blank:]]*$//’ | awk ‘{print “curl -XPUT http://localhost:8089/dvr/files/” $0;}’ | awk ‘{print $0"/reprocess"}’ | while read line ; do $line ; done


That should be fine. I can also add an API which refreshes all files so you don’t need the loop.

Eventually we definitely plan to add custom post processing scripts so you can do things like this without log parsing.


that sounds great, thanks for the insight


Are there still plans to add in the option to refresh files automatically? I’m still using mce buddy and would love to have this feature. In the mean time, how in the world would I run the above command in windows?


It should run with little mod if you installed the Linux subsystem on windows 10, if not you would need to convert it to powershell or something similar.


Noobie with this stuff. Not sure if I have a Linux subsystem but I do know the basics of running power shell commands but not clear how to convert anything. Could you help a brother out?


how about i give you the quickest way for me, then i look at powershell :slight_smile:

Note: im at work so I dont have a real log file, just a default one.
you must be running the anniversary edition or later
in an administrative powershell command prompt:

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
#Reboot PC
#press y to install, it will take a couple minutes
#you will create a user and password.
#now you can run the bashshell from a Windows command line.
bash -c "cat /mnt/c/ProgramData/ChannelsDVR/data/channels-dvr.log | grep "Running commercial detection on file" | sed -n 's/^.file/file/p' | sed 's/([^)])//g' | sed "s/file //g" | sed 's/[[:blank:]]*$//' | awk '{print "curl -XPUT http://localhost:8089/dvr/files/" $0;}' | awk '{print $0"/reprocess"}' | while read line ; do $line ; done""

I tested as far as:

bash -c "cat /mnt/c/ProgramData/ChannelsDVR/data/channels-dvr.log | grep "Pruned""

now to uninstall before IT comes knocking on my door…


Ok, i was able to find time to setup a DVR on windows, record some shows then rewrite the script for powershell. let me know how it goes!

run powershell (from search, just type powershell)
if you installed everything as default the execute this command:
select-string -path C:\ProgramData\ChannelsDVR/data/channels-dvr.log "(?<=Running commercial detection on file).*?(?=\()" | %{$_.Matches} | %{$_.value} | %{$_.trim()} | % {invoke-webrequest -method put "http://localhost:8089/dvr/files/$_/reprocess"}

I dont use MCEBuddy, but this does reprocess files that had commercial skipping, just like the other one, and its harmless to run.

i dont know how you kick-off this script, but if you call it from a normal command prompt, then you should paste it into a text file and save it something like Reprocess-Files.ps1 and then you can execute it from a command prompt with “Powershell C:\Scripts\Reprocess-Files.ps1” (or whereever you put it)

EDIT: had to reformat the command as Preformatted text. woopsie!


Man thanks a million! Is there a way to have this automatically run once a day or is that too complicated?


naw, thats not that bad. there is a task scheduler in Windows. “Tasksched.msc” that you can run and create a scheduled task to run daily. you can do this with the wizard.

of course everything is scriptable, so if you can open an administrative powershell prompt, you can run the following script by copy/pasting it to the powershell:
Note: Line 1 contains the script file that was created in the previous post. line 3 contains the 05:00, if you dont want to run it at 5AM, change that.

$PathToScript = "c:\scripts\reprocess-files.ps1"
#Create a new trigger that is configured to trigger at startup
$STTrigger = New-ScheduledTaskTrigger -daily -at 05:00
#Name for the scheduled task
$STName = "Channels DVR - Reprocess DVR files"
#Action to run as
$STAction = New-ScheduledTaskAction -Execute "powershell.exe" -argument $PathToScript
#Configure when to stop the task and how long it can run for. In this example it does not stop on idle and uses the maximum possible duration by setting a timelimit of 0
$STSettings = New-ScheduledTaskSettingsSet -DontStopOnIdleEnd -ExecutionTimeLimit ([TimeSpan]::Zero)
#Configure the principal to use for the scheduled task and the level to run as
$STPrincipal = New-ScheduledTaskPrincipal -UserId "LOCALSERVICE" -LogonType ServiceAccount
#Register the new scheduled task
Register-ScheduledTask $STName -Action $STAction -Trigger $STTrigger -Principal $STPrincipal -Settings $STSettings


I know this is old but I just started testing this out today. I'm getting bunch of errors, does any this make sense?

invoke-webrequest : {"error":"file not found"}
At line:1 char:173
+ ... rim()} | % {invoke-webrequest -method put " ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand


@tmm1 any plans to get this added, so we don't have to run a script? Just some nightly cleanup process or something?


It's trying to refresh deleted recordings which no longer exist.