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

Come up with a useful post-processing script? Share it here!
Post Reply
rdaraujo
Newbie
Newbie
Posts: 4
Joined: October 16th, 2011, 3:05 pm

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

Post 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?
User avatar
sander
Release Testers
Release Testers
Posts: 9429
Joined: January 22nd, 2008, 2:22 pm

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

Post 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.
rdaraujo
Newbie
Newbie
Posts: 4
Joined: October 16th, 2011, 3:05 pm

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

Post 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?
User avatar
sander
Release Testers
Release Testers
Posts: 9429
Joined: January 22nd, 2008, 2:22 pm

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

Post 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?
rdaraujo
Newbie
Newbie
Posts: 4
Joined: October 16th, 2011, 3:05 pm

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

Post 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?
User avatar
sander
Release Testers
Release Testers
Posts: 9429
Joined: January 22nd, 2008, 2:22 pm

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

Post by sander »

In http://localhost:8080/sabnzbd/config/categories/ ? Define a post-process script for the Default category?
rdaraujo
Newbie
Newbie
Posts: 4
Joined: October 16th, 2011, 3:05 pm

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

Post 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.
Post Reply