예제 #1
0
    def create_manifest(self, imgfiles):
        """create manifest"""
        # to be set in sysargs or via imagemagick
        imageWidth = int(self.width)
        imageHeight = int(self.height)
        identifier = "test file import"

        # setup factory
        factory = ManifestFactory()
        factory.set_base_metadata_uri("http://www.example.org/metadata/")
        factory.set_base_image_uri("http://www.example.org/iiif/")
        factory.set_iiif_image_info(version="2.0", lvl="2")

        # setup manifest
        mf = factory.manifest(label="Manifest")
        mf.viewingHint = "paged"
        mf.set_metadata({
            "test label": "test value",
            "next label": "next value"
        })
        mf.attribution = "Provided by Bodleian Library, Oxford, using ManifestFactory code from the Houghton Library, Harvard University"
        mf.viewingHint = "paged"
        mf.description = "Description of Manuscript Goes Here"

        seq = mf.sequence()

        # loop through images in path
        for img in imgfiles:

            # get path, full image name and extension
            imgPath, imgFullName = os.path.split(img)
            imgName, imgExt = os.path.splitext(imgFullName)

            # Mostly identity will come from incrementing number (f1r, f1v,...)
            # or the image's identity

            cvs = seq.canvas(ident="c%s" % imgName,
                             label="Canvas %s" % imgName)
            cvs.set_hw(imageWidth, imageHeight)
            anno = cvs.annotation()
            al = cvs.annotationList("foo")

            # for demo purposes adds choices
            img = factory.image(imgFullName, iiif=True)
            img2 = factory.image(imgName + 'b' + imgExt, iiif=True)
            chc = anno.choice(img, [img2])

        json = mf.toString(compact=False)

        # write to text file
        text_file = open(identifier.replace(" ", "") + ".json", "w")
        text_file.write(json)
        text_file.close()

        return json
def do_record(rec, rx, host, s, cxn, sequence, lastrec):
	deleted = rec.xpath('./o:header/@status', namespaces=ALLNS)
	if deleted:
		return
	format = rec.xpath('./o:metadata/odc:dc/dc:format/text()', namespaces=ALLNS)
	# Strip out non images
	skip = 0
	for f in format:
		if f.find('/') > -1 and (not f.startswith('image/') or f.endswith('/pdf')):
			skip = 1
			break
	if skip:
		return

	# request info to see if we're compound object (cpd)
	# if we are, then work backwards from current ID to find records for individual pages
	# Then reverse the order and call it a Manifest :)

	identifier = rec.xpath('./o:header/o:identifier/text()', namespaces=ALLNS)[0]
	idx = int(identifier[identifier.rfind('/')+1:])
	ajaxinfo = get_json('http://%s/utils/ajaxhelper/?action=1&CISOROOT=%s&CISOPTR=%s' % (host, s, idx))
	try:
		if not ajaxinfo['imageinfo'].has_key('type'):
			return
	except:
		print 'http://%s/utils/ajaxhelper/?action=1&CISOROOT=%s&CISOPTR=%s' % (host, s, idx)
		print ajaxinfo
		raise


	if ajaxinfo['imageinfo']['type'] == 'cpd':
		# Compound Object to process separately
		# Walk backwards through images until hit previous entry in OAI list
		# make a folder...
		print "--- Compound Object: %s" % idx
		sys.stdout.flush()
		if os.path.exists('%s/%s/manifest.json' % (s,idx)):
			return

		try:
			os.mkdir("%s/%s" % (s, idx))
		except:
			pass
		os.chdir("%s/%s" % (s, idx))
		if rx == 0:
			# Need to check last record of previous chunk
			if lastrec:
				previd = lastrec.xpath('./o:header/o:identifier/text()', namespaces=ALLNS)[0]
				start_image = int(previd[previd.rfind('/')+1:])+1
			else:
				start_image = 1
		else:
			prev = recs[rx-1]
			previd = prev.xpath('./o:header/o:identifier/text()', namespaces=ALLNS)[0]
			start_image = int(previd[previd.rfind('/')+1:])+1

		pages = []
		for imgid in range(start_image, idx):
			pinfo = {'id': imgid}
			# get H/W from ajax
			iajax = get_json('http://%s/utils/ajaxhelper/?action=1&CISOROOT=%s&CISOPTR=%s' % (host, s, imgid))
			if not iajax['imageinfo'].has_key('height'):
				continue
			pinfo['h'] = iajax['imageinfo']['height']
			pinfo['w'] = iajax['imageinfo']['width']
			if (int(pinfo['h']) == 0 or int(pinfo['w']) == 0):
				continue
			try:
				pinfo['title'] = iajax['imageinfo']['title']['0']
			except:
				pinfo['title'] = "Image %s" % imgid
			cxn.put("%s::%s::%s" % (host, s, imgid), "%s,%s" % (pinfo['w'], pinfo['h']))
			pages.append(pinfo)

		if not pages:
			# back to host directory
			os.chdir('../..')
			return
		title = rec.xpath('./o:metadata/odc:dc/dc:title/text()', namespaces=ALLNS)
		creator = rec.xpath('./o:metadata/odc:dc/dc:creator/text()', namespaces=ALLNS)
		date = rec.xpath('./o:metadata/odc:dc/dc:date/text()', namespaces=ALLNS)
		description = rec.xpath('./o:metadata/odc:dc/dc:description/text()', namespaces=ALLNS)
		language = rec.xpath('./o:metadata/odc:dc/dc:language/text()', namespaces=ALLNS)

		# reinstantiate factory for subdir. not great but ...

		cfac = ManifestFactory()
		cfac.set_base_metadata_uri(BASE_MD_URL + "/%s/%s/%s/" % (host, s, idx))
		cfac.set_base_image_uri(BASE_IMG_URL + "/%s/%s/" % (host, s))
		cfac.set_base_metadata_dir(os.getcwd())
		cfac.set_iiif_image_info("2.0", "1")
		fac.set_debug('error')


		cmanifest = cfac.manifest(label=title[0])

		try:
			cmanifest.set_metadata({"Creator": creator[0]})
		except:
			pass
		try:
			cmanifest.set_metadata({"Date": date[0]})
		except:
			pass
		try:
			cmanifest.set_metadata({"Language": language[0]})
		except:
			pass
		try:
			cmanifest.description = description[0]
		except:
			pass
		cmanifest.viewingHint = "paged"
		cseq = cmanifest.sequence()
		for p in pages:
			cvs = cseq.canvas(ident="p%s" % p['id'], label=p['title'])
			cvs.set_hw(int(p['h']), int(p['w']))
			anno = cvs.annotation()
			img = anno.image(str(p['id']), iiif=True)
			img.height = p['h']
			img.width = p['w']

		try:
			cmanifest.toFile(compact=False)
		except:
			print "FAILED TO WRITE %s/%s/manifest.json" % (s, idx)
		# back to host directory
		os.chdir('../..')
	else:
		# We're just a collection of images

		h = ajaxinfo['imageinfo']['height']
		w = ajaxinfo['imageinfo']['width']
		if int(h) == 0 or int(w) == 0:
			return
		ttl = ajaxinfo['imageinfo']['title']['0']
		cxn.put("%s::%s::%s" % (host, s, idx), "%s,%s" % (w, h))

		cvs = sequence.canvas(ident="p%s" % idx, label=ttl)
		cvs.set_hw(int(h), int(w))
		anno = cvs.annotation()
		img = anno.image(str(idx), iiif=True)
		img.height = h
		img.width = w
예제 #3
0
    return txt
    


# -----------------------------------------------------------------------------

