Commit 673c6ae0 authored by Aram Verstegen's avatar Aram Verstegen Committed by Merlijn Wajer
Browse files

Scandata parsing function is named differently in derivermodule

parent 6b44a4d4
...@@ -9,12 +9,12 @@ from ebooklib import epub ...@@ -9,12 +9,12 @@ from ebooklib import epub
try: try:
from derivermodule.metadata import parse_item_metadata from derivermodule.metadata import parse_item_metadata
from derivermodule.scandata import scandata_xml_get_skip_pages from derivermodule.scandata import scandata_parse, scandata_get_skip_pages
except: except:
# This is ok, just don't support _meta.xml and _scandata.xml # This is ok, just don't support _meta.xml and _scandata.xml
# Just error later on when/if the files are actually being passed # Just error later on when/if the files are actually being passed
parse_item_metadata = None parse_item_metadata = None
scandata_xml_get_skip_pages = None scandata_get_skip_pages = None
import iso639 import iso639
...@@ -224,8 +224,9 @@ class EpubGenerator(object): ...@@ -224,8 +224,9 @@ class EpubGenerator(object):
else: else:
self.img_stack = None self.img_stack = None
# Try to find scandata # Try to find scandata
if os.path.exists(self.scandata_xml_file_path) and scandata_xml_get_skip_pages is not None: if os.path.exists(self.scandata_xml_file_path) and scandata_get_skip_pages is not None:
self.skip_pages = scandata_xml_get_skip_pages(self.scandata_xml_file_path) self.scandata = scandata_parse(self.scandata_xml_file_path)
self.skip_pages = scandata_get_skip_pages(self.scandata)
else: else:
self.skip_pages = [] self.skip_pages = []
...@@ -245,7 +246,8 @@ class EpubGenerator(object): ...@@ -245,7 +246,8 @@ class EpubGenerator(object):
""" """
Set the metadata on the epub object Set the metadata on the epub object
""" """
self.book.set_identifier(self.metadata['identifier']) if 'identifier' in self.metadata.keys():
self.book.set_identifier(self.metadata['identifier'])
if 'language' in self.metadata.keys(): if 'language' in self.metadata.keys():
if type(self.metadata['language']) is str: if type(self.metadata['language']) is str:
self.metadata['language'] = self.normalize_language(self.metadata['language']) self.metadata['language'] = self.normalize_language(self.metadata['language'])
...@@ -427,10 +429,7 @@ class EpubGenerator(object): ...@@ -427,10 +429,7 @@ class EpubGenerator(object):
def generate(self, confidence_threshold=75.0): def generate(self, confidence_threshold=75.0):
self.book = epub.EpubBook() self.book = epub.EpubBook()
self.book.reset() self.book.reset()
try: self.set_metadata()
self.set_metadata()
except:
pass
css_file = epub.EpubItem( css_file = epub.EpubItem(
uid="style_nav", uid="style_nav",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment