Unverified Commit 9723f421 authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

always decide on image file extension



instead of choosing jp2
Signed-off-by: Sebastian Schüpbach's avatarSebastian Schüpbach <sebastian.schuepbach@unibas.ch>
parent fe2d6880
Pipeline #21275 passed with stages
in 1 minute and 46 seconds
......@@ -113,9 +113,6 @@ def _extract_dig_obj_vals(msg, access_status) -> dict:
return_values['duration'] = duration
return_values['type'] = msg['isDistributedOn']
if 'hasMimeType' in msg:
if return_values['type'] == 'image' and not _is_remote_file(msg):
mimetype = 'image/jp2'
else:
mimetype = msg['hasMimeType']
return_values['mimetype'] = mimetype
if _is_remote_file(msg):
......@@ -127,7 +124,19 @@ def _extract_dig_obj_vals(msg, access_status) -> dict:
else:
return_values['proto'] = 'file'
if return_values['type'] == 'image':
if return_values.get('mimetype'):
if return_values['mimetype'] == 'image/jpeg':
file_extension = 'jpg'
elif return_values['mimetype'] == 'image/png':
file_extension = 'png'
elif return_values['mimetype'] == 'image/jp2':
file_extension = 'jp2'
else:
file_extension = ''
logging.warning('No valid mimetype found!')
else:
file_extension = ''
logging.warning('No valid mimetype found!')
if return_values['type'] == 'audio':
file_extension = 'mp4'
if return_values['type'] == 'video':
......
Markdown is supported
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