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