Changed unrar to rarfile
Removed unused pypdf dependency in setup
This commit is contained in:
parent
ad8bfe5a1c
commit
15dff9ce4e
@ -28,10 +28,10 @@ import shutil
|
||||
|
||||
from natsort import natsorted
|
||||
try:
|
||||
from unrar import rarfile
|
||||
from unrar import unrarlib
|
||||
import unrar.constants
|
||||
from unrar import constants
|
||||
import rarfile
|
||||
#from unrar import unrarlib
|
||||
#import unrar.constants
|
||||
#from unrar import constants
|
||||
rarsupport = True
|
||||
except ImportError:
|
||||
rarsupport = False
|
||||
@ -39,7 +39,7 @@ import ctypes
|
||||
import io
|
||||
|
||||
|
||||
if rarsupport:
|
||||
'''if rarsupport:
|
||||
class OpenableRarFile(rarfile.RarFile):
|
||||
def open(self, member):
|
||||
#print "opening %s..." % member
|
||||
@ -75,7 +75,7 @@ if rarsupport:
|
||||
self._close(handle)
|
||||
if not found:
|
||||
raise KeyError('There is no item named %r in the archive' % member)
|
||||
return b''.join(buf)
|
||||
return b''.join(buf)'''
|
||||
|
||||
|
||||
# if platform.system() == "Windows":
|
||||
@ -372,17 +372,9 @@ if rarsupport:
|
||||
while tries < 7:
|
||||
try:
|
||||
tries = tries + 1
|
||||
#tmp_folder = tempfile.mkdtemp()
|
||||
#tmp_file = os.path.join(tmp_folder, archive_file)
|
||||
#rarc.extract(archive_file, tmp_folder)
|
||||
data = rarc.open(archive_file)
|
||||
#data = open(tmp_file).read()
|
||||
data = rarc.read(archive_file)
|
||||
entries = [(rarc.getinfo(archive_file), data)]
|
||||
|
||||
#shutil.rmtree(tmp_folder, ignore_errors=True)
|
||||
|
||||
#entries = rarc.read_files( archive_file )
|
||||
|
||||
if entries[0][0].file_size != len(entries[0][1]):
|
||||
errMsg = u"readArchiveFile(): [file is not expected size: {0} vs {1}] {2}:{3} [attempt # {4}]".format(
|
||||
entries[0][0].file_size, len(entries[0][1]), self.path,
|
||||
@ -502,7 +494,8 @@ if rarsupport:
|
||||
try:
|
||||
tries = tries + 1
|
||||
#rarc = UnRAR2.RarFile( self.path )
|
||||
rarc = OpenableRarFile(self.path)
|
||||
rarc = rarfile.RarFile(self.path)
|
||||
#rarc = OpenableRarFile(self.path)
|
||||
|
||||
except (OSError, IOError) as e:
|
||||
errMsg = u"getRARObj(): [{0}] {1} attempt#{2}".format(
|
||||
@ -903,7 +896,7 @@ class ComicArchive:
|
||||
# k = os.path.join(os.path.split(k)[0], "z" + basename)
|
||||
return k.lower()
|
||||
|
||||
files = natsorted(files, key=keyfunc, signed=False)
|
||||
files = natsorted(files, key=keyfunc) #, signed=False)
|
||||
|
||||
# make a sub-list of image files
|
||||
self.page_list = []
|
||||
|
8
setup.py
8
setup.py
@ -1,15 +1,15 @@
|
||||
from setuptools import setup
|
||||
setup(
|
||||
name = 'comicapi',
|
||||
version = '2.0',
|
||||
version = '2.1',
|
||||
description = 'Comic archive (cbr/cbz) and metadata utilities. Extracted from the comictagger project.',
|
||||
author = 'Iris W',
|
||||
packages = ['comicapi'],
|
||||
install_requires = ['natsort>=3.5.2', 'pypdf2>=1.26'],
|
||||
install_requires = ['natsort>=3.5.2'],
|
||||
extras_require = {
|
||||
'CBR': ['unrar==0.3']
|
||||
'CBR': ['rarfile==2.7']
|
||||
},
|
||||
python_requires = '>=2.7.0',
|
||||
url = 'https://github.com/wildthyme/comicapi',
|
||||
url = 'https://github.com/OzzieIsaacs/comicapi',
|
||||
classifiers = ['License :: OSI Approved :: Apache Software License 2.0 (Apache-2.0)']
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user