Commit 865776f1 authored by Merlijn Wajer's avatar Merlijn Wajer
Browse files

scandata: deal with single-page scandata

parent 19b0df30
...@@ -75,9 +75,15 @@ def scandata_get_skip_pages(scandata): ...@@ -75,9 +75,15 @@ def scandata_get_skip_pages(scandata):
""" """
skip = [] skip = []
for idx in range(len(scandata['book']['pageData']['page'])): pages = scandata['book']['pageData']['page']
# If there is just one page, pages is not a list.
if not isinstance(pages, list):
pages = [pages]
for idx in range(len(pages)):
try: try:
add_to_access_format = scandata['book']['pageData']['page'][idx]['addToAccessFormats'] add_to_access_format = pages[idx]['addToAccessFormats']
if add_to_access_format == 'false': if add_to_access_format == 'false':
skip.append(idx) skip.append(idx)
except KeyError: except KeyError:
......
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