imageDirectory = "/Users/azaroth/Dropbox/SharedCanvasData/m804/images/"
jsDirectory = "/Users/azaroth/Dropbox/SharedCanvasData/m804/js/"
# resDirectory = "/Users/azaroth/Dropbox/SharedCanvas/impl/demo1d/res_random/"
resDirectory = "/Users/azaroth/Dropbox/IIIF/demos/mirador/data/"
minFolio= 1
maxFolio = 258


fac = ManifestFactory()
fac.set_base_metadata_uri("http://www.shared-canvas.org/impl/demo1d/res_human/")
fac.set_base_image_uri("http://www.shared-canvas.org/iiif/")
fac.set_base_metdata_dir("/Users/azaroth/Dropbox/SharedCanvas/impl/demo1d/res_human/")
fac.set_iiif_image_conformance(1.1, 2)
fac.set_debug("error") # warn will warn for recommendations, by default

rubricCss = ".red {color: red}"
initialCss = ".bold {font-weight: bold}"

mf = fac.manifest(ident="manifest", label="Pierpont Morgan MS.804")
mf.set_metadata({"Dates": "Author's version circa 1380, scribed circa 1400, illuminations circa 1420"})
mf.attribution = "Held at the Pierpont Morgan Library"
mf.viewingHint = "paged"
mf.viewingDirection = "left-to-right"

seq = mf.sequence(ident="normal", label="Normal Order")
from bottle import Bottle, route, run, request, response, abort, error

import os, sys
import factory
from lxml import etree

import uuid
import urllib, urllib2, urlparse

from factory import ManifestFactory

fac = ManifestFactory()
fac.set_base_image_uri("http://showcase.iiif.io/shims/veridian/image")
fac.set_iiif_image_info(version="2.0", lvl="1")
fac.set_base_metadata_dir('/tmp/')
fac.set_base_metadata_uri("http://showcase.iiif.io/shims/veridian/prezi/")
fac.set_debug('error')

PFX = ""
INFO_CACHE = {}
CACHEDIR = '/tmp/'
VSERVER = "http://cdnc.ucr.edu/cgi-bin/cdnc"


class ManifestShim(object):
    def __init__(self):
        pass

    def fetch(self, url, format="json"):

        try:
예제 #5
0
from bottle import Bottle, route, run, request, response, abort, error

import os, sys
import factory
from lxml import etree

import uuid
import urllib, urllib2, urlparse

from factory import ManifestFactory

fac = ManifestFactory()
fac.set_base_image_uri("http://iiif-dev.localhost/services/chronam/")
fac.set_iiif_image_info(version="2.0", lvl="1")
fac.set_base_metadata_dir('/Users/azaroth/Dropbox/Rob/Web/iiif-dev/prezi/chronam/')
fac.set_base_metadata_uri("http://localhost:8080/")
# http://localhost:8080/list/lccn/sn99021999/1915-03-27/ed-1/seq-1.json
fac.set_debug('error')

PFX = ""
INFO_CACHE = {}
CACHEDIR = '/Users/azaroth/Dropbox/Rob/Web/iiif-dev/prezi/chronam/'

class ChronAmManifestShim(object):

    def __init__(self):
        pass

    def fetch(self, url, format="json"):

        try:
예제 #6
0
imageHeight = 1800

imageUris = [BASEURL + "resources/page1-full.png", BASEURL + "resources/page2-full.png"]
textUris = [BASEURL + "resources/page1.txt", BASEURL + "resources/page2.txt"]
htmlUris = [BASEURL + "resources/page1.html", BASEURL + "resources/page2.html"]
transcriptions = [ 
	["Top of First Page to Display", "Middle of First Page on Angle", "Bottom of First Page to Display"],
	["Top of Second Page to Display", "Middle of Second Page on Angle", "Bottom of Second Page on Angle"]
]

line1Dims = "225,70,750,150"


# Configure the factory
fac = ManifestFactory()
fac.set_base_metadata_uri(BASEURL)
fac.set_base_metadata_dir(HOMEDIR)
fac.set_base_image_uri(IMAGE_BASEURL)
fac.set_iiif_image_info(2.0, 1)
fac.set_debug('error')

testInfo = {

# Done
1 : {"title": "Minimum Required Fields"},
2 : {"title": "Metadata Pairs", 'mfprops': [('metadata',{'date': 'some date'})]},
3 : {"title": "Metadata Pairs with Languages", 'mfprops': [('metadata', {'date': {'en':'some data','fr':'quelquetemps'}})]},
4 : {"title": "Metadata Pairs with Multiple Values in same Language", 'mfprops':[('metadata',{'date': ['some date', 'some other date']})]},
5 : {"title": "Description field", 'mfprops': [('description',"This is a description")]},
6 : {"title": "Multiple Descriptions", 'mfprops': [('description',["This is one description", {"en":"This is another"}])]},
7 : {"title": "Rights Metadata", 'mfprops': [('attribution', "Owning Institution"), ('license','http://creativecommons.org/licenses/by-nc/3.0/')]},
예제 #7
0
    txt = abre.sub('\\1', txt)
    txt = jre.sub('\\1', txt)
    return txt


# -----------------------------------------------------------------------------

imageDirectory = "/Users/azaroth/Dropbox/SharedCanvasData/m804/images/"
jsDirectory = "/Users/azaroth/Dropbox/SharedCanvasData/m804/js/"
# resDirectory = "/Users/azaroth/Dropbox/SharedCanvas/impl/demo1d/res_random/"
resDirectory = "/Users/azaroth/Dropbox/IIIF/demos/mirador/data/"
minFolio = 1
maxFolio = 258

fac = ManifestFactory()
fac.set_base_metadata_uri(
    "http://www.shared-canvas.org/impl/demo1d/res_human/")
fac.set_base_image_uri("http://www.shared-canvas.org/iiif/")
fac.set_base_metdata_dir(
    "/Users/azaroth/Dropbox/SharedCanvas/impl/demo1d/res_human/")
fac.set_iiif_image_conformance(1.1, 2)
fac.set_debug("error")  # warn will warn for recommendations, by default

rubricCss = ".red {color: red}"
initialCss = ".bold {font-weight: bold}"

mf = fac.manifest(ident="manifest", label="Pierpont Morgan MS.804")
mf.set_metadata({
    "Dates":
    "Author's version circa 1380, scribed circa 1400, illuminations circa 1420"
})
mf.attribution = "Held at the Pierpont Morgan Library"
# Extract image info
images = dom.xpath(
    '/mets:mets/mets:fileSec/mets:fileGrp/mets:file[@MIMETYPE="image/jp2"]',
    namespaces=ALLNS)
struct = dom.xpath(
    '/mets:mets/mets:structMap/mets:div[@TYPE="CITATION"]/mets:div',
    namespaces=ALLNS)
imageHash = {}
for img in images:
    imageHash[img.xpath('./@ID', namespaces=ALLNS)[0]] = img.xpath(
        './mets:FLocat/@xlink:href', namespaces=ALLNS)[0]

# Configure the factory
fac = ManifestFactory()
fac.set_base_metadata_uri("http://ids.lib.harvard.edu/iiif/metadata/")
fac.set_base_image_uri("http://ids.lib.harvard.edu/ids/view/" + identifier +
                       '/')
fac.set_iiif_image_conformance(1.1, 1)

# Build the Manifest
mf = fac.manifest(ident="manifest", label=mflabel)
mf.attribution = "Provided by the Houghton Library, Harvard University"
mf.viewingHint = "paged" if manifestType == "PAGEDOBJECT" else "individuals"
mf.description = "Description of Manuscript MS Richardson 44 Goes Here"

# And walk through the pages
seq = mf.sequence(ident="normal", label="Normal Order")
for st in struct:
    # Find label, and image ID
    label = st.xpath('./@LABEL')[0]
예제 #9
0
	"oai":"http://www.openarchives.org/OAI/2.0/",
	"rdf":"http://www.w3.org/1999/02/22-rdf-syntax-ns#",
	"oai_dc":"http://www.openarchives.org/OAI/2.0/oai_dc/",
	"xsi":"http://www.w3.org/2001/XMLSchema-instance",
	"mix":"http://www.loc.gov/mix/v20",
	"xlink":"http://www.w3.org/1999/xlink", 
	"mods":"http://www.loc.gov/mods/v3",
	"rights":"http://cosimo.stanford.edu/sdr/metsrights/"}

