From 946871b9b84348634facbbf04d1278be193b74e4 Mon Sep 17 00:00:00 2001 From: Safihre Date: Wed, 26 Dec 2018 11:01:02 +0100 Subject: [PATCH] Py3: Update upload --- sabnzbd/utils/upload.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/sabnzbd/utils/upload.py b/sabnzbd/utils/upload.py index 1395c7b..b0c0b80 100644 --- a/sabnzbd/utils/upload.py +++ b/sabnzbd/utils/upload.py @@ -18,26 +18,25 @@ """ sabnzbd.utils.upload - File association functions for adding nzb files to sabnzbd """ - -import urllib.request, urllib.parse, urllib.error -import logging import os -from sabnzbd.encoding import unicoder +import logging +import urllib.request +import urllib.parse +import urllib.error + import sabnzbd.cfg as cfg from sabnzbd.filesystem import get_ext, get_filename from sabnzbd.constants import VALID_ARCHIVES, VALID_NZB_FILES - from sabnzbd.dirscanner import ProcessArchiveFile, ProcessSingleFile from sabnzbd.misc import get_from_url def upload_file(url, fp): - """ Function for uploading nzbs to a running sabnzbd instance """ + """ Function for uploading nzbs to a running SABnzbd instance """ try: - fp = unicoder(fp).encode('utf-8') fp = urllib.parse.quote_plus(fp) url = '%s&mode=addlocalfile&name=%s' % (url, fp) - # Add local apikey if it wasn't already in the registered URL + # Add local API-key if it wasn't already in the registered URL apikey = cfg.api_key() if apikey and 'apikey' not in url: url = '%s&apikey=%s' % (url, apikey) @@ -54,7 +53,7 @@ def upload_file(url, fp): def add_local(f): - """ Function for easily adding nzb/zip/rar/nzb.gz to sabnzbd """ + """ Function for easily adding nzb/zip/rar/nzb.gz to SABnzbd """ if os.path.exists(f): fn = get_filename(f) if fn: