PDA

View Full Version : Need help command-lining staxrip


theredbaron37
25th September 2006, 03:06
I posted this in the staxrip support forum, but I thought I'd ask the greater population too.
Hello,
I recently gave up on AutoGK because of it's lack of command line automation. I tried a script for it but it didn't work well. I really like StaxRip, especially the command line features. However, I am not very experienced with CL stuff and I was wondering if you wonderful folks could help me out. I use Gb-PVR to record TV shows in MPG-2 format. After each recording, a post-processing batch file is launched. The batch calls on a commercial skipping utility, a video cutter to cut them out, and a file renaming utility. I would like to add transcoding to XVid to the batch, and I'm afraid I'm not familiar enough with command lining to do it.

I've created two templates: one called sitcom that takes a 20-30 min show and converts to 175MB xvid avi, and another called drama that takes a 40-60 min show and converts to 350mb xvid avi. The way to tell if an mpg-2 falls into either category is that anything above 1.3GB will be considered drama, and anything below can be considered sitcom.

What I would like to do is have a batch/script (might need specific instructions) that does a few things:
1) Runs as one script until completion, so that batch items after the script is called don't run prematurely.
2) Decides what template to use for a file (based on the size requirements above)
3) Runs without user input
4) If an encoding is in progress, and another recording is completing in PVR, the new recording gets queued and encoded after the current one is complete.

I've looked at the command line stuff and so far came up with:

"C\Directory\StaxRip\StaxRip.exe" -t:drama -e %1

That did not work, I got error messages saying: could not find file " ". I am admitedly a total n00b, but I'm pretty savvy at picking up this stuff. I just need some help figuring out what I need to do to accomplish the objectives listed above. Any help will be greatly appreciated. Thank you.

Pookie
25th September 2006, 22:08
%1 is the name of the file you're running the script against (ie staxrip.exe -t:drama myfile.mpg)

myfile.mpg replaces %1

1) Runs as one script until completion, so that batch items after the script is called don't run prematurely.
start /wait /b <first.exe>
start /wait /b <second.exe>
start /wait /b <third.exe>




Here's a beginning tutorial on batch scripting:

http://www.allenware.com/icsw/icswidx.htm


2) Decides what template to use for a file (based on the size requirements above)
This page(s) will give you batch file functions to do file size comparisons

http://www.commandline.co.uk/lib/treeview/index.php

Look under "File and Directory Functions"

3) Runs without user input

for %%a in *.mpg do staxrip.exe -t:%type_of_show% %%a

4) If an encoding is in progress, and another recording is completing in PVR, the new recording gets queued and encoded after the current one is complete.

theredbaron37
26th September 2006, 12:49
Wow, thanks a lot for this. I managed to do something a bit more crude, to the tune of:
IF %1 GTR 1610612736 "staxrip.exe" -t:drama %1 -e ELSE "staxrip.exe" -t:sitcom -e

So that takes care of deciding what template based on filesize.

"start /wait /b" what does the /b denote?

"for %%a in *.mpg do staxrip.exe -t:%type_of_show% %%a" I'm sorry, can you explain what each term means (%%a is a variable like %1 right?). And how/where do I define each variable (%%a, %type_of_show%)?

And if I understand correctly, staxrip will auto-enqueue encodings, i.e. not run more than one at a time?

Pookie
30th September 2006, 03:00
Source: http://www.allenware.com/icsw/icswref.htm#ListBox

FOR (IN DO, repeat command on files, or strings)
Remember to use the /? switch for basic syntax help.
Internal command. Accepts Wildcards.

for %%f in (*.txt) do type %%f
For each file (not hidden or system) with extension TXT in current folder), TYPEs the file.

for %%n in (one two three) do echo.%%n
ECHOes one, then two, then three as if you'd used three separate ECHO commands.

for %%n in (one two) do echo.%%n>>F.TXT
Writes one, then two on separate lines to F.TXT (note the need to use >> append operator, otherwise the file will contain only the last item (two).

for %%s in ("one two three") do echo.%%s
Treats one two three as single string. ECHOes it without the "quotes".

The metavariable %%v can use any letter (or most other characters). You can use %v (single % ) in immediate mode. Use %% format in a Batch file.