X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/6b327e1a303fa8512cd5c56684bab2869198c01e..ff2a09e9ecd8e9bede2d3572942bcd32f66f6198:/librarian/dcparser.py?ds=sidebyside diff --git a/librarian/dcparser.py b/librarian/dcparser.py index a690e8f..f413fac 100644 --- a/librarian/dcparser.py +++ b/librarian/dcparser.py @@ -10,7 +10,7 @@ import re from librarian.util import roman_to_int from librarian import (ValidationError, NoDublinCore, ParseError, DCNS, RDFNS, - XMLNS, WLURI) + XMLNS, WLURI, WLNS, PLMETNS) import lxml.etree as etree # ElementTree API using libxml2 from lxml.etree import XMLSyntaxError @@ -82,6 +82,7 @@ for now we will translate this to some single date losing information of course. try: # check out the "N. poł X w." syntax if isinstance(text, str): text = text.decode("utf-8") + century_format = u"(?:([12]) *poł[.]? +)?([MCDXVI]+) *w[.,]*(?: *l[.]? *([0-9]+))?" vague_format = u"(?:po *|ok. *)?([0-9]{4})(-[0-9]{2}-[0-9]{2})?" @@ -229,7 +230,7 @@ class WorkInfo(object): salias='funder', multiple=True, default=[]), Field( DCNS('contributor.thanks'), 'thanks', required=False), - Field( DCNS('date'), 'created_at', as_date), + Field( DCNS('date'), 'created_at'), Field( DCNS('date.pd'), 'released_to_public_domain_at', as_date, required=False), Field( DCNS('publisher'), 'publisher'), @@ -241,6 +242,10 @@ class WorkInfo(object): Field( DCNS('identifier.url'), 'url', WLURI, strict=as_wluri_strict), Field( DCNS('rights.license'), 'license', required=False), Field( DCNS('rights'), 'license_description'), + + Field( PLMETNS('digitisationSponsor'), 'sponsors', multiple=True, default=[]), + Field( WLNS('digitisationSponsorNote'), 'sponsor_note', required=False), + Field( WLNS('developmentStage'), 'stage', required=False), ) @classmethod @@ -447,6 +452,9 @@ class BookInfo(WorkInfo): Field( DCNS('relation.coverImage.url'), 'cover_url', required=False), Field( DCNS('relation.coverImage.attribution'), 'cover_by', required=False), Field( DCNS('relation.coverImage.source'), 'cover_source', required=False), + # WLCover-specific. + Field( WLNS('coverBarColor'), 'cover_bar_color', required=False), + Field( WLNS('coverBoxPosition'), 'cover_box_position', required=False), )