Browse Source

Log RAR-binary and RAR-file versions

pull/414/merge
Safihre 10 years ago
committed by shypike
parent
commit
2f00a878a6
  1. 9
      SABnzbd.py
  2. 4
      sabnzbd/newsunpack.py
  3. 6
      sabnzbd/utils/rarfile.py

9
SABnzbd.py

@ -496,7 +496,8 @@ def print_modules():
logging.info("par2-classic binary... found (%s)", sabnzbd.newsunpack.PAR2C_COMMAND)
if sabnzbd.newsunpack.RAR_COMMAND:
logging.info("unrar binary... found (%s)", sabnzbd.newsunpack.RAR_COMMAND)
logging.info("UNRAR binary... found (%s)", sabnzbd.newsunpack.RAR_COMMAND)
else:
logging.warning(T('unrar binary... NOT found'))
@ -1097,9 +1098,6 @@ def main():
except:
Bail_Out(browserhost, cherryport, '49')
# Find external programs
sabnzbd.newsunpack.find_programs(sabnzbd.DIR_PROG)
# Windows instance is reachable through registry
url = None
if sabnzbd.WIN32 and not new_instance:
@ -1354,6 +1352,9 @@ def main():
except:
logging.info("pygtk2 not found. No SysTray.")
# Find external programs
sabnzbd.newsunpack.find_programs(sabnzbd.DIR_PROG)
print_modules()
import sabnzbd.utils.sslinfo

4
sabnzbd/newsunpack.py

@ -146,11 +146,10 @@ def find_programs(curdir):
version, original = unrar_check(sabnzbd.newsunpack.RAR_COMMAND)
sabnzbd.newsunpack.RAR_PROBLEM = not original or version < 380
sabnzbd.newsunpack.RAR_VERSION = version
logging.info('UNRAR version %s', version)
logging.info('UNRAR binary version %.2f', (float(version) / 100))
if sabnzbd.newsunpack.RAR_PROBLEM:
logging.info('Problematic UNRAR')
def external_processing(extern_proc, complete_dir, filename, nicename, cat, group, status, failure_url):
""" Run a user postproc script, return console output and exit value """
command = [str(extern_proc), str(complete_dir), str(filename),
@ -597,6 +596,7 @@ def rar_extract_core(rarfile, numrars, one_folder, nzo, setname, extraction_path
stup, need_shell, command, creationflags = build_command(command)
logging.debug("Analyzing rar file ... %s found", is_rarfile(rarfile))
logging.debug("Running unrar %s", command)
p = subprocess.Popen(command, shell=need_shell, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,

6
sabnzbd/utils/rarfile.py

@ -108,7 +108,11 @@ def is_rarfile(fn):
'''Check quickly whether file is rar archive.'''
try:
buf = open(fn, "rb").read(50)
return buf.startswith(RAR_ID) or buf.startswith(RAR5_ID)
if(buf.startswith(RAR5_ID)):
return "rar5 signature"
if(buf.startswith(RAR_ID)):
return "rar4 (or lower) signature"
return None
except:
return False

Loading…
Cancel
Save