Skip to content

Add support for OAI-PMH 2.0#21

Open
don-vip wants to merge 2 commits intoritschwumm:masterfrom
don-vip:oai-pmh
Open

Add support for OAI-PMH 2.0#21
don-vip wants to merge 2 commits intoritschwumm:masterfrom
don-vip:oai-pmh

Conversation

@don-vip
Copy link
Contributor

@don-vip don-vip commented Jan 4, 2019

This PR adds support for Open Archives Initiative Protocol for Metadata Harvesting, version 2.0.

This is a standard protocol used by several GLAM to share metadata about collections of images.
It is used in particular by the city archives of Toulouse, which released many contents in open data. It just allowed me to import a small fonds using Commonist: Fonds_Ludovic_Gaurier

I tried to make it reusable for others with a new properties file. To make it work, one or more XML files with OAI-PMH contents must be in the same directory than the images. Matching is performed on the filename without extension and the dc:relation tag.

This is the first time I ever code in Scala, so there are surely some things that could be written better. But it works :)

Copy link
Owner

@ritschwumm ritschwumm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well done for a newbie :)

}

private def dimensions(format:String):String = {
".*; (\\d+) x (\\d+) cm ;.*".r.findAllMatchIn(format).foreach { m =>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a bit more tricvky, but there's should be a way to get rid of the early return

val historyIndex = fullDescription.indexOf(historyMarker)
val format = text(dc \ "format").replaceAll("image/jpeg", "").trim()

return Some(new ImageData(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some/None can be better be done with scutil's Boolean.option(trueValue)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand, do you want me to write Boolean.option(new ImageData(... ? I get value option is not a member of object Boolean

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants