summaryrefslogtreecommitdiffhomepage
path: root/libs/subzero
diff options
context:
space:
mode:
authormorpheus65535 <[email protected]>2022-05-18 06:46:52 -0400
committermorpheus65535 <[email protected]>2022-05-18 06:46:52 -0400
commit642733f92f08c64cb048372d7ce92a4bede8dc84 (patch)
tree069d9d8ae0c37080b7680094b310d4b9b3a5d4c9 /libs/subzero
parent3d7fa06f410ef1dc491b2867212e402fda5af6b6 (diff)
downloadbazarr-642733f92f08c64cb048372d7ce92a4bede8dc84.tar.gz
bazarr-642733f92f08c64cb048372d7ce92a4bede8dc84.zip
Added support for unar RAR extraction utility. #1833
Diffstat (limited to 'libs/subzero')
-rw-r--r--libs/subzero/lib/rar.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/libs/subzero/lib/rar.py b/libs/subzero/lib/rar.py
index e9a08bb3b..b82f667ec 100644
--- a/libs/subzero/lib/rar.py
+++ b/libs/subzero/lib/rar.py
@@ -15,7 +15,20 @@ class RarFile(rarfile.RarFile):
:param psw:
:return:
"""
- cmd = [rarfile.UNRAR_TOOL] + list(rarfile.ORIG_OPEN_ARGS)
+ exe = None
+ try:
+ rarfile.tool_setup(unrar=False, unar=True, bsdtar=False, force=True)
+ except rarfile.RarCannotExec:
+ try:
+ rarfile.rarfile.tool_setup(unrar=True, unar=False, bsdtar=False, force=True)
+ except rarfile.RarCannotExec:
+ raise rarfile.RarCannotExec
+ else:
+ exe = rarfile.UNRAR_TOOL
+ else:
+ exe = rarfile.UNAR_TOOL
+ finally:
+ cmd = [exe] + list(rarfile.ORIG_OPEN_ARGS)
with rarfile.XTempFile(self._rarfile) as rf:
log.debug(u"RAR CMD: %s", cmd + [rf, fname])