Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List index out of range. #10

Open
jcmundy opened this issue Sep 17, 2018 · 8 comments
Open

List index out of range. #10

jcmundy opened this issue Sep 17, 2018 · 8 comments

Comments

@jcmundy
Copy link

jcmundy commented Sep 17, 2018

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
@jbaiter
Copy link
Owner

jbaiter commented Sep 18, 2018

Can you link the METS you're using?

@jcmundy
Copy link
Author

jcmundy commented Sep 18, 2018

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
Copy link
Author

jcmundy commented Sep 18, 2018

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

@jbaiter
Copy link
Owner

jbaiter commented Sep 18, 2018

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?

@jcmundy
Copy link
Author

jcmundy commented Sep 19, 2018

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.

@jbaiter
Copy link
Owner

jbaiter commented Sep 21, 2018

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

@jcmundy
Copy link
Author

jcmundy commented Sep 21, 2018

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

@jcmundy
Copy link
Author

jcmundy commented Oct 17, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants