Added unrar support to extract.py

This commit is contained in:
lanxu 2017-03-19 20:10:59 +02:00
parent 1e56ed5322
commit b83b721bdf

View File

@ -58,7 +58,8 @@ def main(argv):
extractTools = [ extractTools = [
{ "extension": "\.tar\.gz$", "command": "tar", "params": "-xf", "oparams": "-C" }, { "extension": "\.tar\.gz$", "command": "tar", "params": "-xf", "oparams": "-C" },
{ "extension": "\.tar\.xz$", "command": "tar", "params": "-xf", "oparams": "-C" }, { "extension": "\.tar\.xz$", "command": "tar", "params": "-xf", "oparams": "-C" },
{ "extension": "\.zip$", "command": "unzip", "params": "", "oparams": "-d" } { "extension": "\.zip$", "command": "unzip", "params": "", "oparams": "-d" },
{ "extension": "\.rar$", "command": "unrar", "params": "x", "oparams": "" },
] ]
if os.path.isfile(argv[0]) == False: if os.path.isfile(argv[0]) == False:
@ -91,7 +92,8 @@ def main(argv):
if not os.path.exists(output_path): if not os.path.exists(output_path):
os.makedirs(output_path) os.makedirs(output_path)
command.append(tool['oparams']) if tool["oparams"] is not "":
command.append(tool['oparams'])
command.append(output_path) command.append(output_path)
try: try: