diff --git a/SABnzbd.py b/SABnzbd.py index e0cdb20..aba2402 100755 --- a/SABnzbd.py +++ b/SABnzbd.py @@ -1333,7 +1333,6 @@ def main(): 'error_page.404': sabnzbd.panic.error_page_404 }) - # Do we want CherryPy Logging? Cannot be done via the config if cherrypylogging: sabnzbd.WEBLOGFILE = os.path.join(logdir, DEF_LOG_CHERRY) diff --git a/sabnzbd/__init__.py b/sabnzbd/__init__.py index d814a34..355b079 100644 --- a/sabnzbd/__init__.py +++ b/sabnzbd/__init__.py @@ -108,7 +108,7 @@ import sabnzbd.lang as lang import sabnzbd.api from sabnzbd.decorators import synchronized, synchronized_CV, IO_LOCK from sabnzbd.constants import NORMAL_PRIORITY, VALID_ARCHIVES, GIGI, \ - REPAIR_REQUEST, QUEUE_FILE_NAME, QUEUE_VERSION, QUEUE_FILE_TMPL + REPAIR_REQUEST, QUEUE_FILE_NAME, QUEUE_VERSION, QUEUE_FILE_TMPL import sabnzbd.getipaddress as getipaddress LINUX_POWER = powersup.HAVE_DBUS @@ -173,10 +173,10 @@ __SHUTTING_DOWN__ = False ############################################################################## def sig_handler(signum=None, frame=None): global SABSTOP, WINTRAY - if sabnzbd.WIN32 and type(signum) != type(None) and DAEMON and signum == 5: + if sabnzbd.WIN32 and signum is not None and DAEMON and signum == 5: # Ignore the "logoff" event when running as a Win32 daemon return True - if type(signum) != type(None): + if signum is not None: logging.warning(T('Signal %s caught, saving and exiting...'), signum) try: save_state() diff --git a/sabnzbd/api.py b/sabnzbd/api.py index 9565b27..c557db8 100644 --- a/sabnzbd/api.py +++ b/sabnzbd/api.py @@ -1584,6 +1584,7 @@ def Tspec(txt): else: return txt + _SKIN_CACHE = {} # Stores pre-translated acronyms # This special is to be used in interface.py for template processing # to be passed for the $T function: so { ..., 'T' : Ttemplate, ...} @@ -1654,7 +1655,6 @@ def build_header(webdir='', output=None): header['session'] = cfg.api_key() header['new_release'], header['new_rel_url'] = sabnzbd.NEW_VERSION - header['version'] = sabnzbd.__version__ header['paused'] = Downloader.do.paused or Downloader.do.postproc header['pause_int'] = scheduler.pause_int() diff --git a/sabnzbd/assembler.py b/sabnzbd/assembler.py index ba21a1e..903afd8 100644 --- a/sabnzbd/assembler.py +++ b/sabnzbd/assembler.py @@ -134,10 +134,10 @@ class Assembler(Thread): filter, reason = nzo_filtered_by_rating(nzo) if filter == 1: - logging.warning(Ta('WARNING: Paused job "%s" because of rating (%s)'), nzo.final_name, reason) + logging.warning(T('WARNING: Paused job "%s" because of rating (%s)'), nzo.final_name, reason) nzo.pause() elif filter == 2: - logging.warning(Ta('WARNING: Aborted job "%s" because of rating (%s)'), nzo.final_name, reason) + logging.warning(T('WARNING: Aborted job "%s" because of rating (%s)'), nzo.final_name, reason) nzo.fail_msg = T('Aborted, rating filter matched (%s)') % reason sabnzbd.nzbqueue.NzbQueue.do.end_job(nzo) else: diff --git a/sabnzbd/database.py b/sabnzbd/database.py index ed36d78..1ebb1bb 100644 --- a/sabnzbd/database.py +++ b/sabnzbd/database.py @@ -531,7 +531,7 @@ def unpack_history_info(item): if item['script_log']: item['script_log'] = '' # The action line is only available for items in the postproc queue - if not item.has_key('action_line'): + if 'action_line' not in item: item['action_line'] = '' return item diff --git a/sabnzbd/emailer.py b/sabnzbd/emailer.py index fdd6982..99ddaee 100644 --- a/sabnzbd/emailer.py +++ b/sabnzbd/emailer.py @@ -354,7 +354,7 @@ def _prepare_message(txt): msg.set_payload('\n'.join(payload), code) # Check for proper encoding, else call it explicitly - if not msg.has_key('Content-Transfer-Encoding'): + if 'Content-Transfer-Encoding' not in msg: encode_quopri(msg) return msg.as_string() diff --git a/sabnzbd/newsunpack.py b/sabnzbd/newsunpack.py index a7e1fcc..5f00ec1 100644 --- a/sabnzbd/newsunpack.py +++ b/sabnzbd/newsunpack.py @@ -37,7 +37,6 @@ from sabnzbd.misc import format_time_string, find_on_path, make_script_path, int from sabnzbd.tvsort import SeriesSorter import sabnzbd.cfg as cfg from sabnzbd.constants import Status, QCHECK_FILE, RENAMES_FILE -load_data = save_data = None if sabnzbd.WIN32: try: @@ -85,8 +84,6 @@ RAR_VERSION = 0 def find_programs(curdir): """ Find external programs """ - global load_data, save_data - def check(path, program): p = os.path.abspath(os.path.join(path, program)) if os.access(p, os.X_OK): @@ -94,10 +91,6 @@ def find_programs(curdir): else: return None - # Another crazy Python import bug work-around - load_data = sabnzbd.load_data - save_data = sabnzbd.save_data - if sabnzbd.DARWIN: sabnzbd.newsunpack.PAR2C_COMMAND = check(curdir, 'osx/par2/par2-classic') sabnzbd.newsunpack.PAR2_COMMAND = check(curdir, 'osx/par2/par2-sl64') @@ -1590,10 +1583,10 @@ def PAR_Verify(parfile, parfile_nzf, nzo, setname, joinables, classic=False, sin # If successful, add renamed files to the collection if finished and renames: - previous = load_data(RENAMES_FILE, nzo.workpath, remove=False) + previous = sabnzbd.load_data(RENAMES_FILE, nzo.workpath, remove=False) for name in previous or {}: renames[name] = previous[name] - save_data(renames, RENAMES_FILE, nzo.workpath) + sabnzbd.save_data(renames, RENAMES_FILE, nzo.workpath) # If successful and files were reconstructed, remove incomplete original files if finished and reconstructed: @@ -1969,10 +1962,10 @@ def MultiPar_Verify(parfile, parfile_nzf, nzo, setname, joinables, classic=False # But the ones in 'Finding available slices'-section will only be renamed after succesfull repair if renames: # Adding to the collection - previous = load_data(RENAMES_FILE, nzo.workpath, remove=False) + previous = sabnzbd.load_data(RENAMES_FILE, nzo.workpath, remove=False) for name in previous or {}: renames[name] = previous[name] - save_data(renames, RENAMES_FILE, nzo.workpath) + sabnzbd.save_data(renames, RENAMES_FILE, nzo.workpath) # If succes, we also remove the possibly previously renamed ones if finished and previous: @@ -2233,10 +2226,10 @@ def QuickCheck(set, nzo): # Save renames if renames: - previous = load_data(RENAMES_FILE, nzo.workpath, remove=False) + previous = sabnzbd.load_data(RENAMES_FILE, nzo.workpath, remove=False) for name in previous or {}: renames[name] = previous[name] - save_data(renames, RENAMES_FILE, nzo.workpath) + sabnzbd.save_data(renames, RENAMES_FILE, nzo.workpath) return result diff --git a/sabnzbd/nzbstuff.py b/sabnzbd/nzbstuff.py index 5d6e63c..bf42312 100644 --- a/sabnzbd/nzbstuff.py +++ b/sabnzbd/nzbstuff.py @@ -1128,7 +1128,7 @@ class NzbObject(TryList): if self.unwanted_ext and self.status == 'Paused': prefix += T('UNWANTED') + ' / ' # : Queue indicator for unwanted extensions if self.rating_filtered and self.status == 'Paused': - prefix += Ta('FILTERED') + ' / ' # : Queue indicator for filtered + prefix += T('FILTERED') + ' / ' # : Queue indicator for filtered if isinstance(self.wait, float): dif = int(self.wait - time.time() + 0.5) if dif > 0: diff --git a/sabnzbd/urlgrabber.py b/sabnzbd/urlgrabber.py index 105473e..bb5f762 100644 --- a/sabnzbd/urlgrabber.py +++ b/sabnzbd/urlgrabber.py @@ -42,7 +42,7 @@ import sabnzbd.notifier as notifier _BAD_GZ_HOSTS = ('.zip', 'nzbsa.co.za', 'newshost.za.net') _RARTING_FIELDS = ('x-rating-id', 'x-rating-url', 'x-rating-host', 'x-rating-video', 'x-rating-videocnt', 'x-rating-audio', 'x-rating-audiocnt', - 'x-rating-voteup', 'x-rating-votedown', 'x-rating-spam', 'x-rating-confirmed-spam', 'x-rating-passworded', 'x-rating-confirmed-passworded') + 'x-rating-voteup', 'x-rating-votedown', 'x-rating-spam', 'x-rating-confirmed-spam', 'x-rating-passworded', 'x-rating-confirmed-passworded') class URLGrabber(Thread): diff --git a/sabnzbd/utils/systrayiconthread.py b/sabnzbd/utils/systrayiconthread.py index a16fe25..57e92f6 100644 --- a/sabnzbd/utils/systrayiconthread.py +++ b/sabnzbd/utils/systrayiconthread.py @@ -6,8 +6,6 @@ # override doUpdates to perform actions inside the icon thread import os -import sys - import pywintypes import win32api import win32con @@ -204,7 +202,7 @@ class SysTrayIconThread(Thread): win32gui.PostMessage(self.hwnd, win32con.WM_NULL, 0, 0) except pywintypes.error: # Weird PyWin/win32gui bug, just ignore it for now - logging.debug('win32gui problem, cannot show SysTray menu') + pass def create_menu(self, menu, menu_options): for option_text, option_icon, option_action, option_id in menu_options[::-1]: diff --git a/sabnzbd/wizard.py b/sabnzbd/wizard.py index c7c3ef0..f29a1b2 100644 --- a/sabnzbd/wizard.py +++ b/sabnzbd/wizard.py @@ -27,7 +27,6 @@ from Cheetah.Template import Template import sabnzbd import sabnzbd.api from sabnzbd.lang import list_languages, set_language -from sabnzbd.utils.servertests import test_nntp_server_dict from sabnzbd.api import Ttemplate import sabnzbd.interface import sabnzbd.config as config