diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2014-02-27 12:27:42 -0500 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2014-02-27 12:27:42 -0500 |
| commit | 0d583ea5f9873a5b2a22a89bbb979bf08dd05a90 (patch) | |
| tree | c7eb7fc4a31955d06cfd3e1ddd611799d65cc6ab /parsedjvutext.py | |
| parent | 0ceb87ba43bc52a7f73b62ce0795b7e78f57ea04 (diff) | |
| download | ocr-layer-curation-0d583ea5f9873a5b2a22a89bbb979bf08dd05a90.tar.gz | |
Add the possibility to specify list of pages to parse_book
Diffstat (limited to 'parsedjvutext.py')
| -rw-r--r-- | parsedjvutext.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/parsedjvutext.py b/parsedjvutext.py index 44340cc..9855786 100644 --- a/parsedjvutext.py +++ b/parsedjvutext.py @@ -4,6 +4,7 @@ import subprocess import djvu from djvu.decode import Context from itertools import chain +import collections def parse_book_xml(djvubook): @@ -64,8 +65,10 @@ def parse_book(djvubook, page=None, html=False): c = Context() document = c.new_document(djvu.decode.FileURI(djvubook)) document.decoding_job.wait() - if page: + if type(page) is int: toparse = [document.pages[page - 1]] + elif isinstance(page, collections.Iterable): + toparse = page else: toparse = document.pages |
