Page 1 of 1
API addfile: name parameter is ignored
Posted: December 31st, 2012, 7:23 am
by RuudBurger
When using the addfile function in combination with the name parameter (like below), the name is ignored when sending a zip file containing 1 .nzb file
http://host:port/sabnzbd/api?mode=addfile&name=<filename>&cat=<category>
I use this to send nzbs for CouchPotato. Now it works fine for most providers, but spotweb providers sometimes return a zip file (it's an option in spotweb to use .zip or .nzb). I assume SAB extracts the zip and uses the name of the .nzb file and then adds it to the queue. I understand this when uploading a zip with multiple files (manually). But automated processes include the name parameter for a reason
This zip file contains a single .nzb file. What I would like is to use the name parameter when it's a zip file. Just like it would when doing the same requests with .nzb file.
Tested on version: 0.7.7
Thanks!
Re: API addfile: name parameter is ignored
Posted: December 31st, 2012, 7:39 am
by shypike
There are two names to choose from, so picking one is arbitrary.
SABnzbd always uses the internal names in ZIP files, because the format
is oriented towards multiple files.
The proper way to do the API call would be to use the extra parameter "nzbname".
This isn't supported currently, but I'm willing to change that.
Using the "name" parameter is not consitent with the way SABnzbd generally treats
ZIP files and it would change behaviour from previous releases.
Re: API addfile: name parameter is ignored
Posted: December 31st, 2012, 7:51 am
by RuudBurger
Something that would force the name (on single .nzb zipfile) would be great, thanks.
Now I have to tell my users they need to change the spotweb setting, which isn't ideal.
Or a way to get the name (or ID) it was added to the queue with, would also work. I can't use api?mode=queue&name=rename&value=SABnzbd_nzo_zt2syz&value2=THENEWNAME because I don't know the name. I could guess it, but when adding more stuff to the query at the same time, it could go wrong quite easily.
Re: API addfile: name parameter is ignored
Posted: December 31st, 2012, 8:18 am
by shypike
I changed the code to support "nzbname", because that is more consistent anyway
while not changing behaviour.
I understand your predicament, but why are the internal and external names different in the first place?
Re: API addfile: name parameter is ignored
Posted: December 31st, 2012, 8:41 am
by RuudBurger
For couchpotato I add ".cp(tt1231232)" (imdb id) to the filename. So later it can be picked up more easily.
Re: API addfile: name parameter is ignored
Posted: December 31st, 2012, 9:55 am
by shypike
RuudBurger wrote:
Now I have to tell my users they need to change the spotweb setting, which isn't ideal.
If you have users, which app are you developing?
And if you're developing an app, why not add the nzbname parameter?
Re: API addfile: name parameter is ignored
Posted: December 31st, 2012, 10:17 am
by RuudBurger
Like I said, CouchPotato
I just double checked, and I indeed use nzbname (not name, but the problem is the same).
Re: API addfile: name parameter is ignored
Posted: December 31st, 2012, 12:10 pm
by shypike
Right, it wasn't clear to me that you're working on CP.
I thought you were developing something using CP and SABnzbd.
Like I said, I changed the code and release 0.7.8 will work fine with the nzbname parameter.
Re: API addfile: name parameter is ignored
Posted: December 31st, 2012, 12:56 pm
by RuudBurger
Thanks, will test this again when the new version is released.