UnRAR implementation.

This commit is contained in:
morpheus65535 2019-01-25 22:56:55 -05:00
parent 8472a48e28
commit c3cb53cb41
8 changed files with 74 additions and 0 deletions

View File

@ -4,6 +4,8 @@ import os
import sqlite3
import logging
import time
import platform
import rarfile
from cork import Cork
try:
@ -147,3 +149,41 @@ if not os.path.exists(os.path.normpath(os.path.join(args.config_dir, 'config', '
'creation_date': tstamp
}
cork._store.save_users()
def init_binaries():
binaries_dir = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', 'bin'))
unrar_exe = None
exe = None
if platform.system() == "Windows": # Windows
unrar_exe = os.path.abspath(os.path.join(binaries_dir, "Windows", "i386", "UnRAR", "UnRAR.exe"))
elif platform.system() == "Darwin": # MacOSX
unrar_exe = os.path.abspath(os.path.join(binaries_dir, "MacOSX", "i386", "UnRAR", "unrar"))
elif platform.system() == "Linux": # Linux
unrar_exe = os.path.abspath(os.path.join(binaries_dir, "Linux", platform.machine(), "UnRAR", "unrar"))
else:
unrar_exe = "unrar"
if unrar_exe and os.path.isfile(unrar_exe):
exe = unrar_exe
rarfile.UNRAR_TOOL = exe
rarfile.ORIG_UNRAR_TOOL = exe
try:
rarfile.custom_check([rarfile.UNRAR_TOOL], True)
except:
logging.debug("custom check failed for: %s", exe)
rarfile.OPEN_ARGS = rarfile.ORIG_OPEN_ARGS
rarfile.EXTRACT_ARGS = rarfile.ORIG_EXTRACT_ARGS
rarfile.TEST_ARGS = rarfile.ORIG_TEST_ARGS
logging.info("Using UnRAR from: %s", exe)
unrar = exe
return unrar
init_binaries()

Binary file not shown.

Binary file not shown.

BIN
bin/Linux/i386/UnRAR/unrar Normal file

Binary file not shown.

Binary file not shown.

BIN
bin/MacOSX/i386/UnRAR/unrar Normal file

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,34 @@
****** ***** ****** UnRAR - free utility for RAR archives
** ** ** ** ** ** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
****** ******* ****** License for use and distribution of
** ** ** ** ** ** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
** ** ** ** ** ** FREEWARE version
~~~~~~~~~~~~~~~~
The UnRAR utility is freeware. This means:
1. All copyrights to RAR and the utility UnRAR are exclusively
owned by the author - Alexander Roshal.
2. The UnRAR utility may be freely distributed. It is allowed
to distribute UnRAR inside of other software packages.
3. THE RAR ARCHIVER AND THE UnRAR UTILITY ARE DISTRIBUTED "AS IS".
NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED. YOU USE AT
YOUR OWN RISK. THE AUTHOR WILL NOT BE LIABLE FOR DATA LOSS,
DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING
OR MISUSING THIS SOFTWARE.
4. Neither RAR binary code, WinRAR binary code, UnRAR source or UnRAR
binary code may be used or reverse engineered to re-create the RAR
compression algorithm, which is proprietary, without written
permission of the author.
5. If you don't agree with terms of the license you must remove
UnRAR files from your storage devices and cease to use the
utility.
Thank you for your interest in RAR and UnRAR.
Alexander L. Roshal