from factory import ManifestFactory

fac = ManifestFactory()
fac.set_base_image_uri("http://dams.llgc.org.uk/iiif/image/")
fac.set_iiif_image_info(version="1.1", lvl="1")
fac.set_base_metadata_dir('/path/to/data')
fac.set_base_metadata_uri("http://showcase.iiif.io/shims/wales/potter/")
fac.set_debug('error')


def xpath(dom, path):
	return dom.xpath(path, namespaces=namespaces)

def fetch(url, type="XML", retry=0):

	# Don't cache here, only the results
	fh = urllib.urlopen(url)
	data = fh.read()
	fh.close()
	if type == "XML":
		try:
			data = etree.XML(data)
    for (k, v) in queries.items():
        thing[k] = []
        q2 = qt % (k, uri, v)
        sparql.setQuery(q2)
        results2 = sparql.query().convert()
        for r2 in results2["results"]["bindings"]:
            thing[k].append(r2[k]["value"])

    # And now make the Manifest
    objid = os.path.split(uri)[-1]
    try:
        os.mkdir(basedir + "/" + objid)
    except:
        pass  # already exists
    fac.set_base_metadata_uri(basemd + objid)
    fac.set_base_metadata_dir(basedir + "/" + objid)

    mfst = fac.manifest()
    # Most British Museum objects don't have titles
    lbl = thing.get("title")
    # Maybe there's some with more than one?
    if len(lbl) > 1:
        mfst.label = lbl
    elif len(lbl):
        mfst.label = lbl[0]
    else:
        mfst.label = thing.get("typeLabel", [""])[0]

    desc = thing.get("desc")
    if len(desc) > 1:
예제 #11
0
fields = []
for l in lines:
    row = {}
    cells = l.split('\t')
    for r in range(len(cells)):
        row[r] = cells[r]
    fields.append(row)

fields = fields[1:]


resDirectory = "/Users/azaroth/Dropbox/IIIF/demos/mirador/data/vhmml/"

fac = ManifestFactory()
fac.set_base_metadata_uri("http://localhost/demos/mirador/data/vhmml/")
fac.set_base_image_uri("http://localhost/services/image/iiif2/")
fac.set_debug("error") # warn will warn for recommendations, by default

mf = fac.manifest(label=fields[0][0])
mf.set_metadata({"Date": fields[0][6], "City": fields[0][19],
                    "Library": fields[0][20], "Country of Origin": fields[0][21],
                    "Genre": fields[0][22], "Total Folios": fields[0][28]})

mf.attribution = fields[0][14] + "\n" + fields[0][18]
mf.viewingHint = "paged"
mf.viewingDirection = "left-to-right"

seq = mf.sequence(ident="normal", label="Normal Order")

imageHeight = 1239
예제 #12
0
import os, sys
import factory
from lxml import etree

import uuid
import urllib, urllib2, urlparse

from factory import ManifestFactory

fac = ManifestFactory()
fac.set_base_image_uri("http://iiif-dev.localhost/services/chronam/")
fac.set_iiif_image_info(version="2.0", lvl="1")
fac.set_base_metadata_dir(
    '/Users/azaroth/Dropbox/Rob/Web/iiif-dev/prezi/chronam/')
fac.set_base_metadata_uri("http://localhost:8080/")
# http://localhost:8080/list/lccn/sn99021999/1915-03-27/ed-1/seq-1.json
fac.set_debug('error')

PFX = ""
INFO_CACHE = {}
CACHEDIR = '/Users/azaroth/Dropbox/Rob/Web/iiif-dev/prezi/chronam/'


class ChronAmManifestShim(object):
    def __init__(self):
        pass

    def fetch(self, url, format="json"):

        try:
예제 #13
0
from bottle import Bottle, route, run, request, response, abort, error

import os, sys
import factory
from lxml import etree

import uuid
import urllib, urllib2, urlparse

from factory import ManifestFactory

fac = ManifestFactory()
fac.set_base_image_uri("http://showcase.iiif.io/shims/veridian/image")
fac.set_iiif_image_info(version="2.0", lvl="1")
fac.set_base_metadata_dir('/tmp/')
fac.set_base_metadata_uri("http://showcase.iiif.io/shims/veridian/prezi/")
fac.set_debug('error')

PFX = ""
INFO_CACHE = {}
CACHEDIR = '/tmp/'
VSERVER = "http://cdnc.ucr.edu/cgi-bin/cdnc"


class ManifestShim(object):

    def __init__(self):
        pass

    def fetch(self, url, format="json"):
