Browse Source

Fix little problem in extension detection and fix some PyLint complaints.

pull/156/head
shypike 11 years ago
parent
commit
987a64d3a4
  1. 8
      sabnzbd/assembler.py

8
sabnzbd/assembler.py

@ -122,7 +122,7 @@ class Assembler(Thread):
import sabnzbd.nzbqueue import sabnzbd.nzbqueue
sabnzbd.nzbqueue.NzbQueue.do.end_job(nzo) sabnzbd.nzbqueue.NzbQueue.do.end_job(nzo)
unwanted = rar_contains_unwanted_file(nzo, filepath) unwanted = rar_contains_unwanted_file(filepath)
if unwanted: if unwanted:
logging.warning(Ta('WARNING: In "%s" unwanted extension in RAR file. Unwanted file is %s '), latin1(nzo.final_name), unwanted) logging.warning(Ta('WARNING: In "%s" unwanted extension in RAR file. Unwanted file is %s '), latin1(nzo.final_name), unwanted)
if cfg.action_on_unwanted_extensions() == 1: if cfg.action_on_unwanted_extensions() == 1:
@ -338,12 +338,12 @@ def check_encrypted_rar(nzo, filepath):
return encrypted return encrypted
def rar_contains_unwanted_file(nzo, filepath): def rar_contains_unwanted_file(filepath):
# checks for unwanted extensions in the rar file 'filepath' # checks for unwanted extensions in the rar file 'filepath'
# ... unwanted extensions are defined in global variable cfg.unwanted_extensions() # ... unwanted extensions are defined in global variable cfg.unwanted_extensions()
# returns False if no unwanted extensions are found in the rar file # returns False if no unwanted extensions are found in the rar file
# returns name of file if unwanted extension is found in the rar file # returns name of file if unwanted extension is found in the rar file
unwanted = False unwanted = None
if is_rarfile(filepath): if is_rarfile(filepath):
#logging.debug('rar file to check: %s',filepath) #logging.debug('rar file to check: %s',filepath)
#logging.debug('unwanted extensions are: %s', cfg.unwanted_extensions()) #logging.debug('unwanted extensions are: %s', cfg.unwanted_extensions())
@ -354,7 +354,7 @@ def rar_contains_unwanted_file(nzo, filepath):
logging.debug('file in rar file: %s', somefile) logging.debug('file in rar file: %s', somefile)
if os.path.splitext(somefile)[1].replace('.', '').lower() in cfg.unwanted_extensions(): if os.path.splitext(somefile)[1].replace('.', '').lower() in cfg.unwanted_extensions():
logging.debug('Unwanted file %s', somefile) logging.debug('Unwanted file %s', somefile)
unwanted = True unwanted = somefile
zf.close() zf.close()
except: except:
logging.debug('RAR file %s cannot be inspected.', filepath) logging.debug('RAR file %s cannot be inspected.', filepath)

Loading…
Cancel
Save