dcterms_context = { 'dcterms':'http://purl.org/dc/terms/' }
for media_id in media_locations.keys():
+ files_attempted += 1
+
file_metadata = media_metadata[media_id]
sanitized_metadata = check_metadata_format(file_metadata)
if sanitized_metadata == {}: continue
description = file_metadata.get('dcterms:description')
license = file_metadata.get('dcterms:license')
filename = url.path.split()[-1]
- files_attempted += 1
if url.scheme == 'http':
media_file = tempfile.TemporaryFile()
"$schema":"http://json-schema.org/schema#",
"properties":{
"@context":{},
+
"dcterms:contributor":{},
"dcterms:coverage":{},
"dcterms:created":{},
"dcterms:source":{},
"dcterms:subject":{},
"dcterms:title":{},
- "dcterms:type":{},
- "media:id":{}
+ "dcterms:type":{}
},
"additionalProperties": false,
"required":["dcterms:title","@context","media:id"]
title = metadata_dict.get('dcterms:title') or metadata_dict.get('media:id') or \
_(u'UNKNOWN FILE')
print _(
-u"""WARN: Could not find appropriate metadata for file {title}.
+u"""WARN: Could not find appropriate metadata for file "{title}".
File will be skipped""".format(title=title))
output_dict = {}
except:
{
"@context": {
- "dc": "http://purl.org/dc/elements/1.1/",
+ "dcterms": "http://purl.org/dc/elements/1.1/",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"contributor":{
- "@id":"dc:title",
+ "@id":"dcterms:title",
"@type":"xsd:string"
},
"coverage":{
- "@id":"dc:coverage",
+ "@id":"dcterms:coverage",
"@type":"xsd:string"
},
"created":{
- "@id":"dc:created",
+ "@id":"dcterms:created",
"@type":"xsd:date"
},
"creator":{
- "@id":"dc:created",
+ "@id":"dcterms:created",
"@type":"xsd:date"
},
"date":{
- "@id":"dc:date",
+ "@id":"dcterms:date",
"@type":"xsd:date"
},
"description":{
- "@id":"dc:description",
+ "@id":"dcterms:description",
"@type":"xsd:string"
},
"format":{
- "@id":"dc:format",
+ "@id":"dcterms:format",
"@type":"xsd:string"
},
"identifier":{
- "@id":"dc:identifier",
+ "@id":"dcterms:identifier",
"@type":"xsd:string"
},
"language":{
- "@id":"dc:language",
+ "@id":"dcterms:language",
"@type":"xsd:string"
},
"publisher":{
- "@id":"dc:publisher",
+ "@id":"dcterms:publisher",
"@type":"xsd:string"
},
"relation":{
- "@id":"dc:relation",
+ "@id":"dcterms:relation",
"@type":"xsd:string"
},
"rights":{
- "@id":"dc:rights",
+ "@id":"dcterms:rights",
"@type":"xsd:anyURI"
},
"source":{
- "@id":"dc:source",
+ "@id":"dcterms:source",
"@type":"xsd:string"
},
"subject":{
- "@id":"dc:subject",
+ "@id":"dcterms:subject",
"@type":"xsd:string"
},
"title": {
- "@id":"dc:title",
+ "@id":"dcterms:title",
"@type":"xsd:string"
},
"type":{
- "@id":"dc:type",
+ "@id":"dcterms:type",
"@type":"xsd:string"
}
}