Page 1 of 1

strange behavior with pre-queue script

Posted: January 29th, 2013, 4:48 pm
by Ludwig
I'm not sure where to put this. Hope it's okay here.

Code: Select all

@echo off
echo 1
echo.
echo.
echo.
echo.
if %3 == tv goto :tv
exit

:tv
if %6 LEQ 5368709120 echo 1
This is the script I'm using. Its purpose is to give anything in my "tv" category that's <= 5GiB top priority. It does its job pretty well so far, but whenever I click on a download that has its priority changed this way something strange happens. Upon the first click on the download, the GUI of SABnzbd switches its view from five downloads per page to viewing all downloads on the first page, when instead that download's details should appear. That however only happens on the 2nd click on that download.

Either I got the script wrong, or I found a bug in SABnzbd. Can anyone tell me which one it is?

PS: Fixed the script as suggested by sander.

Re: strange behavior with pre-queue script

Posted: January 29th, 2013, 5:41 pm
by sander
Won't this script always fall through to the final if-statement? I see no exit after the first if-statement.

Re: strange behavior with pre-queue script

Posted: January 29th, 2013, 6:34 pm
by Ludwig
You're right. It totally slipped my mind that batch files don't do subroutines, at least not the way I'm used to. Thanks for pointing this out.

The SABnzbd GUI now behaves normally again.

Re: strange behavior with pre-queue script

Posted: January 29th, 2013, 6:39 pm
by sander
That solves it? Strange.

Addtional remark: don't you need a "echo 0"? Or is SABnzbd with an empty / non-existing line?

Re: strange behavior with pre-queue script

Posted: January 30th, 2013, 7:45 pm
by Ludwig
Strange indeed, but that only occurred to me when I was about to go to bed no five minutes later. Serves me right for trying to do stuff when tired.

Yeah, well, it doesn't make sense because all it did before the fix was to change priorities of all downloads smaller than 5GiB and not just the "tv" ones. I can't explain it either. I can only report that today it works without messing up the GUI, even if I put that error back in. Must have been a hiccup that fixed itself, but that raises even more questions. I sometimes think these computers are living, breathing beings who's sole existence is to make out lives miserable.

I simply used the script from http://wiki.sabnzbd.org/user-pre-queue-script and changed it a bit. It also says on the site that a line "should only contain proper data (or be empty)."