Browse Source

Add more logging about password file results.

pull/135/head
shypike 11 years ago
parent
commit
eae644d8f6
  1. 8
      sabnzbd/newsunpack.py

8
sabnzbd/newsunpack.py

@ -476,20 +476,24 @@ def rar_extract(rarfile, numrars, one_folder, nzo, setname, extraction_path):
new_files = None new_files = None
rars = [] rars = []
if nzo.password: if nzo.password:
logging.info('Got a password set by user')
passwords = [nzo.password] passwords = [nzo.password]
else: else:
passwords = [] passwords = []
# Append meta passwords, to prevent changing the original list # Append meta passwords, to prevent changing the original list
passwords.extend(nzo.meta.get('password', [])) passwords.extend(nzo.meta.get('password', []))
if passwords:
logging.info('Read %s passwords from meta data in NZB', len(passwords))
pw_file = cfg.password_file.get_path() pw_file = cfg.password_file.get_path()
if pw_file: if pw_file:
try: try:
pwf = open(pw_file, 'r') pwf = open(pw_file, 'r')
lines = pwf.read().split('\n') lines = pwf.read().split('\n')
# Remove empty lines and space-only passwords and remove surrounding spaces # Remove empty lines and space-only passwords and remove surrounding spaces
passwords.extend([pw.strip('\r\n ') for pw in lines if pw.strip('\r\n ')]) pws = [pw.strip('\r\n ') for pw in lines if pw.strip('\r\n ')]
passwords.extend(pws)
pwf.close() pwf.close()
logging.info('Read the passwords file %s', pw_file) logging.info('Read %s passwords from file %s', len(pws), pw_file)
except IOError: except IOError:
logging.info('Failed to read the passwords file %s', pw_file) logging.info('Failed to read the passwords file %s', pw_file)

Loading…
Cancel
Save