예제 #14
0
def do_record(rec, rx, host, s, cxn, sequence, lastrec):
    deleted = rec.xpath('./o:header/@status', namespaces=ALLNS)
    if deleted:
        return
    format = rec.xpath('./o:metadata/odc:dc/dc:format/text()',
                       namespaces=ALLNS)
    # Strip out non images
    skip = 0
    for f in format:
        if f.find('/') > -1 and (not f.startswith('image/')
                                 or f.endswith('/pdf')):
            skip = 1
            break
    if skip:
        return

    # request info to see if we're compound object (cpd)
    # if we are, then work backwards from current ID to find records for individual pages
    # Then reverse the order and call it a Manifest :)

    identifier = rec.xpath('./o:header/o:identifier/text()',
                           namespaces=ALLNS)[0]
    idx = int(identifier[identifier.rfind('/') + 1:])
    ajaxinfo = get_json(
        'http://%s/utils/ajaxhelper/?action=1&CISOROOT=%s&CISOPTR=%s' %
        (host, s, idx))
    try:
        if not ajaxinfo['imageinfo'].has_key('type'):
            return
    except:
        print 'http://%s/utils/ajaxhelper/?action=1&CISOROOT=%s&CISOPTR=%s' % (
            host, s, idx)
        print ajaxinfo
        raise

    if ajaxinfo['imageinfo']['type'] == 'cpd':
        # Compound Object to process separately
        # Walk backwards through images until hit previous entry in OAI list
        # make a folder...
        print "--- Compound Object: %s" % idx
        sys.stdout.flush()
        if os.path.exists('%s/%s/manifest.json' % (s, idx)):
            return

        try:
            os.mkdir("%s/%s" % (s, idx))
        except:
            pass
        os.chdir("%s/%s" % (s, idx))
        if rx == 0:
            # Need to check last record of previous chunk
            if lastrec:
                previd = lastrec.xpath('./o:header/o:identifier/text()',
                                       namespaces=ALLNS)[0]
                start_image = int(previd[previd.rfind('/') + 1:]) + 1
            else:
                start_image = 1
        else:
            prev = recs[rx - 1]
            previd = prev.xpath('./o:header/o:identifier/text()',
                                namespaces=ALLNS)[0]
            start_image = int(previd[previd.rfind('/') + 1:]) + 1

        pages = []
        for imgid in range(start_image, idx):
            pinfo = {'id': imgid}
            # get H/W from ajax
            iajax = get_json(
                'http://%s/utils/ajaxhelper/?action=1&CISOROOT=%s&CISOPTR=%s' %
                (host, s, imgid))
            if not iajax['imageinfo'].has_key('height'):
                continue
            pinfo['h'] = iajax['imageinfo']['height']
            pinfo['w'] = iajax['imageinfo']['width']
            if (int(pinfo['h']) == 0 or int(pinfo['w']) == 0):
                continue
            try:
                pinfo['title'] = iajax['imageinfo']['title']['0']
            except:
                pinfo['title'] = "Image %s" % imgid
            cxn.put("%s::%s::%s" % (host, s, imgid),
                    "%s,%s" % (pinfo['w'], pinfo['h']))
            pages.append(pinfo)

        if not pages:
            # back to host directory
            os.chdir('../..')
            return
        title = rec.xpath('./o:metadata/odc:dc/dc:title/text()',
                          namespaces=ALLNS)
        creator = rec.xpath('./o:metadata/odc:dc/dc:creator/text()',
                            namespaces=ALLNS)
        date = rec.xpath('./o:metadata/odc:dc/dc:date/text()',
                         namespaces=ALLNS)
        description = rec.xpath('./o:metadata/odc:dc/dc:description/text()',
                                namespaces=ALLNS)
        language = rec.xpath('./o:metadata/odc:dc/dc:language/text()',
                             namespaces=ALLNS)

        # reinstantiate factory for subdir. not great but ...

        cfac = ManifestFactory()
        cfac.set_base_metadata_uri(BASE_MD_URL + "/%s/%s/%s/" % (host, s, idx))
        cfac.set_base_image_uri(BASE_IMG_URL + "/%s/%s/" % (host, s))
        cfac.set_base_metadata_dir(os.getcwd())
        cfac.set_iiif_image_info("2.0", "1")
        fac.set_debug('error')

        cmanifest = cfac.manifest(label=title[0])

        try:
            cmanifest.set_metadata({"Creator": creator[0]})
        except:
            pass
        try:
            cmanifest.set_metadata({"Date": date[0]})
        except:
            pass
        try:
            cmanifest.set_metadata({"Language": language[0]})
        except:
            pass
        try:
            cmanifest.description = description[0]
        except:
            pass
        cmanifest.viewingHint = "paged"
        cseq = cmanifest.sequence()
        for p in pages:
            cvs = cseq.canvas(ident="p%s" % p['id'], label=p['title'])
            cvs.set_hw(int(p['h']), int(p['w']))
            anno = cvs.annotation()
            img = anno.image(str(p['id']), iiif=True)
            img.height = p['h']
            img.width = p['w']

        try:
            cmanifest.toFile(compact=False)
        except:
            print "FAILED TO WRITE %s/%s/manifest.json" % (s, idx)
        # back to host directory
        os.chdir('../..')
    else:
        # We're just a collection of images

        h = ajaxinfo['imageinfo']['height']
        w = ajaxinfo['imageinfo']['width']
        if int(h) == 0 or int(w) == 0:
            return
        ttl = ajaxinfo['imageinfo']['title']['0']
        cxn.put("%s::%s::%s" % (host, s, idx), "%s,%s" % (w, h))

        cvs = sequence.canvas(ident="p%s" % idx, label=ttl)
        cvs.set_hw(int(h), int(w))
        anno = cvs.annotation()
        img = anno.image(str(idx), iiif=True)
        img.height = h
        img.width = w
예제 #15
0
        if SETS_TO_DO and not s in SETS_TO_DO:
            print "skipping %s / %s" % (s, sinfo['name'])
            continue

        try:
            print "Processing Set: %s" % sinfo['name']
        except:
            print "Processing Set: %s" % s
        sys.stdout.flush()
        if os.path.exists(s):
            continue
        os.mkdir(s)

        fac = ManifestFactory()
        fac.set_base_metadata_uri(BASE_MD_URL + "/%s/%s/" % (host, s))
        fac.set_base_metadata_dir(os.path.join(os.getcwd(), s))
        fac.set_base_image_uri(BASE_IMG_URL + "/%s/%s/" % (host, s))
        fac.set_iiif_image_info("2.0", "1")
        fac.set_debug('error')

        manifest = fac.manifest(label=sinfo['name'])
        if sinfo['desc']:
            manifest.description = str(sinfo['desc'])
        manifest.attribution = "Converted from http://%s/" % host
        manifest.viewingHint = "individuals"

        sequence = manifest.sequence()
        dom = get_xml(
            'http://%s/oai/oai.php?verb=ListRecords&set=%s&metadataPrefix=oai_dc'
            % (host, s))
예제 #16
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

from factory import ManifestFactory
from lxml import etree
import os

fh = file('web-view.html')
html = fh.read()
fh.close()
dom = etree.HTML(html)
subs = dom.xpath('//div[@class="related-records"]/dl[@class="return-art"]')

fac = ManifestFactory()
fac.set_base_metadata_uri("http://vm-imgrepo-tdp.nga.gov/public/manifests/")
fac.set_base_image_uri("http://vm-imgrepo-tdp.nga.gov/public/objects/")
fac.set_base_metadata_dir("/mnt/images/public/manifests")
fac.set_iiif_image_info(2.0, 2)
fac.set_debug("error") # warn will warn for recommendations, by default

label = "Cézanne Sketchbook"
mdhash = {"Dates": "c. 1877/1900", "Creator": "Cézanne, Paul (1839-1906)"}
mdhash["Inscription"] = "Various notations overall"
mdhash["Provenance"] = """
<div>Paul Cézanne (the artist's son), Paris;
<br/>Paul Guillaume, Paris;
<br/>Adrien Chappuis, Tresserve, Switzerland, 1933;
<br/>Paul Mellon, Upperville, VA, 1967;
<br/>gift to NGA, 1991
</div>"""
예제 #17
0
import urllib
import json

url = "https://commons.wikimedia.org/w/api.php?action=featuredfeed&feed=potd&feedformat=atom&language=en"

fh = urllib.urlopen(url)
data = fh.read()
fh.close()

nss = {'atom': 'http://www.w3.org/2005/Atom'}

dom = etree.XML(data)
subs = dom.xpath('//atom:summary[@type="html"]/text()', namespaces=nss)

fac = ManifestFactory()
fac.set_base_metadata_uri("http://iiif-dev.localhost/prezi/mw/")
fac.set_base_image_uri("http://dlss-dev-azaroth.stanford.edu/services/iiif/")
fac.set_base_metadata_dir("/Users/azaroth/Dropbox/Rob/Web/iiif-dev/prezi/mw")
fac.set_iiif_image_info(2.0, 2)
fac.set_debug("error")  # warn will warn for recommendations, by default

label = "Wikimedia Pictures of the Day"

mf = fac.manifest(ident="manifest", label=label)
mf.viewingHint = "individuals"
seq = mf.sequence(ident="normal", label="Normal Order")

c = 0
for s in subs:
    hdom = etree.HTML(s)
    for (k, v) in queries.items():
        thing[k] = []
        q2 = qt % (k, uri, v)
        sparql.setQuery(q2)
        results2 = sparql.query().convert()
        for r2 in results2['results']['bindings']:
            thing[k].append(r2[k]['value'])

    # And now make the Manifest
    objid = os.path.split(uri)[-1]
    try:
        os.mkdir(basedir + '/' + objid)
    except:
        pass  # already exists
    fac.set_base_metadata_uri(basemd + objid)
    fac.set_base_metadata_dir(basedir + '/' + objid)

    mfst = fac.manifest()
    # Most British Museum objects don't have titles
    lbl = thing.get('title')
    # Maybe there's some with more than one?
    if len(lbl) > 1:
        mfst.label = lbl
    elif len(lbl):
        mfst.label = lbl[0]
    else:
        mfst.label = thing.get('typeLabel', [''])[0]

    desc = thing.get('desc')
    if len(desc) > 1:
