strange behavior with pre-queue script

Come up with a useful post-processing script? Share it here!
Post Reply
Ludwig
Newbie
Newbie
Posts: 17
Joined: July 25th, 2011, 10:07 am

strange behavior with pre-queue script

Post 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.
Last edited by Ludwig on January 29th, 2013, 6:37 pm, edited 2 times in total.
User avatar
sander
Release Testers
Release Testers
Posts: 9062
Joined: January 22nd, 2008, 2:22 pm

Re: strange behavior with pre-queue script

Post by sander »

Won't this script always fall through to the final if-statement? I see no exit after the first if-statement.
Ludwig
Newbie
Newbie
Posts: 17
Joined: July 25th, 2011, 10:07 am

Re: strange behavior with pre-queue script

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

Re: strange behavior with pre-queue script

Post by sander »

That solves it? Strange.

Addtional remark: don't you need a "echo 0"? Or is SABnzbd with an empty / non-existing line?
Ludwig
Newbie
Newbie
Posts: 17
Joined: July 25th, 2011, 10:07 am

Re: strange behavior with pre-queue script

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