API addfile: name parameter is ignored

Report & discuss bugs found in 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.
Post Reply
RuudBurger
Sr. Member
Sr. Member
Posts: 305
Joined: July 2nd, 2010, 6:11 am

API addfile: name parameter is ignored

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

Re: API addfile: name parameter is ignored

Post 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.
RuudBurger
Sr. Member
Sr. Member
Posts: 305
Joined: July 2nd, 2010, 6:11 am

Re: API addfile: name parameter is ignored

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

Re: API addfile: name parameter is ignored

Post 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?
RuudBurger
Sr. Member
Sr. Member
Posts: 305
Joined: July 2nd, 2010, 6:11 am

Re: API addfile: name parameter is ignored

Post by RuudBurger »

For couchpotato I add ".cp(tt1231232)" (imdb id) to the filename. So later it can be picked up more easily.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: API addfile: name parameter is ignored

Post 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?
RuudBurger
Sr. Member
Sr. Member
Posts: 305
Joined: July 2nd, 2010, 6:11 am

Re: API addfile: name parameter is ignored

Post by RuudBurger »

Like I said, CouchPotato ;)
I just double checked, and I indeed use nzbname (not name, but the problem is the same).
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: API addfile: name parameter is ignored

Post 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.
RuudBurger
Sr. Member
Sr. Member
Posts: 305
Joined: July 2nd, 2010, 6:11 am

Re: API addfile: name parameter is ignored

Post by RuudBurger »

Thanks, will test this again when the new version is released.
Post Reply