API question, change order of contents in a queue item?

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Usenet
Jr. Member
Jr. Member
Posts: 87
Joined: February 12th, 2008, 6:04 pm

API question, change order of contents in a queue item?

Post 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?
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: API question, change order of contents in a queue item?

Post 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...
Usenet
Jr. Member
Jr. Member
Posts: 87
Joined: February 12th, 2008, 6:04 pm

Re: API question, change order of contents in a queue item?

Post by Usenet »

yes, that is moving the whole queue item, not the individual content :D
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> 
Last edited by Usenet on March 23rd, 2011, 5:33 pm, edited 1 time in total.
Usenet
Jr. Member
Jr. Member
Posts: 87
Joined: February 12th, 2008, 6:04 pm

Re: API question, change order of contents in a queue item?

Post by Usenet »

is it

Code: Select all

URL: api?mode=switch&value=SABnzbd_nzo_zt2syz&id=2&value2=0
?
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: API question, change order of contents in a queue item?

Post by shypike »

For individual files there's no API call.
Usenet
Jr. Member
Jr. Member
Posts: 87
Joined: February 12th, 2008, 6:04 pm

Re: API question, change order of contents in a queue item?

Post by Usenet »

But I can do it in the we UI... any other way of doing this?
User avatar
sander
Release Testers
Release Testers
Posts: 8829
Joined: January 22nd, 2008, 2:22 pm

Re: API question, change order of contents in a queue item?

Post 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?
Please don't send me unrequested PM's; the forum is the best way to communicate.
If someone helps you, please reply to that help.
f you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
Usenet
Jr. Member
Jr. Member
Posts: 87
Joined: February 12th, 2008, 6:04 pm

Re: API question, change order of contents in a queue item?

Post 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....
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: API question, change order of contents in a queue item?

Post 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.
Usenet
Jr. Member
Jr. Member
Posts: 87
Joined: February 12th, 2008, 6:04 pm

Re: API question, change order of contents in a queue item?

Post 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!
Usenet
Jr. Member
Jr. Member
Posts: 87
Joined: February 12th, 2008, 6:04 pm

Re: API question, change order of contents in a queue item?

Post 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....
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: API question, change order of contents in a queue item?

Post 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.
Usenet
Jr. Member
Jr. Member
Posts: 87
Joined: February 12th, 2008, 6:04 pm

Re: API question, change order of contents in a queue item?

Post 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...?
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: API question, change order of contents in a queue item?

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

Re: API question, change order of contents in a queue item?

Post 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.
Please don't send me unrequested PM's; the forum is the best way to communicate.
If someone helps you, please reply to that help.
f you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
Post Reply