diff --git a/main/SABnzbd.py b/main/SABnzbd.py index 13d40fe..f2960de 100755 --- a/main/SABnzbd.py +++ b/main/SABnzbd.py @@ -982,7 +982,6 @@ def main(): logging.info('[osx] IO priority set to throttle for process scope') except: logging.info('[osx] IO priority setting not supported') - pass if AUTOBROWSER != None: sabnzbd.cfg.AUTOBROWSER.set(AUTOBROWSER) diff --git a/main/sabnzbd/__init__.py b/main/sabnzbd/__init__.py index 63384aa..20185fd 100644 --- a/main/sabnzbd/__init__.py +++ b/main/sabnzbd/__init__.py @@ -154,8 +154,8 @@ def connect_db(thread_index): @synchronized(INIT_LOCK) -def initialize(pause_downloader = False, clean_up = False, force_save= False, evalSched=False): - global __INITIALIZED__, \ +def initialize(pause_downloader = False, clean_up = False, evalSched=False): + global __INITIALIZED__, __SHUTTING_DOWN__,\ LOGFILE, WEBLOGFILE, LOGHANDLER, GUIHANDLER, AMBI_LOCALHOST, WAITEXIT, \ DEBUG_DELAY, \ DAEMON, MY_NAME, MY_FULLNAME, NEW_VERSION, \ @@ -271,7 +271,7 @@ def start(): @synchronized(INIT_LOCK) def halt(): - global __INITIALIZED__ + global __INITIALIZED__, __SHUTTING_DOWN__ if __INITIALIZED__: logging.info('SABnzbd shutting down...') diff --git a/main/sabnzbd/assembler.py b/main/sabnzbd/assembler.py index 0deb81a..75340dd 100644 --- a/main/sabnzbd/assembler.py +++ b/main/sabnzbd/assembler.py @@ -19,7 +19,6 @@ sabnzbd.assembler - threaded assembly/decoding of files """ -import sys import os import Queue import binascii @@ -27,7 +26,6 @@ import logging import struct from threading import Thread from time import sleep -import subprocess try: import hashlib new_md5 = hashlib.md5 @@ -41,7 +39,7 @@ import sabnzbd.cfg as cfg import sabnzbd.articlecache import sabnzbd.postproc import sabnzbd.downloader -from sabnzbd.lang import T, Ta +from sabnzbd.lang import Ta #------------------------------------------------------------------------------ @@ -118,7 +116,7 @@ class Assembler(Thread): if filepath: logging.info('Decoding %s %s', filepath, nzf.get_type()) try: - filepath = _assemble(nzo, nzf, filepath, dupe) + filepath = _assemble(nzf, filepath, dupe) except IOError, (errno, strerror): # 28 == disk full => pause downloader if errno == 28: @@ -139,7 +137,7 @@ class Assembler(Thread): sabnzbd.postproc.process(nzo) -def _assemble(nzo, nzf, path, dupe): +def _assemble(nzf, path, dupe): if os.path.exists(path): unique_path = get_unique_path(path, create_dir = False) if dupe: diff --git a/main/sabnzbd/cfg.py b/main/sabnzbd/cfg.py index bafc073..bf438e4 100644 --- a/main/sabnzbd/cfg.py +++ b/main/sabnzbd/cfg.py @@ -19,7 +19,6 @@ sabnzbd.cfg - Configuration Parameters """ -import os import sabnzbd from sabnzbd.constants import * from sabnzbd.config import OptionBool, OptionNumber, OptionPassword, \ @@ -149,7 +148,7 @@ else: USERNAME = OptionStr('misc', 'username') PASSWORD = OptionPassword('misc', 'password') -BANDWIDTH_LIMIT = OptionNumber('misc', 'bandwidth_limit', 0) +BANDWIDTH_LIMIT = OptionStr('misc', 'bandwidth_limit', 0) REFRESH_RATE = OptionNumber('misc', 'refresh_rate', 0) RSS_RATE = OptionNumber('misc', 'rss_rate', 60, 15, 24*60) CACHE_LIMIT = OptionStr('misc', 'cache_limit') diff --git a/main/sabnzbd/codecs.py b/main/sabnzbd/codecs.py index 1b8425c..85c0448 100644 --- a/main/sabnzbd/codecs.py +++ b/main/sabnzbd/codecs.py @@ -19,8 +19,6 @@ sabnzbd.codecs - Unicoded filename support """ -import os -import sys import locale from xml.sax.saxutils import escape from Cheetah.Filters import Filter diff --git a/main/sabnzbd/config.py b/main/sabnzbd/config.py index 27a3753..111012d 100644 --- a/main/sabnzbd/config.py +++ b/main/sabnzbd/config.py @@ -86,7 +86,7 @@ class Option: """ Set value based on dictionary """ try: return self.set(dict['value']) - except: + except KeyError: return False def __set(self, value): @@ -130,7 +130,7 @@ class OptionNumber(Option): value = int(value) else: value = float(value) - except: + except ValueError: value = 0 if self.__validation: error, val = self.__validation(value) @@ -305,13 +305,13 @@ def add_to_database(section, keyword, object): @synchronized(CONFIG_LOCK) def delete_from_database(section, keyword): - global database, CFG, modified - del database[section][keyword] - try: - del CFG[section][keyword] - except KeyError: - pass - modified = True + global database, CFG, modified + del database[section][keyword] + try: + del CFG[section][keyword] + except KeyError: + pass + modified = True class ConfigServer: @@ -621,7 +621,7 @@ def read_config(path): """ Read the complete INI file and check its version number if OK, pass values to config-database """ - global CFG, database, categories, rss_feeds, servers, modified + global CFG, database, modified if not os.path.exists(path): # No file found, create default INI file @@ -660,9 +660,9 @@ def read_config(path): except KeyError: pass - categories = define_categories() - rss_feeds = define_rss() - servers = define_servers() + define_categories() + define_rss() + define_servers() modified = False return True @@ -821,7 +821,7 @@ def decode_password(pw, name): if pw and pw.startswith(__PW_PREFIX): for n in range(len(__PW_PREFIX), len(pw), 2): try: - ch = chr( int(pw[n] + pw[n+1],16) ) + ch = chr( int(pw[n] + pw[n+1], 16) ) except: logging.error(Ta('error-encPw@1'), name) return '' diff --git a/main/sabnzbd/database.py b/main/sabnzbd/database.py index 53e0e13..33c7528 100644 --- a/main/sabnzbd/database.py +++ b/main/sabnzbd/database.py @@ -33,11 +33,10 @@ import datetime from calendar import MONDAY import zlib import logging -from threading import Thread import sabnzbd import sabnzbd.cfg -from sabnzbd.constants import DB_HISTORY_VERSION, DB_HISTORY_NAME +from sabnzbd.constants import DB_HISTORY_NAME from sabnzbd.lang import T, Ta from sabnzbd.codecs import unicoder diff --git a/main/sabnzbd/decoder.py b/main/sabnzbd/decoder.py index ad10281..6a22962 100644 --- a/main/sabnzbd/decoder.py +++ b/main/sabnzbd/decoder.py @@ -38,7 +38,7 @@ import sabnzbd.downloader import sabnzbd.cfg as cfg import sabnzbd.nzbqueue from sabnzbd.codecs import name_fixer -from sabnzbd.lang import T, Ta +from sabnzbd.lang import Ta #------------------------------------------------------------------------------- @@ -59,7 +59,7 @@ class Decoder(Thread): def __init__(self, servers): Thread.__init__(self) - self.queue = Queue.Queue(); + self.queue = Queue.Queue() self.servers = servers def decode(self, article, lines): diff --git a/main/sabnzbd/dirscanner.py b/main/sabnzbd/dirscanner.py index 0e22f78..388b57e 100644 --- a/main/sabnzbd/dirscanner.py +++ b/main/sabnzbd/dirscanner.py @@ -20,20 +20,14 @@ sabnzbd.dirscanner - Scanner for Watched Folder """ import os -import sys import time import logging -import urllib import re import zipfile import gzip -import webbrowser -import tempfile -import shutil import threading import sabnzbd -from sabnzbd.decorators import synchronized from sabnzbd.constants import * from sabnzbd.utils.rarfile import is_rarfile, RarFile import sabnzbd.nzbstuff as nzbstuff @@ -41,7 +35,7 @@ import sabnzbd.misc as misc import sabnzbd.config as config import sabnzbd.cfg as cfg import sabnzbd.nzbqueue -from sabnzbd.lang import T, Ta +from sabnzbd.lang import Ta ################################################################################ # Wrapper functions @@ -271,6 +265,8 @@ class DirScanner(threading.Thread): self.shutdown = False self.error_reported = False # Prevents mulitple reporting of missing watched folder + self.dirscan_dir = cfg.DIRSCAN_DIR.get_path() + self.dirscan_speed = cfg.DIRSCAN_SPEED.get() cfg.DIRSCAN_DIR.callback(self.newdir) def newdir(self): diff --git a/main/sabnzbd/email.py b/main/sabnzbd/email.py index 41647d8..c124ab2 100644 --- a/main/sabnzbd/email.py +++ b/main/sabnzbd/email.py @@ -24,7 +24,6 @@ from sabnzbd.utils import ssmtplib import smtplib import os import logging -import subprocess import re import time import glob diff --git a/main/sabnzbd/interface.py b/main/sabnzbd/interface.py index 383c614..02fc188 100644 --- a/main/sabnzbd/interface.py +++ b/main/sabnzbd/interface.py @@ -29,18 +29,16 @@ import glob import urllib from xml.sax.saxutils import escape -from sabnzbd.utils.rsslib import RSS, Item, Namespace +from sabnzbd.utils.rsslib import RSS, Item from sabnzbd.utils.json import JsonWriter import sabnzbd import sabnzbd.rss import sabnzbd.scheduler as scheduler -from sabnzbd.utils import listquote -from sabnzbd.utils.configobj import ConfigObj from Cheetah.Template import Template import sabnzbd.email as email -from sabnzbd.misc import real_path, create_real_path, loadavg, \ - to_units, from_units, diskfree, disktotal, get_ext, sanitize_foldername, \ +from sabnzbd.misc import real_path, loadavg, \ + to_units, diskfree, disktotal, get_ext, sanitize_foldername, \ get_filename, cat_to_opts, IntConv from sabnzbd.newswrapper import GetServerParms import sabnzbd.newzbin as newzbin @@ -53,7 +51,7 @@ import sabnzbd.postproc as postproc import sabnzbd.downloader as downloader import sabnzbd.bpsmeter as bpsmeter import sabnzbd.nzbqueue as nzbqueue -from sabnzbd.database import get_history_handle, build_history_info, unpack_history_info +from sabnzbd.database import build_history_info, unpack_history_info import sabnzbd.wizard from sabnzbd.utils.servertests import test_nntp_server_dict @@ -197,11 +195,9 @@ def check_session(kwargs): if not key: logging.warning(Ta('warn-missingKey')) msg = T('error-missingKey') - pass elif key != cfg.API_KEY.get(): logging.warning(Ta('warn-badKey')) msg = T('error-badKey') - pass return msg @@ -261,6 +257,8 @@ class NoPage: #------------------------------------------------------------------------------ _MSG_NO_VALUE = 'expect one parameter' _MSG_NO_VALUE2 = 'expect two parameters' +_MSG_INT_VALUE = 'expect integer value' +_MSG_NO_ITEM = 'item does not exist' _MSG_NOT_IMPLEMENTED = 'not implemented' _MSG_NO_FILE = 'no file given' _MSG_NO_PATH = 'file does not exist' @@ -551,7 +549,7 @@ class MainPage: return report(output) elif value: items = value.split(',') - nzbqueue.remove_multiple_nzos(items, False) + nzbqueue.remove_multiple_nzos(items) return report(output) else: return report(output, _MSG_NO_VALUE) @@ -1758,21 +1756,21 @@ class ConfigGeneral: raise dcRaiser(self.__root, kwargs) def change_web_dir(web_dir): + try: + web_dir, web_color = web_dir.split(' - ') + except: try: - web_dir, web_color = web_dir.split(' - ') + web_color = DEF_SKIN_COLORS[web_dir.lower()] except: - try: - web_color = DEF_SKIN_COLORS[web_dir.lower()] - except: - web_color = '' + web_color = '' - web_dir_path = real_path(sabnzbd.DIR_INTERFACES, web_dir) + web_dir_path = real_path(sabnzbd.DIR_INTERFACES, web_dir) - if not os.path.exists(web_dir_path): - return badParameterResponse('Cannot find web template: %s' % web_dir_path) - else: - cfg.WEB_DIR.set(web_dir) - cfg.WEB_COLOR.set(web_color) + if not os.path.exists(web_dir_path): + return badParameterResponse('Cannot find web template: %s' % web_dir_path) + else: + cfg.WEB_DIR.set(web_dir) + cfg.WEB_COLOR.set(web_color) #------------------------------------------------------------------------------ @@ -3296,7 +3294,7 @@ class xml_factory: elif isinstance(lst, tuple): text = self._tuple(keyw, lst) elif keyw: - text = '<%s>%s\n' % (keyw, xml_name(lst, encoding='utf-8'), keyw) + text = '<%s>%s\n' % (keyw, xml_name(lst, encoding='utf-8'), keyw) else: text = '' return text diff --git a/main/sabnzbd/lang.py b/main/sabnzbd/lang.py index 378b5cf..df0c494 100644 --- a/main/sabnzbd/lang.py +++ b/main/sabnzbd/lang.py @@ -97,7 +97,7 @@ def list_languages(path): """ Return list of languages-choices Each choice is a list, 0: short name, 1: long name """ - list = [] + lst = [] for name in glob.glob(path + '/*.txt'): lang = os.path.basename(name).replace('.txt','') try: @@ -106,8 +106,8 @@ def list_languages(path): continue encoding, language = _get_headers(fp) - long = u"%s" % language - list.append((lang, long)) + long_name = u"%s" % language + lst.append((lang, long_name)) fp.close() return list @@ -121,7 +121,7 @@ def _parse_lang_file(dic, name, prefix=''): """ try: f = open(name, "r") - except: + except IOError: logging.error("Cannot open language file %s", name) return False @@ -133,6 +133,7 @@ def _parse_lang_file(dic, name, prefix=''): prefix += '-' lcount = 0 multi = False + msg = '' for line in f.xreadlines(): line = line.strip('\n').decode(encoding) lcount += 1 diff --git a/main/sabnzbd/misc.py b/main/sabnzbd/misc.py index 6a19b00..9ca5058 100644 --- a/main/sabnzbd/misc.py +++ b/main/sabnzbd/misc.py @@ -35,7 +35,7 @@ import time import sabnzbd from sabnzbd.decorators import synchronized from sabnzbd.constants import * -import nzbqueue +import sabnzbd.nzbqueue import sabnzbd.config as config import sabnzbd.cfg as cfg from sabnzbd.lang import T, Ta @@ -265,7 +265,6 @@ def get_user_shellfolders(): except: # probably a pywintypes.error error such as folder does not exist logging.error("Traceback: ", exc_info = True) - pass i += 1 _winreg.CloseKey(key) _winreg.CloseKey(hive) @@ -945,7 +944,7 @@ def create_https_certificates(ssl_cert, ssl_key): try: from OpenSSL import crypto from sabnzbd.utils.certgen import createKeyPair, createCertRequest, createCertificate,\ - TYPE_RSA, TYPE_DSA, serial + TYPE_RSA, serial except: logging.warning(Ta('warn-pyopenssl')) return False diff --git a/main/sabnzbd/newsunpack.py b/main/sabnzbd/newsunpack.py index e11e54d..2d6659e 100644 --- a/main/sabnzbd/newsunpack.py +++ b/main/sabnzbd/newsunpack.py @@ -28,7 +28,7 @@ from time import time import sabnzbd from sabnzbd.codecs import TRANS, unicode2local,name_fixer, reliable_unpack_names, unicoder -from sabnzbd.utils.rarfile import is_rarfile, RarFile +from sabnzbd.utils.rarfile import RarFile from sabnzbd.misc import format_time_string, find_on_path import sabnzbd.cfg as cfg from sabnzbd.lang import T, Ta @@ -388,12 +388,10 @@ def rar_unpack(nzo, workdir, workdir_complete, delete, rars): # Delete the old files if we have to if delete and newfiles: - i = 0 for rar in rars: logging.info("Deleting %s", rar) try: os.remove(rar) - i += 1 except OSError: logging.warning(Ta('warn-delFailed@1'), rar) @@ -403,7 +401,6 @@ def rar_unpack(nzo, workdir, workdir_complete, delete, rars): logging.info("Deleting %s", brokenrar) try: os.remove(brokenrar) - i += 1 except OSError: logging.warning(Ta('warn-delFailed@1'), brokenrar) @@ -661,7 +658,7 @@ def par2_repair(parfile_nzf, nzo, workdir, setname): readd = False try: nzo.set_action_line(T('msg-repair'), T('msg-startRepair')) - logging.info('Scanning "%s"' % parfile) + logging.info('Scanning "%s"', parfile) joinables, zips, rars, ts = build_filelists(workdir, None) @@ -690,8 +687,6 @@ def par2_repair(parfile_nzf, nzo, workdir, setname): try: if cfg.enable_par_cleanup.get(): - i = 0 - new_dir_content = os.listdir(workdir) for path in new_dir_content: @@ -701,7 +696,6 @@ def par2_repair(parfile_nzf, nzo, workdir, setname): logging.info("Deleting %s", path) os.remove(path) - i += 1 except: logging.warning(Ta('warn-delFailed@1'), path) @@ -712,7 +706,6 @@ def par2_repair(parfile_nzf, nzo, workdir, setname): try: logging.info("Deleting %s", path) os.remove(path) - i += 1 except: logging.warning(Ta('warn-delFailed@1'), path) @@ -720,7 +713,6 @@ def par2_repair(parfile_nzf, nzo, workdir, setname): try: logging.info("Deleting %s", path2) os.remove(path2) - i += 1 except: logging.warning(Ta('warn-delFailed@1'), path2) @@ -728,7 +720,6 @@ def par2_repair(parfile_nzf, nzo, workdir, setname): try: logging.info("Deleting %s", parfile) os.remove(parfile) - i += 1 except OSError: logging.warning(Ta('warn-delFailed@1'), parfile) @@ -741,7 +732,6 @@ def par2_repair(parfile_nzf, nzo, workdir, setname): logging.info("Deleting %s", filepath) try: os.remove(filepath) - i += 1 except OSError: logging.warning(Ta('warn-delFailed@1'), filepath) except: @@ -793,7 +783,6 @@ def PAR_Verify(parfile, parfile_nzf, nzo, setname, joinables): verifytotal = 0 verified = 0 - lines = [] # Loop over the output, whee while 1: char = proc.read(1) diff --git a/main/sabnzbd/newswrapper.py b/main/sabnzbd/newswrapper.py index 517bf57..5382df0 100644 --- a/main/sabnzbd/newswrapper.py +++ b/main/sabnzbd/newswrapper.py @@ -23,12 +23,12 @@ import errno import socket from threading import Thread from nntplib import NNTPPermanentError -from time import time +import time import logging import sabnzbd from sabnzbd.constants import * -from sabnzbd.lang import T, Ta +from sabnzbd.lang import Ta try: from OpenSSL import SSL @@ -45,7 +45,6 @@ _RLock = threading.RLock del threading import select -import os socket.setdefaulttimeout(DEF_TIMEOUT) @@ -204,7 +203,7 @@ class NewsWrapper: self.server.username, self.server.password, self.blocking) self.recv = self.nntp.sock.recv - self.timeout = time() + self.server.timeout + self.timeout = time.time() + self.server.timeout def finish_connect(self): if not self.server.username or not self.server.password: @@ -235,20 +234,20 @@ class NewsWrapper: else: self.connected = True - self.timeout = time() + self.server.timeout + self.timeout = time.time() + self.server.timeout def body(self): - self.timeout = time() + self.server.timeout + self.timeout = time.time() + self.server.timeout command = 'BODY <%s>\r\n' % (self.article.article) self.nntp.sock.sendall(command) def send_group(self, group): - self.timeout = time() + self.server.timeout + self.timeout = time.time() + self.server.timeout command = 'GROUP %s\r\n' % (group) self.nntp.sock.sendall(command) def recv_chunk(self, block=False): - self.timeout = time() + self.server.timeout + self.timeout = time.time() + self.server.timeout while 1: try: chunk = self.recv(32768) @@ -295,10 +294,10 @@ class NewsWrapper: # Wait before re-using this newswrapper if wait: # Reset due to error condition, use server timeout - self.timeout = time() + self.server.timeout + self.timeout = time.time() + self.server.timeout else: # Reset for internal reasons, just wait 5 sec - self.timeout = time() + 5 + self.timeout = time.time() + 5 def terminate(self): """ Close connection and remove nntp object """ diff --git a/main/sabnzbd/newzbin.py b/main/sabnzbd/newzbin.py index edc454d..3b7d664 100644 --- a/main/sabnzbd/newzbin.py +++ b/main/sabnzbd/newzbin.py @@ -342,6 +342,7 @@ class Bookmarks: self.bookmarks = sabnzbd.load_data(BOOKMARK_FILE_NAME) if not self.bookmarks: self.bookmarks = [] + self.__busy = False @synchronized(BOOK_LOCK) def run(self, delete=None): diff --git a/main/sabnzbd/nzbqueue.py b/main/sabnzbd/nzbqueue.py index fe8178e..b71a0cc 100644 --- a/main/sabnzbd/nzbqueue.py +++ b/main/sabnzbd/nzbqueue.py @@ -19,15 +19,11 @@ sabnzbd.nzbqueue - nzb queue """ -import sys import os import logging -import sabnzbd -import time import datetime -from threading import Thread, RLock - +import sabnzbd from sabnzbd.trylist import TryList from sabnzbd.nzbstuff import NzbObject from sabnzbd.misc import panic_queue, exit_sab, sanitize_foldername, cat_to_opts @@ -115,8 +111,10 @@ class NzbQueue(TryList): return future_nzo @synchronized(NZBQUEUE_LOCK) - def insert_future(self, future, filename, msgid, data, pp=None, script=None, cat=None, priority=NORMAL_PRIORITY, nzbname=None, nzo_info={}): + def insert_future(self, future, filename, msgid, data, pp=None, script=None, cat=None, priority=NORMAL_PRIORITY, nzbname=None, nzo_info=None): """ Refresh a placeholder nzo with an actual nzo """ + if nzo_info is None: + nzo_info = {} nzo_id = future.nzo_id if nzo_id in self.__nzo_table: try: @@ -264,7 +262,7 @@ class NzbQueue(TryList): @synchronized(NZBQUEUE_LOCK) - def remove_multiple(self, nzo_ids, add_to_history = True): + def remove_multiple(self, nzo_ids): for nzo_id in nzo_ids: self.remove(nzo_id, add_to_history = False, save = False) self.save() @@ -485,10 +483,12 @@ class NzbQueue(TryList): @synchronized(NZBQUEUE_LOCK) def set_priority_multiple(self, nzo_ids, priority): try: + n = -1 for nzo_id in nzo_ids: - self.set_priority(nzo_id, priority) + n = self.set_priority(nzo_id, priority) + return n except: - pass + return -1 @synchronized(NZBQUEUE_LOCK) def set_original_dirname(self, nzo_id, name): @@ -757,9 +757,9 @@ def remove_nzo(nzo_id, add_to_history = True, unload=False): global __NZBQ if __NZBQ: __NZBQ.remove(nzo_id, add_to_history, unload) -def remove_multiple_nzos(nzo_ids, add_to_history = True): +def remove_multiple_nzos(nzo_ids): global __NZBQ - if __NZBQ: __NZBQ.remove_multiple(nzo_ids, add_to_history) + if __NZBQ: __NZBQ.remove_multiple(nzo_ids) def remove_all_nzo(): global __NZBQ @@ -896,8 +896,10 @@ def add_nzo(nzo): if __NZBQ: __NZBQ.add(nzo) @synchronized_CV -def insert_future_nzo(future_nzo, filename, msgid, data, pp=None, script=None, cat=None, priority=NORMAL_PRIORITY, nzbname=None, nzo_info={}): +def insert_future_nzo(future_nzo, filename, msgid, data, pp=None, script=None, cat=None, priority=NORMAL_PRIORITY, nzbname=None, nzo_info=None): global __NZBQ + if nzo_info is None: + nzo_info = {} if __NZBQ: __NZBQ.insert_future(future_nzo, filename, msgid, data, pp=pp, script=script, cat=cat, priority=priority, nzbname=nzbname, nzo_info=nzo_info) @synchronized_CV @@ -915,7 +917,7 @@ def get_nzo(nzo_id): @synchronized_CV def set_priority_multiple(nzo_ids, priority): global __NZBQ - if __NZBQ: __NZBQ.set_priority_multiple(nzo_ids, priority) + if __NZBQ: return __NZBQ.set_priority_multiple(nzo_ids, priority) @synchronized_CV def sort_queue(field, reverse=False): diff --git a/main/sabnzbd/nzbstuff.py b/main/sabnzbd/nzbstuff.py index 8147a78..ec7c9fa 100644 --- a/main/sabnzbd/nzbstuff.py +++ b/main/sabnzbd/nzbstuff.py @@ -907,8 +907,6 @@ class NzbObject(TryList): return None def purge_data(self): - nzf_ids = [] - for nzf in self.__files: sabnzbd.remove_data(nzf.nzf_id) diff --git a/main/sabnzbd/postproc.py b/main/sabnzbd/postproc.py index 758f84d..b3a0376 100644 --- a/main/sabnzbd/postproc.py +++ b/main/sabnzbd/postproc.py @@ -27,17 +27,14 @@ import sabnzbd import urllib import time import re -from xml.sax.saxutils import escape -import subprocess -from sabnzbd.decorators import synchronized from sabnzbd.newsunpack import unpack_magic, par2_repair, external_processing -from threading import Thread, RLock +from threading import Thread from sabnzbd.misc import real_path, get_unique_path, create_dirs, move_to_path, \ get_unique_filename, \ on_cleanup_list from sabnzbd.tvsort import Sorter -from sabnzbd.constants import TOP_PRIORITY, DB_HISTORY_NAME, POSTPROC_QUEUE_FILE_NAME, \ +from sabnzbd.constants import TOP_PRIORITY, POSTPROC_QUEUE_FILE_NAME, \ POSTPROC_QUEUE_VERSION, sample_match from sabnzbd.codecs import TRANS, unicoder import sabnzbd.newzbin @@ -539,13 +536,13 @@ def Cat2Dir(cat, defdir): def addPrefixes(path,nzo): dirprefix = nzo.get_dirprefix() for _dir in dirprefix: - if not _dir: - continue - if not path: - break - basepath = os.path.basename(os.path.abspath(path)) - if _dir != basepath.lower(): - path = os.path.join(path, _dir) + if not _dir: + continue + if not path: + break + basepath = os.path.basename(os.path.abspath(path)) + if _dir != basepath.lower(): + path = os.path.join(path, _dir) return path diff --git a/main/sabnzbd/scheduler.py b/main/sabnzbd/scheduler.py index f7ba428..0f3d24d 100644 --- a/main/sabnzbd/scheduler.py +++ b/main/sabnzbd/scheduler.py @@ -32,7 +32,7 @@ import sabnzbd.downloader import sabnzbd.misc import sabnzbd.config as config import sabnzbd.cfg as cfg -from sabnzbd.lang import T, Ta +from sabnzbd.lang import Ta __SCHED = None # Global pointer to Scheduler instance @@ -295,7 +295,7 @@ def scheduled_resume(): """ global __PAUSE_END if __PAUSE_END is None: - sabnzbd.unpause_all() + sabnzbd.unpause_all() def __oneshot_resume(when): diff --git a/main/sabnzbd/tvsort.py b/main/sabnzbd/tvsort.py index 1a1d50b..3f5e98d 100644 --- a/main/sabnzbd/tvsort.py +++ b/main/sabnzbd/tvsort.py @@ -31,7 +31,7 @@ from sabnzbd.misc import move_to_path, cleanup_empty_directories, get_unique_fil from sabnzbd.constants import series_match, date_match, year_match, sample_match import sabnzbd.cfg as cfg from sabnzbd.codecs import titler -from sabnzbd.lang import T, Ta +from sabnzbd.lang import Ta RE_SAMPLE = re.compile(sample_match, re.I) # Do not rename .vob files as they are usually DVD's diff --git a/main/sabnzbd/urlgrabber.py b/main/sabnzbd/urlgrabber.py index 911b085..3f73051 100644 --- a/main/sabnzbd/urlgrabber.py +++ b/main/sabnzbd/urlgrabber.py @@ -20,13 +20,11 @@ sabnzbd.urlgrabber - Queue for grabbing NZB files from websites """ import os -import sys import time import re import logging import Queue import urllib, urllib2 -import cookielib import tempfile from threading import * @@ -42,7 +40,7 @@ import sabnzbd.misc as misc import sabnzbd.dirscanner as dirscanner import sabnzbd.nzbqueue as nzbqueue import sabnzbd.cfg as cfg -from sabnzbd.lang import T, Ta +from sabnzbd.lang import Ta #------------------------------------------------------------------------------ # Wrapper functions diff --git a/main/sabnzbd/wizard.py b/main/sabnzbd/wizard.py index b5f99a8..b7aeddf 100644 --- a/main/sabnzbd/wizard.py +++ b/main/sabnzbd/wizard.py @@ -21,14 +21,12 @@ sabnzbd.wizard - Wizard Webinterface import os import cherrypy -import logging from Cheetah.Template import Template import sabnzbd from sabnzbd.constants import * from sabnzbd.lang import T, list_languages, reset_language from sabnzbd.utils.servertests import test_nntp_server_dict -from sabnzbd.misc import IntConv import sabnzbd.interface import sabnzbd.config as config import sabnzbd.cfg as cfg