Page 1 of 1

[Windows] Can't get post-script to run

Posted: October 16th, 2011, 3:14 pm
by rdaraujo
So, I've made a script to rename the folder downloaded.

Here is renamer.cmd, located on the Post-Processing Scripts Folder.

Code: Select all

@echo off
set fullPath=%1
java SabnzbdRenamer %fullPath%
exit 0
On the folder, I have SabnzbdRenamer.class, which do the rename stuff.

But, once a download is complete, nothing happens. The log show nothing related.
I think the script was recognized by SABnzbd, because it is shown on the Pre-queue user script dropdown menu.

Where should I look to get it working?

Re: [Windows] Can't get post-script to run

Posted: October 16th, 2011, 3:19 pm
by sander
I would start by putting a 'logger' in the renamer.cmd: something that writes a message + date to a separate logfile. I haven't got Windows here, but DOS/WIndows must have a DATE command. If so "DATE ... >>> C:\temp\mylogfile.log" should work. Do it before and after the java call.

Re: [Windows] Can't get post-script to run

Posted: October 16th, 2011, 4:00 pm
by rdaraujo
Thank you sander.

So, as suggested I put some trace log.

Code: Select all

@echo off
set fullPath=%1
echo %date% - %time% - Before java call >> log.log
java SabnzbdRenamer %fullPath%
echo %date% - %time% - After java call >> log.log
exit 0
Unfortunatelly, no log.log was created (it seems the script is not being calling at all).
One thing I noticed is that the scripts folder is locked by SABnzbd (tried do rename it and was unable).

Any suggestions?

Re: [Windows] Can't get post-script to run

Posted: October 16th, 2011, 4:12 pm
by sander
Is the extension .CMD OK for Windows? Can you run the script from a CMD-box? What if you rename to .BAT?

Is .CMD in your PATHEXT?

Re: [Windows] Can't get post-script to run

Posted: October 16th, 2011, 4:38 pm
by rdaraujo
Thank you again sander.

So, I figured out that when there is something on queue, a dropdown menu appears on the line (beside the Category, Priority and Processing dropdown). ;D
As I was testing with very small size downloads, I could even see that menu.
Maybe it is interesting to document this on the wiki.

Image

As far as I see, for each download you have to select the script name on the menu (here it starts with none).
Is there any method to setup any script as default to every download, so I don't have to select it manually?

Re: [Windows] Can't get post-script to run

Posted: October 16th, 2011, 5:02 pm
by sander
In http://localhost:8080/sabnzbd/config/categories/ ? Define a post-process script for the Default category?

Re: [Windows] Can't get post-script to run

Posted: October 16th, 2011, 5:12 pm
by rdaraujo
Yeah, that's right ;D
As I don't use any categories, in that page you can define a script to be default for all one.

Thank you so much sander, you really guide me to setup this correctly.