예제 #19
0
    def create_manifest(self):
        """create manifest"""
        # to be set in sysargs or via imagemagick
        imageWidth = int(self.width)
        imageHeight = int(self.height)
        identifier = "test"

        fh = file(self.path)
        data = fh.read()
        fh.close()
        dom = etree.XML(data)
        metsNS = 'http://www.loc.gov/METS/'
        modsNS = 'http://www.loc.gov/mods/v3'
        xlinkNS = 'http://www.w3.org/1999/xlink'
        ALLNS = {'mets': metsNS, 'mods': modsNS, 'xlink': xlinkNS}

        # Extract basic info
        identifier = dom.xpath(
            '/mets:mets/mets:dmdSec/mets:mdWrap[@MDTYPE="MODS"]/mets:xmlData/mods:mods/mods:recordInfo/mods:recordIdentifier/text()',
            namespaces=ALLNS)[0]
        mflabel = dom.xpath(
            '/mets:mets/mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="manuscript"]/@LABEL',
            namespaces=ALLNS)[0]
        manifestType = 'sc:Manifest'

        # Extract image info
        images = dom.xpath(
            '/mets:mets/mets:fileSec/mets:fileGrp/mets:file[@MIMETYPE="image/jpeg"]',
            namespaces=ALLNS)
        struct = dom.xpath(
            '/mets:mets/mets:structMap[@TYPE="PHYSICAL"]/mets:div[@TYPE="physSequence"]/mets:div',
            namespaces=ALLNS)

        imageHash = {}
        for img in images:
            imageHash[img.xpath('./@ID', namespaces=ALLNS)[0]] = img.xpath(
                './mets:FLocat/@xlink:href', namespaces=ALLNS)[0]

        # Configure the factory
        fac = ManifestFactory()
        fac.set_base_metadata_uri(self.baseimguri)
        fac.set_base_image_uri(self.basemetadatauri + identifier + '/')
        fac.set_iiif_image_conformance(1.1, 1)

        # Build the Manifest
        mf = fac.manifest(ident="manifest", label=mflabel)
        mf.attribution = "Provided by the Bodleian Library, Oxford University"
        mf.viewingHint = "paged" if manifestType == "PAGEDOBJECT" else "individuals"
        mf.description = "Description of Manuscript Goes Here"

        # And walk through the pages
        seq = mf.sequence(ident="normal", label="Normal Order")
        for st in struct:
            # Find label, and image ID
            label = st.xpath('./@ORDERLABEL', namespaces=ALLNS)[0]
            image = imageHash[st.xpath('./mets:fptr[1]/@FILEID',
                                       namespaces=ALLNS)[0]]

            # Build the Canvas
            cvs = seq.canvas(ident="c%s" % image, label=label)
            cvs.set_hw(imageHeight, imageWidth)

            # Build the Image Annotation
            anno = cvs.annotation(ident="a%s" % image)

            img = anno.image(ident="%s" % image, iiif=True)
            img.set_hw(imageHeight, imageWidth)

        # Serialize
        mfjs = mf.toJSON()
        srlzd = json.dumps(mfjs, sort_keys=True, indent=2)

        # write to textfile
        text_file = open(mflabel.replace(" ", "") + ".json", "w")
        text_file.write(srlzd)
        text_file.close()

        return srlzd
예제 #20
0
htmlUris = [BASEURL + "resources/page1.html", BASEURL + "resources/page2.html"]
transcriptions = [[
    "Top of First Page to Display", "Middle of First Page on Angle",
    "Bottom of First Page to Display"
],
                  [
                      "Top of Second Page to Display",
                      "Middle of Second Page on Angle",
                      "Bottom of Second Page on Angle"
                  ]]

line1Dims = "225,70,750,150"

# Configure the factory
fac = ManifestFactory()
fac.set_base_metadata_uri(BASEURL)
fac.set_base_metadata_dir(HOMEDIR)
fac.set_base_image_uri(IMAGE_BASEURL)
fac.set_iiif_image_info(2.0, 1)
fac.set_debug('error')

