Page 1 of 2
API question, change order of contents in a queue item?
Posted: March 23rd, 2011, 3:09 pm
by Usenet
Hi, when running
Code: Select all
api?mode=get_files&output=xml&value=SABnzbd_nzo_zt2syz
I get a nice formated output of all files being downloaded with a tag for files.
In the UI it's possible to promote one or several files to the top but what is the API for doing this?
Re: API question, change order of contents in a queue item?
Posted: March 23rd, 2011, 5:07 pm
by shypike
A quote from this
http://wiki.sabnzbd.org/api
Moving to a specific location in the queue.
URL: api?mode=switch&value=SABnzbd_nzo_zt2syz&value2=0
Description: "value2" is the position in the queue where you wish to move the object. 0 is the top of the queue, 1 is the second item, etc...
Re: API question, change order of contents in a queue item?
Posted: March 23rd, 2011, 5:18 pm
by Usenet
yes, that is moving the whole queue item, not the individual content

In this case I want to move id 2 to the top of the list to get it downloaded first..
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<files><file><status>active</status>
<mb>0.78</mb>
<age>1h</age>
<bytes>813927.00</bytes>
<filename>a.vol00+01.par2</filename>
<mbleft>1.00</mbleft>
<id>0</id>
</file>
<file><status>active</status>
<mb>1.55</mb>
<age>1h</age>
<bytes>1622959.00</bytes>
<filename>a.vol01+02.par2</filename>
<mbleft>1.00</mbleft>
<id>1</id>
</file>
<file><status>active</status>
<mb>3.08</mb>
<age>1h</age>
<bytes>3233618.00</bytes>
<filename>a.rar</filename>
<mbleft>1.00</mbleft>
<id>2</id>
</file>
Re: API question, change order of contents in a queue item?
Posted: March 23rd, 2011, 7:22 pm
by Usenet
is it
Code: Select all
URL: api?mode=switch&value=SABnzbd_nzo_zt2syz&id=2&value2=0
?
Re: API question, change order of contents in a queue item?
Posted: March 24th, 2011, 2:47 am
by shypike
For individual files there's no API call.
Re: API question, change order of contents in a queue item?
Posted: March 24th, 2011, 2:50 am
by Usenet
But I can do it in the we UI... any other way of doing this?
Re: API question, change order of contents in a queue item?
Posted: March 24th, 2011, 4:31 am
by sander
Usenet wrote:
In the UI it's possible to promote one or several files to the top but what is the API for doing this?
Out of curiosity: why/when is it useful to change to order of files within one download item?
Re: API question, change order of contents in a queue item?
Posted: March 24th, 2011, 4:39 am
by Usenet
I have working code for streaming movies using SAB. I I could promote the first rar to the top, the streaming could start earlier.... Another way I assume is rebuilding the nzb, but that is just messy, or skip downloading par files....
Re: API question, change order of contents in a queue item?
Posted: March 24th, 2011, 4:53 am
by shypike
SABnzbd is already trying to sort it in a streaming-friendly order.
Ignore the fact that the par2 files are at the front.
As soon as the first (and smallest) vol.par file is in, the rest goes to the back of the queue.
Re: API question, change order of contents in a queue item?
Posted: March 24th, 2011, 4:57 am
by Usenet
Ok, that was great news. Guess I'm just impatient when testing and got a slow connection, thats probably why it looked like all the pars where in the top. OneĀ thing to fix less before release is always good!
Re: API question, change order of contents in a queue item?
Posted: March 24th, 2011, 7:13 pm
by Usenet
When looking at the queue again it still seems as if xxx.vol01+2.par2 placed on top of the nzb gets downloaded first. the xxx.par2 is almost last in the queue and doesnt move during download....
Re: API question, change order of contents in a queue item?
Posted: March 25th, 2011, 2:27 am
by shypike
The basic par2 file isn't used. SABnzbd looks for the smallest vol.xx+yy.par2 file.
Maybe we should do something about it, but it's always been like this.
Re: API question, change order of contents in a queue item?
Posted: March 25th, 2011, 5:41 am
by Usenet
If the vol.xx+yy.par2 files are the exact same size (as they mostly seem to be) they all get downloaded first...
Maybe something to look into for next release as part of a "set streaming per job" feature...?
Re: API question, change order of contents in a queue item?
Posted: March 25th, 2011, 7:37 am
by shypike
If more server slots are available than articles in the first vol.par
then some more will be downloaded (at least partially).
As soon as the first one is in, the rest is kicked to the back of the queue.
It's not completely optimal, but shouldn't have much influence on actual streaming.
Optimizing this has been "on the list" for a while,
but there's so much else to improve...
Re: API question, change order of contents in a queue item?
Posted: March 25th, 2011, 12:29 pm
by sander
Usenet wrote:
Maybe something to look into for next release as part of a "set streaming per job" feature...?
I think building more functionality into SAB for streaming would be impressive. With the higher download speeds, streaming from newsgroups is more and more feasible. I played with it some time ago (using
http://code.google.com/p/stream-unrar/), and I was flabbergasted.
Note: rar-streaming demands perfect rar-files (right?), so SAB should inform the user about the rar-status. So: if the rar is not perfect (or the download too slow), notice the viewer (=user) about that.