demetsiiify icon indicating copy to clipboard operation
demetsiiify copied to clipboard

List index out of range.

Open jcmundy opened this issue 7 years ago • 8 comments

I'm getting this error when I input mets into a locally hosted demetsiiify:

  File "/usr/local/lib/python3.5/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.5/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/code/demetsiiify/blueprints/api.py", line 127, in api_import
    job_meta = mets.get_basic_info(mets_url)
  File "/code/demetsiiify/mets.py", line 382, in get_basic_info
    doc.read_metadata()
  File "/code/demetsiiify/mets.py", line 162, in read_metadata
    self.metadata['title'] = self._read_titles()
  File "/code/demetsiiify/mets.py", line 148, in _read_titles
    ".//mods:relatedItem[@type='host']/mods:titleInfo")[0]]
IndexError: list index out of range

jcmundy avatar Sep 17 '18 21:09 jcmundy

Can you link the METS you're using?

jbaiter avatar Sep 18 '18 07:09 jbaiter

Does this work if the images the METS references are not actually hosted, or will it only work if it can find the images there? Thanks

jcmundy avatar Sep 18 '18 13:09 jcmundy

This is a sample METS file. It came with the path as ..\IMAGES\Output\ and I have tried it as that and as ../IMAGES/Output/ https://github.com/jcmundy/samplepage/blob/master/METS.xml

jcmundy avatar Sep 18 '18 16:09 jcmundy

Oh, I'm afraid there are a couple of things:

  1. As listed under the caveats in the README, currently only METS/MODS that conforms to the German Research Foundation specifications is supported. I'll take a look at your METS and see if I can get it working, though.
  2. The images referenced in the METS currently must be hosted somewhere publicly. This is because the aforementioned specification doesn't mandate the inclusion of image dimensions in the metadata, so the app has to grab the actual images to determine the available sizes. However, it seems that in your case you have a mets:techMD that contains the neccessary information. I'll see if I can add support for that!

More broadly speaking, what's your use case for the app? Are you planning on serving IIIF from your current METS data or is it just for viewing convenience?

jbaiter avatar Sep 18 '18 21:09 jbaiter

Thank you for your help. We are reworking an app that hosts files from using METS/ALTO to IIIF, so we are looking for a way to convert our old METS to IIIF for public hosting of files.

jcmundy avatar Sep 19 '18 13:09 jcmundy

I have the plan to create a standalone library (along with a command-line interface) from the demetsiiify app that would allow you do that while providing your own IIIF Image hosting. Would that be useful? The basic idea is to do something like:

$ demetsiiify-cli my_mets.xml \
    --image-api-base=https://example.com/iiif/image \
    -o manifest.json

jbaiter avatar Sep 21 '18 12:09 jbaiter

Yes, that would be useful for us. That sounds great.

jcmundy avatar Sep 21 '18 13:09 jcmundy

I have gotten one of our METS files to include the urls of the hosted images now, but it looks like the problem may be that we have used mix rather than mods? Is there a way to make that work? Thank you again for your help.

jcmundy avatar Oct 17 '18 19:10 jcmundy