testInfo = {

    # Done
    1: {
        "title": "Minimum Required Fields"
    },
    2: {
        "title": "Metadata Pairs",
        'mfprops': [('metadata', {
            'date': 'some date'
예제 #21
0
import os, sys
import urllib
import json
from factory import ManifestFactory

baseq = "http://www.vam.ac.uk/api/json/museumobject/search?images=1&"
baseo = "http://www.vam.ac.uk/api/json/museumobject/" # + O 123456
baseimg = "http://media.vam.ac.uk/media/thira/collection_images/" # + pid[:6] + / + pid .jpg
destdir = "/path/to/images/vam"

fac = ManifestFactory()
fac.set_base_image_uri("http://localhost/iiif")
fac.set_iiif_image_info(version="2.0")
basemd = "http://localhost/prezi/vam/"
basedir = "/path/to/htdocs/prezi/vam/" 
fac.set_base_metadata_uri(basemd)
fac.set_base_metadata_dir(basedir)

# before=date&after=date&q=term
# offset=n

q1 = baseq + "before=1200&after=1100&q=manuscript"
# 126 objects


def fetch(q, offset=0):
	if offset:
		q += "&offset=%s" % offset
	fh = urllib.urlopen(q)
	data = fh.read()
	fh.close()
# Extract basic info
identifier = dom.xpath('/mets:mets/mets:dmdSec/mets:mdWrap[@MDTYPE="MODS"]/mets:xmlData/mods:mods/mods:identifier/text()', namespaces=ALLNS)[0]
mflabel = dom.xpath('/mets:mets/@LABEL', namespaces=ALLNS)[0]
manifestType = dom.xpath('/mets:mets/@TYPE', namespaces=ALLNS)[0]

# Extract image info
images = dom.xpath('/mets:mets/mets:fileSec/mets:fileGrp/mets:file[@MIMETYPE="image/jp2"]', namespaces=ALLNS)
struct = dom.xpath('/mets:mets/mets:structMap/mets:div[@TYPE="CITATION"]/mets:div', namespaces=ALLNS)
imageHash = {}
for img in images:
	imageHash[img.xpath('./@ID', namespaces=ALLNS)[0]] = img.xpath('./mets:FLocat/@xlink:href', namespaces = ALLNS)[0]


# Configure the factory
fac = ManifestFactory()
fac.set_base_metadata_uri("http://ids.lib.harvard.edu/iiif/metadata/")
fac.set_base_image_uri("http://ids.lib.harvard.edu/ids/view/" + identifier + '/')
fac.set_iiif_image_conformance(1.1, 1)

# Build the Manifest
mf = fac.manifest(ident="manifest", label=mflabel)
mf.attribution = "Provided by the Houghton Library, Harvard University"
mf.viewingHint = "paged" if manifestType == "PAGEDOBJECT" else "individuals"
mf.description = "Description of Manuscript MS Richardson 44 Goes Here"

# And walk through the pages
seq = mf.sequence(ident="normal", label="Normal Order")
for st in struct:
	# Find label, and image ID
	label = st.xpath('./@LABEL')[0] 
	image = imageHash[st.xpath('./mets:div/mets:fptr[2]/@FILEID', namespaces=ALLNS)[0]]
예제 #23
0
#!/usr/bin/env python
# -*- coding: Windows-1252 -*-
import sys
from factory import ManifestFactory

msref = "add_ms_10289"

fac = ManifestFactory()
fac.set_base_metadata_uri("http://sanddragon.bl.uk/IIIFMetadataService/")
fac.set_base_image_uri("http://sanddragon.bl.uk/IIIFImageService/")

fac.set_iiif_image_conformance(1.1, 2)  # Version, ComplianceLevel
fac.set_debug("warn")  # 'error' will turn off warnings

manifest = fac.manifest(ident="add_ms_10289", label="Add MS 10289")

mddate = u'1275 - 1300'.encode('utf-8')
mdtitle = "Li Romanz du Mont Saint-Michel, a miscellany of romances, moralistic and religious texts and medical recipes"
mdlocation = "British Library"
mdcontents = u"Contents:   ff. 1r-64r: Guillaume de Saint Pair or Guillelme de Seint Paier, Li romanz du Mont Saint Michel or Roman de Mont Saint Michel, incipit, 'Molz pelerins qui vunt al munt', explicit, 'Longue de corne ou il est mis'.  ff. 64r-81v: Andreu de Costances, Une estoire de la resurrection de Jesu Crist, or Verse Gospel of Nicodemus in verse, incipit, 'Seignors mestre Andreu de costances..', explicit, 'Les boens mist hors lessa les maux';  f. 81v: Recipe for a lotion to whiten the skin, incipit, 'Ogneme[n]t espue por blanchir';  ff. 82r-121r: Roman de la destruction de Jerusalem or Le livre de Titus ou de Vespasian, a chanson de geste, incipit, 'Seignors or entende chevalier seriant', explicit, 'nel doit len pas mescroire';  ff. 122r-129r: Medical recipes or Secrets de medecine, incipit 'A la dolor deu chief polieul cuit..', explicit, 'tant q[ue] il sue cest ce qui plus vaut'.  f. 129v: De saint Nicaise, in Latin, incipit 'Sanctus Nichasius habuit mac[u]lam in oculo';  ff. 129v-132v: André or Andreu de Costances: Le romanz des Franceis or Arflet, incipit, 'Reis arflet de nohundrelande', explicit, 'Q[ue]r p[ar]tot dit veir cest la fin.';  f. 132v: List of twelve pairs of France, incipit, 'Dux burgondie';  ff. 133r-172r: Petrus Alphonsus: Fables, a French translation of the Disciplina Clericalis entitled Chatoiment d'un pere a son fils, incipit, 'Qui veut henor eu siecle aveir', explicit, 'Garni le tienge en son vivant';  ff. 172r-175r: Robert de Blois, Compendium Amoris, extracts from Chastoiement des Dames, incipit,'[M]einte gent parolent damors', explicit, 'lor veut dex li dont honte ame';  ff. 175v-178v: Colin Malet: Fabliau de Juglet or Jouglet, incipit, 'Jadis en coste mon ferrant', explicit, 'Q[ue] assez miez [con]chie lui'.  Decoration:   A historiated initial in colours with frame in red of two pilgrims with staffs (f. 1r). An ink drawing in brown of the church of Mont Saint Michel burning with flames in red (f. 45v). Two puzzle initials in red and blue with penwork decoration (ff. 82r,133r). Initials in blue with penwork decoration in red or in red with penwork decoration in blue at the beginning of chapters. Small initials in blue or red at the beginning of lines, some with pen-flourishing in blue; line fillers in red or blue (ff. 1r-64v). Paraphs in red or blue. Rubrics in red."
mdlanguages = "Old French, Anglo-Norman, Latin"
mdphysical = "Materials: Parchment. Dimensions: 190 x 135mm (written space: 145 x 75/110mm). Foliation: ff. 179 (f. 179 is a parchment flyleaf fragment + 4 unfoliated paper flyleaves at the beginning and at the end). Script: Gothic, written above the top line. Layout: Parts written in two columns. Binding: BM/BL in-house. Rebound in 1959."
mdownership = u"Origin: France, N.W. (Normandy). Provenance: The abbey of Mont Saint-Michel, dated ?1280: inscribed 'anno octog[esimo]', (f. 64r); a 15th-century ownership inscription, 'Iste liber est de thesauraria montis' is in the outer margin of f. 1r. Jaques Cujas, humanist scholar and legal expert (b. 1529, d. 1590), perhaps taken by him, as authorised by Nicolas le Fevre on behalf of Louis XIII, from the abbey library in c.1582 (see Genevieve Nortier, Les bibliotheques médiévales des abbayes bénédictines de Normandie (Caen: Caron et cie, 1966), p. 151); his books were dispersed at his death and this manuscript may have returned to the abbey then.In the 1739 catalogue of the abbey of Mont Saint Michel: see Bernard de Montfaucon, Bibliotheca bibliothecarum manuscriptorum nova, 2 vols (1739), II, p. 1360), no. 216: 'Histoire du Mont St Michel en vers, faite du temps de l'Abbé Robert de Torigny' (r. 1154-1186). In 1799 the manuscripts of the abbey library were moved to Avranches, but a number were lost. The present manuscript was removed from the collection between 1799 and 1835, when the first inventory was made in Avranches.Richard Heber, landowner and book collector (b.1773, d. 1833), probably bought by him in Europe in the early 18th century; his sale, 20 February 1836, lot 1702; purchased by the British Museum."
mdbibliography = u"Catalogue of Additions to the Manuscripts in the British Museum in the Years 1836-1846 (London: British Museum, 1843), p. 27. H. L. D. Ward and J. A. Herbert, Catalogue of Romances in the Department of Manuscripts in the British Museum, 3 vols (London: British Museum, 1883-1910), I (1883), pp. 179-80, 812-13; II (1893), pp. 259-65. John Howard Fox, Robert de Blois, son oeuvre didactique et narrative. Étude linguistique et littéraire suivie d'une édition critique avec commentaire et glossaire de 'l'Enseignement des princes' et du 'Chastoiement des dames' (Paris: Nizet, 1950), [an edition of the text, ff. 172-175r]. Anthony J. Holden, 'Le Roman des Franceis' in Etudes de langue et de littérature du moyen age: Offertes à Felix Lecoy (Paris: Honoré Champion, 1973), pp. 213-33 (p. 214). Félix Lecoy, 'À propos du Romanz des Franceis d'André de Coutances', Phonétique et linguistique romanes. Mélanges offerts à M. Georges Straka, Revue de linguistique romane, 34, (1970), pp. 123-25. R. Graham Birrell, 'Regional vocabulary in Le Roman du Mont Saint-Michel', Romania, 100 (1979), 260-70 (p. 261). Willem Noomen, 'Auteur, narrateur, récitant de fabliaux, le témoignage des prologues et des épilogues', Cahiers de civilisation médiévale, 35 (1992), 313-50 (pp. 321-22). Ruth Dean and Maureen Bolton, Anglo-Norman Literature, A Guide to Texts and Manuscripts (London: Anglo-Norman Text Society, 1999), nos. 220.1, 501r. Le Jongleur par lui-meme: Choix de dits et de fabliaux, ed. by Willem Noomen (Louvain: Peeters, 2003), pp. 276-311 [includes an edition of the text on ff. 175-178]. Lydie Lansard, 'De l'Évangile de Nicodème au Roman de la Résurrection d'André de Coutances', Apocrypha, 16, (2005), pp. 229-51. Le Roman du Mont Saint-Michel (xiie siècle), ed. by Catherine Bougy, Les manuscrits de Mont Saint Michel, Textes fondateurs, 2 vols (Avranches: Presses Universitaires de Caen, 2009), II, pp. 43-45, pl. I-IV, VI-IX, XI,XII [contains a description and edition of ff. 1-64], online at http://www.unicaen.fr/services/puc/sources/gsp/index.php?page=sommaire [accessed 05.11.2013]. Lydie Lansard and Laurent Brun, 'London, British Library Additional 10289', Arlima, Archives de littérature du Moyen Age (University of Ottawa, 2010) at http://www.arlima.net/mss/united_kingdom/london/british_library/additional/010289.html [accessed 15.11.2013]."

manifest.set_metadata({
    "Date": mddate,
    "Title": mdtitle,
    "Location": mdlocation,
    "Contents": mdcontents,
    "Languages": mdlanguages,
from factory import ManifestFactory
import os

# Example script to build a manifest out of all the images in a directory

destdir = "/path/to/images"

fac = ManifestFactory()
fac.set_debug("error")
fac.set_base_image_uri("http://localhost/iiif")
fac.set_base_image_dir(destdir)
fac.set_iiif_image_info()
fac.set_base_metadata_uri("http://localhost/prezi/")
fac.set_base_metadata_dir("/path/to/prezi/")

mflbl = os.path.split(destdir)[1].replace("_", " ").title()

mfst = fac.manifest(label=mflbl)
seq = mfst.sequence()
for fn in os.listdir(destdir):
	ident = fn[:-4]
	title = ident.replace("_", " ").title()
	cvs = seq.canvas(ident=ident, label=title)
	cvs.add_image_annotation(ident, True)

mfst.toFile(compact=False)
예제 #25
0
import urllib
import json

url = "https://commons.wikimedia.org/w/api.php?action=featuredfeed&feed=potd&feedformat=atom&language=en"

fh = urllib.urlopen(url)
data = fh.read()
fh.close()

nss = {"atom": "http://www.w3.org/2005/Atom"}

dom = etree.XML(data)
subs = dom.xpath('//atom:summary[@type="html"]/text()', namespaces=nss)

fac = ManifestFactory()
fac.set_base_metadata_uri("http://iiif-dev.localhost/prezi/mw/")
fac.set_base_image_uri("http://dlss-dev-azaroth.stanford.edu/services/iiif/")
fac.set_base_metadata_dir("/Users/azaroth/Dropbox/Rob/Web/iiif-dev/prezi/mw")
fac.set_iiif_image_info(2.0, 2)
fac.set_debug("error")  # warn will warn for recommendations, by default

label = "Wikimedia Pictures of the Day"

mf = fac.manifest(ident="manifest", label=label)
mf.viewingHint = "individuals"
seq = mf.sequence(ident="normal", label="Normal Order")


c = 0
for s in subs:
    hdom = etree.HTML(s)
예제 #26
0
#!/usr/bin/env python
# -*- coding: Windows-1252 -*- 
import sys 
from factory import ManifestFactory

msref = "add_ms_10289"

fac = ManifestFactory()
fac.set_base_metadata_uri("http://sanddragon.bl.uk/IIIFMetadataService/")
fac.set_base_image_uri("http://sanddragon.bl.uk/IIIFImageService/")

fac.set_iiif_image_conformance(1.1, 2) # Version, ComplianceLevel
fac.set_debug("warn") # 'error' will turn off warnings

manifest = fac.manifest(ident="add_ms_10289", label="Add MS 10289")

mddate = u'1275 - 1300'.encode('utf-8')
mdtitle = "Li Romanz du Mont Saint-Michel, a miscellany of romances, moralistic and religious texts and medical recipes"
mdlocation = "British Library"
mdcontents = u"Contents:   ff. 1r-64r: Guillaume de Saint Pair or Guillelme de Seint Paier, Li romanz du Mont Saint Michel or Roman de Mont Saint Michel, incipit, 'Molz pelerins qui vunt al munt', explicit, 'Longue de corne ou il est mis'.  ff. 64r-81v: Andreu de Costances, Une estoire de la resurrection de Jesu Crist, or Verse Gospel of Nicodemus in verse, incipit, 'Seignors mestre Andreu de costances..', explicit, 'Les boens mist hors lessa les maux';  f. 81v: Recipe for a lotion to whiten the skin, incipit, 'Ogneme[n]t espue por blanchir';  ff. 82r-121r: Roman de la destruction de Jerusalem or Le livre de Titus ou de Vespasian, a chanson de geste, incipit, 'Seignors or entende chevalier seriant', explicit, 'nel doit len pas mescroire';  ff. 122r-129r: Medical recipes or Secrets de medecine, incipit 'A la dolor deu chief polieul cuit..', explicit, 'tant q[ue] il sue cest ce qui plus vaut'.  f. 129v: De saint Nicaise, in Latin, incipit 'Sanctus Nichasius habuit mac[u]lam in oculo';  ff. 129v-132v: André or Andreu de Costances: Le romanz des Franceis or Arflet, incipit, 'Reis arflet de nohundrelande', explicit, 'Q[ue]r p[ar]tot dit veir cest la fin.';  f. 132v: List of twelve pairs of France, incipit, 'Dux burgondie';  ff. 133r-172r: Petrus Alphonsus: Fables, a French translation of the Disciplina Clericalis entitled Chatoiment d'un pere a son fils, incipit, 'Qui veut henor eu siecle aveir', explicit, 'Garni le tienge en son vivant';  ff. 172r-175r: Robert de Blois, Compendium Amoris, extracts from Chastoiement des Dames, incipit,'[M]einte gent parolent damors', explicit, 'lor veut dex li dont honte ame';  ff. 175v-178v: Colin Malet: Fabliau de Juglet or Jouglet, incipit, 'Jadis en coste mon ferrant', explicit, 'Q[ue] assez miez [con]chie lui'.  Decoration:   A historiated initial in colours with frame in red of two pilgrims with staffs (f. 1r). An ink drawing in brown of the church of Mont Saint Michel burning with flames in red (f. 45v). Two puzzle initials in red and blue with penwork decoration (ff. 82r,133r). Initials in blue with penwork decoration in red or in red with penwork decoration in blue at the beginning of chapters. Small initials in blue or red at the beginning of lines, some with pen-flourishing in blue; line fillers in red or blue (ff. 1r-64v). Paraphs in red or blue. Rubrics in red."
mdlanguages = "Old French, Anglo-Norman, Latin"
mdphysical = "Materials: Parchment. Dimensions: 190 x 135mm (written space: 145 x 75/110mm). Foliation: ff. 179 (f. 179 is a parchment flyleaf fragment + 4 unfoliated paper flyleaves at the beginning and at the end). Script: Gothic, written above the top line. Layout: Parts written in two columns. Binding: BM/BL in-house. Rebound in 1959."
mdownership = u"Origin: France, N.W. (Normandy). Provenance: The abbey of Mont Saint-Michel, dated ?1280: inscribed 'anno octog[esimo]', (f. 64r); a 15th-century ownership inscription, 'Iste liber est de thesauraria montis' is in the outer margin of f. 1r. Jaques Cujas, humanist scholar and legal expert (b. 1529, d. 1590), perhaps taken by him, as authorised by Nicolas le Fevre on behalf of Louis XIII, from the abbey library in c.1582 (see Genevieve Nortier, Les bibliotheques médiévales des abbayes bénédictines de Normandie (Caen: Caron et cie, 1966), p. 151); his books were dispersed at his death and this manuscript may have returned to the abbey then.In the 1739 catalogue of the abbey of Mont Saint Michel: see Bernard de Montfaucon, Bibliotheca bibliothecarum manuscriptorum nova, 2 vols (1739), II, p. 1360), no. 216: 'Histoire du Mont St Michel en vers, faite du temps de l'Abbé Robert de Torigny' (r. 1154-1186). In 1799 the manuscripts of the abbey library were moved to Avranches, but a number were lost. The present manuscript was removed from the collection between 1799 and 1835, when the first inventory was made in Avranches.Richard Heber, landowner and book collector (b.1773, d. 1833), probably bought by him in Europe in the early 18th century; his sale, 20 February 1836, lot 1702; purchased by the British Museum."
mdbibliography = u"Catalogue of Additions to the Manuscripts in the British Museum in the Years 1836-1846 (London: British Museum, 1843), p. 27. H. L. D. Ward and J. A. Herbert, Catalogue of Romances in the Department of Manuscripts in the British Museum, 3 vols (London: British Museum, 1883-1910), I (1883), pp. 179-80, 812-13; II (1893), pp. 259-65. John Howard Fox, Robert de Blois, son oeuvre didactique et narrative. Étude linguistique et littéraire suivie d'une édition critique avec commentaire et glossaire de 'l'Enseignement des princes' et du 'Chastoiement des dames' (Paris: Nizet, 1950), [an edition of the text, ff. 172-175r]. Anthony J. Holden, 'Le Roman des Franceis' in Etudes de langue et de littérature du moyen age: Offertes à Felix Lecoy (Paris: Honoré Champion, 1973), pp. 213-33 (p. 214). Félix Lecoy, 'À propos du Romanz des Franceis d'André de Coutances', Phonétique et linguistique romanes. Mélanges offerts à M. Georges Straka, Revue de linguistique romane, 34, (1970), pp. 123-25. R. Graham Birrell, 'Regional vocabulary in Le Roman du Mont Saint-Michel', Romania, 100 (1979), 260-70 (p. 261). Willem Noomen, 'Auteur, narrateur, récitant de fabliaux, le témoignage des prologues et des épilogues', Cahiers de civilisation médiévale, 35 (1992), 313-50 (pp. 321-22). Ruth Dean and Maureen Bolton, Anglo-Norman Literature, A Guide to Texts and Manuscripts (London: Anglo-Norman Text Society, 1999), nos. 220.1, 501r. Le Jongleur par lui-meme: Choix de dits et de fabliaux, ed. by Willem Noomen (Louvain: Peeters, 2003), pp. 276-311 [includes an edition of the text on ff. 175-178]. Lydie Lansard, 'De l'Évangile de Nicodème au Roman de la Résurrection d'André de Coutances', Apocrypha, 16, (2005), pp. 229-51. Le Roman du Mont Saint-Michel (xiie siècle), ed. by Catherine Bougy, Les manuscrits de Mont Saint Michel, Textes fondateurs, 2 vols (Avranches: Presses Universitaires de Caen, 2009), II, pp. 43-45, pl. I-IV, VI-IX, XI,XII [contains a description and edition of ff. 1-64], online at http://www.unicaen.fr/services/puc/sources/gsp/index.php?page=sommaire [accessed 05.11.2013]. Lydie Lansard and Laurent Brun, 'London, British Library Additional 10289', Arlima, Archives de littérature du Moyen Age (University of Ottawa, 2010) at http://www.arlima.net/mss/united_kingdom/london/british_library/additional/010289.html [accessed 15.11.2013]."

manifest.set_metadata({"Date": mddate, "Title": mdtitle, "Location": mdlocation,"Contents": mdcontents, "Languages": mdlanguages, "Physical Description": mdphysical, "Ownership": mdownership, "Bibliography": mdbibliography})
manifest.description = "Li Romanz du Mont Saint-Michel, a miscellany of romances, moralistic and religious texts and medical recipes"
manifest.viewingDirection = "left-to-right"

seq = manifest.sequence(ident="normal", label="Normal Order")
예제 #27
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

from factory import ManifestFactory
from lxml import etree
import os

fh = file('web-view.html')
html = fh.read()
fh.close()
dom = etree.HTML(html)
subs = dom.xpath('//div[@class="related-records"]/dl[@class="return-art"]')

fac = ManifestFactory()
fac.set_base_metadata_uri("http://vm-imgrepo-tdp.nga.gov/public/manifests/")
fac.set_base_image_uri("http://vm-imgrepo-tdp.nga.gov/public/objects/")
fac.set_base_metadata_dir("/mnt/images/public/manifests")
fac.set_iiif_image_info(2.0, 2)
fac.set_debug("error")  # warn will warn for recommendations, by default

label = "Cézanne Sketchbook"
mdhash = {"Dates": "c. 1877/1900", "Creator": "Cézanne, Paul (1839-1906)"}
mdhash["Inscription"] = "Various notations overall"
mdhash["Provenance"] = """
<div>Paul Cézanne (the artist's son), Paris;
<br/>Paul Guillaume, Paris;
<br/>Adrien Chappuis, Tresserve, Switzerland, 1933;
<br/>Paul Mellon, Upperville, VA, 1967;
<br/>gift to NGA, 1991
</div>"""
# BL Flickr TSV + JSON to IIIF Metadata
# Data available here: https://github.com/BL-Labs/imagedirectory

import sys, os, re
import glob
import ljson
from factory import ManifestFactory

fac = ManifestFactory()
fac.set_base_metadata_uri("https://github.com/BL-Labs/imagedirectory/iiif")
fac.set_base_metadata_dir('/Users/azaroth/Development/bl/imagedirectory/iiif')

fh = file('book_metadata.json')
data = fh.read()
fh.close()
books = ljson.loads(data)

# volume / Publisher / Title / Author / ? / pub place / book id / book ARK / flickr_url / 
#          image_idx / page / flickr_id / f_small / f_s_height / f_s_width / medium / large / original


# Can be images from the same book in multiple TSV files, as based on image size so build in parallel and sort
manifests = {}

files = glob.glob("*.tsv")
files.sort()
for f in files:
	fh = file(f)
	data = fh.read()
	fh.close()
	lines = data.split('\r\n')
예제 #29
0
import json
from factory import ManifestFactory
import urllib
import os, sys

baseq = "http://data.fitzmuseum.cam.ac.uk/api/?size=1000&query="
q = "Marlay%20AND%20cutting%20AND%20Category:illuminated*"

destdir = "/path/to/images/fitzwilliam"

fac = ManifestFactory()
fac.set_base_image_uri("http://iiif-dev.localhost/services/2.0")
fac.set_iiif_image_info(version="2.0")
basemd = "http://localhost/prezi/fitz/"
basedir = "/path/to/htdocs/prezi/fitz/" 
fac.set_base_metadata_uri(basemd)
fac.set_base_metadata_dir(basedir)

fh = urllib.urlopen(baseq+q)
data = fh.read()
fh.close()
results = json.loads(data)

mfst = fac.manifest(label="Marlay Cuttings")
seq = mfst.sequence()

for res in results['results']:
	if not res.has_key('image'):
		continue
	ident = res.get('identifier')
	name = res.get('Name')
		if SETS_TO_DO and not s in SETS_TO_DO:
			print "skipping %s / %s" % (s , sinfo['name'])
			continue

		try:
			print "Processing Set: %s" % sinfo['name']
		except:
			print "Processing Set: %s" % s
		sys.stdout.flush()
		if os.path.exists(s):
			continue
		os.mkdir(s)

		fac = ManifestFactory()
		fac.set_base_metadata_uri(BASE_MD_URL + "/%s/%s/" % (host, s))
		fac.set_base_metadata_dir(os.path.join(os.getcwd(), s))
		fac.set_base_image_uri(BASE_IMG_URL + "/%s/%s/" % (host, s))
		fac.set_iiif_image_info("2.0", "1")
		fac.set_debug('error')

		manifest = fac.manifest(label=sinfo['name'])
		if sinfo['desc']:
			manifest.description = str(sinfo['desc'])
		manifest.attribution = "Converted from http://%s/" % host
		manifest.viewingHint = "individuals"

		sequence = manifest.sequence()
		dom = get_xml('http://%s/oai/oai.php?verb=ListRecords&set=%s&metadataPrefix=oai_dc' % (host, s))
		recs = dom.xpath('/o:OAI-PMH/o:ListRecords/o:record', namespaces=ALLNS)
		lastrec = None