Page 1 of 1

How can I sort by size? Always

Posted: May 17th, 2014, 5:49 pm
by biff
Every time I download a bunch I have to go and manually sort by size from smallest to largest. Is there a way to just have it always do it? IN the options I can see that I can sort by age but by size would really be nice. It makes little sense to have ten 1GB sized shows waiting behind a 20GB movie.

Re: How can I sort by size? Always

Posted: May 18th, 2014, 2:49 am
by sander
You can you that via the SAB API (See http://wiki.sabnzbd.org/api#toc24), using a script.

Example:
Get queue, and we're only interested in nzo name and size:

Code: Select all

sander@flappie:~$ lynx --dump 'http://localhost:8080/api?mode=queue&output=xml' | grep -i -e nzo_id -e '<size>'
<nzo_id>SABnzbd_nzo_f34kP8</nzo_id>
<size>1.9 GB</size>
<nzo_id>SABnzbd_nzo_SqYCAW</nzo_id>
<size>622 MB</size>
<nzo_id>SABnzbd_nzo_XscFMc</nzo_id>
<size>13.2 GB</size>
<size>0 B</size>
sander@flappie:~$ 
We want the smallest (so 622MB) to the top

Code: Select all

sander@flappie:~$ lynx --dump 'http://localhost:8080/api?mode=switch&value=SABnzbd_nzo_SqYCAW&value2=0'
0 0
... and that worked; the smallest download is at the top:

Code: Select all

sander@flappie:~$ lynx --dump 'http://localhost:8080/api?mode=queue&output=xml' | grep -i -e nzo_id -e '<size>'
<nzo_id>SABnzbd_nzo_SqYCAW</nzo_id>
<size>622 MB</size>
<nzo_id>SABnzbd_nzo_f34kP8</nzo_id>
<size>1.9 GB</size>
<nzo_id>SABnzbd_nzo_XscFMc</nzo_id>
<size>13.2 GB</size>
<size>0 B</size>
sander@flappie:~$
So you could write a script for that, and run it each 5 minutes.