get size from zip
This commit is contained in:
parent
b66e76c01a
commit
08e9472d2a
1 changed files with 5 additions and 6 deletions
|
@ -19,6 +19,7 @@ from utils import find_isbns, get_language, to_isbn13
|
|||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def get_ratio(data):
|
||||
try:
|
||||
img = Image.open(BytesIO(data))
|
||||
|
@ -78,12 +79,10 @@ def cover(path):
|
|||
filename = unquote(e.attrib['href'])
|
||||
filename = os.path.normpath(os.path.join(os.path.dirname(opf[0]), filename))
|
||||
if filename in files:
|
||||
image_data.append((filename, z.read(filename)))
|
||||
image_data.append(filename)
|
||||
if image_data:
|
||||
image_data.sort(key=lambda i: len(i[1]))
|
||||
data = image_data[-1][1]
|
||||
logger.debug('using %s', image_data[-1][0])
|
||||
return data
|
||||
image_data.sort(key=lambda name: z.getinfo(name).file_size)
|
||||
return use(image_data[-1])
|
||||
for e in manifest.getchildren():
|
||||
if 'html' in e.attrib['media-type']:
|
||||
filename = unquote(e.attrib['href'])
|
||||
|
|
Loading…
Reference in a new issue