Skip to content

Commit

Permalink
Merge pull request #49 from bodleian/develop
Browse files Browse the repository at this point in the history
Fix #48 - support jpylyzer 2 new output format
  • Loading branch information
ahankinson authored Jan 16, 2020
2 parents f10b2d7 + e1d6081 commit bf10ebb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion image_processing/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ def validate_jp2(image_file, output_file=None):
"""
logger = logging.getLogger(__name__)
jp2_element = checkOneFile(image_file)
success = jp2_element.findtext('isValidJP2') == 'True'
is_valid_element = jp2_element.find('isValid')
# elements are falsey if they have no children, so we explicitly check `is None`
if is_valid_element is None:
# isValid is only in post-2.0.0 jyplyzer output. legacy output has isValidJP2 instead
is_valid_element = jp2_element.find('isValidJP2')
success = is_valid_element is not None and is_valid_element.text == 'True'
output_string = minidom.parseString(ElementTree.tostring(jp2_element)).toprettyxml(encoding='utf-8')
if output_file:
with open(output_file, 'wb') as f:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
long_description = f.read()

setup(name='image_processing',
version='1.9.0',
version='1.9.1',
description='Digital Bodleian image processing library',
url='http://github.com/bodleian/image-processing',
license="MIT",
Expand Down

0 comments on commit bf10ebb

Please sign in to comment.