Page 1 of 1

How do I setup Newbin to launch a script/EXE after unraring

PostPosted: Mon May 21, 2012 3:55 am
by mkanet
How do I setup Newbin to launch a script or EXE after it has finished unraring/cleanup of rars? I need it to launch my media file renamer and media center import utilities.

Thanks,
MKANET

Re: How do I setup Newbin to launch a script/EXE after unrar

PostPosted: Mon May 21, 2012 7:21 am
by Quade
Can't currently. I can add it to my todo list though. What kind of support for command lines parameters would it need? Just the filename? Would it invoke once per filename?

Re: How do I setup Newbin to launch a script/EXE after unrar

PostPosted: Mon May 21, 2012 8:22 pm
by mkanet
Thank you. I think this would be a great feature addition (executed once after successful unraring/cleanup of a multi-part rar file).

I think as long as Newsbin can execute a single .cmd, bat., or exe, it would be extremely useful. People can add arguments, complex parameters, execute subsequent apps all within the .cmd/bat file if they want.

Re: How do I setup Newbin to launch a script/EXE after unrar

PostPosted: Mon May 21, 2012 9:32 pm
by Quade
Your idea is lacking details. Just executing a cmd file is pretty useless without some parameters. What happens if there are 5 files in the RAR set? How does the command file know what path to look in? Maybe I'm making this too complicated. Still, some actual operational details would help. I'd never use this feature so it's necessary for someone else to define the requirements.

Look at what command files you might run and try to explain to me how they know what to do.

Re: How do I setup Newbin to launch a script/EXE after unrar

PostPosted: Mon May 21, 2012 10:25 pm
by mkanet
I'm not sure how other people would do it, but for me, my script is smart enough to know what to do without any extra parameters since it's written specifically for my downloads folder. As long as the script gets kicked off after each nzb is downloaded, extracted, and rars are all cleaned up, it would work great for me.

My script kicks off a very smart fully automatic command-line newreader-friendly TV/movie renamer:
http://forums.sagetv.com/forums/showthread.php?t=58024
...which identifies and renames any TV show(s) or movie(s) in a given folder/subfolders recursively. It will even rename the folders rar extracted folders containing each media file. The renamer also recognizes bluray/dvd image directories, and renames only the root folder of the movie image. After the renamer is done, in my script, there' a general media file that gets kicked off for my media center software to import the files.

In fact, I already have this script working for me. However, I have to rely on my directory monitoring software; which kicks off this same script when it detects there are new media files in the downloads folder that aren't in use. Unfortunately, my directory monitoring tool sometimes kicks off the script too soon (during the newbin un-raring process in the .tmp directory).

By having newsbin kick off the script instead of my directory monitoring tool, it would know exactly when the files are all extracted and rar files are cleaned up/deleted.

start-scan.cmd (renamer tool is java based). Media scan is envoked through a web-interface.
Code: Links not allowed for unregistered users
REM next couple of lines of code is used to prevent multiple instances of Renamer
tasklist /FI "IMAGENAME eq java.exe" 2>NUL | find /I /N "java.exe">NUL
if "%ERRORLEVEL%"=="0" goto END

C:\Progra~2\COMMAN~1\phoenix-renamer.exe --renameDirectories --renameArtifacts E:\Downloads

C:\PROGRA~2\COMMAN~1\wget.exe --tries=3 --directory-prefix="C:\PROGRA~2\Command line" --no-check-certificate "https://mkanet:password@localhost:8090/sage/GlobalCommand?command=UpdateMediaLibrary"
del "C:\PROGRA~2\Command line\GlobalCommand*.*"

:END

Re: How do I setup Newbin to launch a script/EXE after unrar

PostPosted: Tue May 22, 2012 9:07 am
by Quade
Ok, thanks for the details.