SageTV Community

SageTV Community (http://forums.sagetv.com/forums/index.php)
-   SageTV Customizations (http://forums.sagetv.com/forums/forumdisplay.php?f=27)
-   -   Automated VideoRedo (DOS batch files) (http://forums.sagetv.com/forums/showthread.php?t=31029)

grauchy 02-28-2008 01:07 PM

Automated VideoRedo (DOS batch files)
 
Just thought I'd share this with everyone else. I spent quite a bit of time perfecting this and it works for me rather well. I use ShowAnalyzer to generate .vprj VideoRedo files. And VideoRedo to remove the commercials.

After doing this I can then view shows in SageTV seamlessly. Plus it gives my SageTV machine 25% more recording capacity.

I wrote some batch files that will select the oldest** .vprj file in the recording directory and run VideoRedo automatically. I have several computers running the batch files 24/7. They don't quite keep up with my recordings but it's pretty close. Anyway here's what I've got:


I have three recording directories on my Sage machine and all three are shared on my network as shown below:
\\hdtv\recordings-e\
\\hdtv\recordings-f\
\\hdtv\recordings-g\

VideoReDoBatch-E.bat
This batch file finds the oldest .vprj file in the folder then is launches VideoRedo. After that it Launches VideoReDoBatch-F.bat.
VideoRedoBatch-F.bat is just like E except for the next folder.
F then calls on G, G then calls back to E, and the sequence runs forever.

Code:

@echo off
for /f %%a in ('dir \\hdtv\recordings-e\*.vprj /b /a:-d /o:-d') do set Oldest=%%~na
IF EXIST \\hdtv\recordings-e\%OLDEST%.mpg call c:\VR_Launch \\hdtv\recordings-e\%OLDEST%.vprj
wscript.exe "C:\invis.vbs" "VideoReDoBatch-F.bat"

VR_Launch.bat
This batch file launches VideoRedo and specifies where to write the output .mpg file.
I have it going to e:\videos\videoredo\ on the local machine but you can send it anywhere.
After VideoRedo is done the batch file moves the .mpg file back to the recording directory.
Then the batch file deletes the .cut .edl .vprj files and places a blank .txt file to prevent Dirmon2 from generating another .vprj file.


Code:

call c:\windows\system32\cscript //nologo "C:\Program Files\VideoReDoPlus\vp.vbs" %1 e:\videos\videoredo\%~n1.mpg /t1 /e /q
@echo on
@echo Moving %~n1.mpg back to \\%~p1
move e:\videos\videoredo\%~n1.mpg \\%~p1
@echo Deleting extraneous files
del \\%~pn1.cut
del \\%~pn1.edl
del \\%~pn1.vprj
@echo replace .txt file
copy c:\blank.txt c:\%~n1.txt
move c:\%~n1.txt \\%~p1

**I have this code running on 4 computers. One of them grabs the oldest .vprj file as in the example above. The second one grabs the newest .vprj file it can find. I can't remember what the other ones do but they grab something else like the smallest file or the biggest file or something like that. This is to prevent any two machines from working on the same file at once.

You can change the sort on the "dir" command to anything you want. It's the /o switch.
Quote:

/O List by files in sorted order, sortorder:
N By name (alphabetic)
S By size (smallest first)
E By extension (alphabetic)
D By date & time (earliest first)
G Group directories first
- Prefix to reverse order
A By Last Access Date (earliest first)
I am not running this code on my actual SageTV server as I do not want to grind the machine to a halt.

Admittedly the batch files are a crude way of getting this done but it works for me. If you have any questions how to get this working for you just post here I'd be glad to assist. Or if you have a better solution let me know.

BKeadle 09-05-2011 10:27 AM

Quote:

Originally Posted by grauchy (Post 268262)
Just thought I'd share this with everyone else. I spent quite a bit of time perfecting this and it works for me rather well. I use ShowAnalyzer to generate .vprj VideoRedo files. And VideoRedo to remove the commercials.

After doing this I can then view shows in SageTV seamlessly. Plus it gives my SageTV machine 25% more recording capacity.

I wrote some batch files that will select the oldest** .vprj file in the recording directory and run VideoRedo automatically. I have several computers running the batch files 24/7. They don't quite keep up with my recordings but it's pretty close. Anyway here's what I've got:


I have three recording directories on my Sage machine and all three are shared on my network as shown below:
\\hdtv\recordings-e\
\\hdtv\recordings-f\
\\hdtv\recordings-g\

VideoReDoBatch-E.bat
This batch file finds the oldest .vprj file in the folder then is launches VideoRedo. After that it Launches VideoReDoBatch-F.bat.
VideoRedoBatch-F.bat is just like E except for the next folder.
F then calls on G, G then calls back to E, and the sequence runs forever.

Code:

@echo off
for /f %%a in ('dir \\hdtv\recordings-e\*.vprj /b /a:-d /o:-d') do set Oldest=%%~na
IF EXIST \\hdtv\recordings-e\%OLDEST%.mpg call c:\VR_Launch \\hdtv\recordings-e\%OLDEST%.vprj
wscript.exe "C:\invis.vbs" "VideoReDoBatch-F.bat"

VR_Launch.bat
This batch file launches VideoRedo and specifies where to write the output .mpg file.
I have it going to e:\videos\videoredo\ on the local machine but you can send it anywhere.
After VideoRedo is done the batch file moves the .mpg file back to the recording directory.
Then the batch file deletes the .cut .edl .vprj files and places a blank .txt file to prevent Dirmon2 from generating another .vprj file.


Code:

call c:\windows\system32\cscript //nologo "C:\Program Files\VideoReDoPlus\vp.vbs" %1 e:\videos\videoredo\%~n1.mpg /t1 /e /q
@echo on
@echo Moving %~n1.mpg back to \\%~p1
move e:\videos\videoredo\%~n1.mpg \\%~p1
@echo Deleting extraneous files
del \\%~pn1.cut
del \\%~pn1.edl
del \\%~pn1.vprj
@echo replace .txt file
copy c:\blank.txt c:\%~n1.txt
move c:\%~n1.txt \\%~p1

**I have this code running on 4 computers. One of them grabs the oldest .vprj file as in the example above. The second one grabs the newest .vprj file it can find. I can't remember what the other ones do but they grab something else like the smallest file or the biggest file or something like that. This is to prevent any two machines from working on the same file at once.

You can change the sort on the "dir" command to anything you want. It's the /o switch.


I am not running this code on my actual SageTV server as I do not want to grind the machine to a halt.

Admittedly the batch files are a crude way of getting this done but it works for me. If you have any questions how to get this working for you just post here I'd be glad to assist. Or if you have a better solution let me know.

Thanks for posting this. I'm looking to do something similar. A couple questions:
1) you batch file reference c:\invis.vbs - what is that? what does it do?
2) I have the .vprj being generated on the server. thus the .vprj file references the path relative to the server. If I have a client processing the video and the associated .vprj file, how does it handle the different path to the video file?

matt91 09-06-2011 09:00 AM

I did this same thing once upon a time, but the (lack of) stability was a problem for me. It work fine for 2 or 3 days, but then a process would fail and it would hang. i had to kill them to get the batch files running again, and that was a hassle.

my server certainly may have been underpowered for what I was asking of it, but i'm not sure.

how is your stability? do these processes ever hang?

wayner 09-08-2011 10:01 PM

Quote:

Originally Posted by grauchy (Post 268262)
**I have this code running on 4 computers. One of them grabs the oldest .vprj file as in the example above. The second one grabs the newest .vprj file it can find. I can't remember what the other ones do but they grab something else like the smallest file or the biggest file or something like that. This is to prevent any two machines from working on the same file at once.

Wow - 4 computers! How many files do you record? I haven't used VRD in batch but it is pretty fast when you are doing cuts on mpg files. And it doesn't take too long to do the comm scan does it? I know that Comskip can do it in about 6X realtime (ie 5 mins for a 30 min show) on my PC.

Or are they just really slow PCs.


All times are GMT -6. The time now is 03:18 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.