Browse Source

Corrections after running PyLint.

Mostly non-functionals like: unnecessary imports, unused variables, irregular indentation etc.
Also found some potential problems:
- Incorrect use of a global in __init__.py (health guardian)
- Missing error texts in API
- Bandwidth limit did not support KMG notation, while it should
tags/0.6.0
shypike 16 years ago
parent
commit
742ce95949
  1. 1
      main/SABnzbd.py
  2. 6
      main/sabnzbd/__init__.py
  3. 8
      main/sabnzbd/assembler.py
  4. 3
      main/sabnzbd/cfg.py
  5. 2
      main/sabnzbd/codecs.py
  6. 28
      main/sabnzbd/config.py
  7. 3
      main/sabnzbd/database.py
  8. 4
      main/sabnzbd/decoder.py
  9. 10
      main/sabnzbd/dirscanner.py
  10. 1
      main/sabnzbd/email.py
  11. 40
      main/sabnzbd/interface.py
  12. 9
      main/sabnzbd/lang.py
  13. 5
      main/sabnzbd/misc.py
  14. 15
      main/sabnzbd/newsunpack.py
  15. 19
      main/sabnzbd/newswrapper.py
  16. 1
      main/sabnzbd/newzbin.py
  17. 28
      main/sabnzbd/nzbqueue.py
  18. 2
      main/sabnzbd/nzbstuff.py
  19. 21
      main/sabnzbd/postproc.py
  20. 4
      main/sabnzbd/scheduler.py
  21. 2
      main/sabnzbd/tvsort.py
  22. 4
      main/sabnzbd/urlgrabber.py
  23. 2
      main/sabnzbd/wizard.py

1
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)

6
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...')

8
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:

3
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')

2
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

28
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 ''

3
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

4
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):

10
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):

1
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

40
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</%s>\n' % (keyw, xml_name(lst, encoding='utf-8'), keyw)
text = '<%s>%s</%s>\n' % (keyw, xml_name(lst, encoding='utf-8'), keyw)
else:
text = ''
return text

9
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

5
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

15
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)

19
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 """

1
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):

28
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):

2
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)

21
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

4
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):

2
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

4
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

2
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

Loading…
Cancel
Save