Bugfix after merge
This commit is contained in:
@@ -47,11 +47,9 @@ def get_epub_layout(book, book_data):
|
||||
'n': 'urn:oasis:names:tc:opendocument:xmlns:container',
|
||||
'pkg': 'http://www.idpf.org/2007/opf',
|
||||
}
|
||||
|
||||
file_path = os.path.normpath(os.path.join(config.config_calibre_dir, book.path, book_data.name + "." + book_data.format.lower()))
|
||||
|
||||
epubZip = zipfile.ZipFile(file_path)
|
||||
|
||||
txt = epubZip.read('META-INF/container.xml')
|
||||
tree = etree.fromstring(txt)
|
||||
cfname = tree.xpath('n:rootfiles/n:rootfile/@full-path', namespaces=ns)[0]
|
||||
|
||||
+16
-12
@@ -21,6 +21,7 @@ import base64
|
||||
import datetime
|
||||
import os
|
||||
import uuid
|
||||
import zipfile
|
||||
from time import gmtime, strftime
|
||||
import json
|
||||
from urllib.parse import unquote
|
||||
@@ -460,18 +461,21 @@ def get_metadata(book):
|
||||
continue
|
||||
for kobo_format in KOBO_FORMATS[book_data.format]:
|
||||
# log.debug('Id: %s, Format: %s' % (book.id, kobo_format))
|
||||
if get_epub_layout(book, book_data) == 'pre-paginated':
|
||||
kobo_format = 'EPUB3FL'
|
||||
download_urls.append(
|
||||
{
|
||||
"Format": kobo_format,
|
||||
"Size": book_data.uncompressed_size,
|
||||
"Url": get_download_url_for_book(book, book_data.format),
|
||||
# The Kobo forma accepts platforms: (Generic, Android)
|
||||
"Platform": "Generic",
|
||||
# "DrmType": "None", # Not required
|
||||
}
|
||||
)
|
||||
try:
|
||||
if get_epub_layout(book, book_data) == 'pre-paginated':
|
||||
kobo_format = 'EPUB3FL'
|
||||
download_urls.append(
|
||||
{
|
||||
"Format": kobo_format,
|
||||
"Size": book_data.uncompressed_size,
|
||||
"Url": get_download_url_for_book(book, book_data.format),
|
||||
# The Kobo forma accepts platforms: (Generic, Android)
|
||||
"Platform": "Generic",
|
||||
# "DrmType": "None", # Not required
|
||||
}
|
||||
)
|
||||
except (zipfile.BadZipfile, FileNotFoundError) as e:
|
||||
log.error(e)
|
||||
|
||||
book_uuid = book.uuid
|
||||
metadata = {
|
||||
|
||||
Reference in New Issue
Block a user