Browse Source

The 'addlocalfile' API function failed to do proper category handling.

Cause is an error in the functions upload.upload_file and upload.add_local.
They added explicit attributes from the default category, while they should be adding no attributes at all.
tags/0.6.0
ShyPike 14 years ago
parent
commit
f77fe3ccd6
  1. 14
      sabnzbd/utils/upload.py

14
sabnzbd/utils/upload.py

@ -24,7 +24,7 @@ import urllib
import logging
import os
import sabnzbd.cfg as cfg
from sabnzbd.misc import get_ext, get_filename, cat_to_opts
from sabnzbd.misc import get_ext, get_filename
from sabnzbd.dirscanner import ProcessArchiveFile, ProcessSingleFile
@ -32,8 +32,7 @@ def upload_file(url, fp):
""" Function for uploading nzbs to a running sabnzbd instance """
try:
fp = urllib.quote_plus(fp)
cat, pp, script, priority = cat_to_opts(None)
url = '%s&mode=addlocalfile&name=%s&pp=%s&script=%s&priority=%s' % (url, fp, pp, script, priority)
url = '%s&mode=addlocalfile&name=%s' % (url, fp)
# Add local apikey if it wasn't already in the registered URL
apikey = cfg.api_key()
if apikey and 'apikey' not in url:
@ -44,7 +43,7 @@ def upload_file(url, fp):
password = cfg.password()
if username and password:
url = '%s&ma_username=%s&ma_password=%s' % (url, username, password)
u = urllib2.urlopen(url)
urllib2.urlopen(url)
except:
logging.error("Failed to upload file: %s", fp)
logging.info("Traceback: ", exc_info = True)
@ -55,11 +54,10 @@ def add_local(f):
if os.path.exists(f):
fn = get_filename(f)
if fn:
cat, pp, script, priority = cat_to_opts(None)
if get_ext(fn) in ('.zip','.rar', '.gz'):
ProcessArchiveFile(fn, f, pp=pp, script=script, priority=priority, keep=True)
if get_ext(fn) in ('.zip', '.rar', '.gz'):
ProcessArchiveFile(fn, f, keep=True)
elif get_ext(fn) in ('.nzb'):
ProcessSingleFile(fn, f, pp=pp, script=script, priority=priority, keep=True)
ProcessSingleFile(fn, f, keep=True)
else:
logging.error("Filename not found: %s", f)
else:

Loading…
Cancel
Save