sabnzbd/sabnzbd — Issue #19: API addfile completely broken
Author: paranoidi
Created: 2012-01-10 22:42:19+00:00
State: open

Hi, I'm one of the FlexGet developers and we have had sabnzbd api support for long time. But the problem with adding url to sabnzbd is that we don't get any feedback from retrieve failures. And for cookies etc it would make more sense to retrieve the file ourselves and simply post it to sabnzbd.

After toying around for a while I had to take a closer look to the sources since there wasn't any documentation of this API.

Problem: It does not work at all.

def _api_addfile(name, output, kwargs):

it gets the name just fine but later checks screw it completely

if name is None or isinstance(name, str) or isinstance(name, unicode):

since it is string it will go and fetch the name from different argument, okay ... (also, consider isinstance(name, basestring) instead of that str or unicode thing)

Later it will crash because

name.filename and name.value:

variable name is string and it doesn't have filename or value ... so

AttributeError: 'str' object has no attribute 'filename'

Maybe I will have more luck with more restrictive localfile API.