Fixed a minor error in the batch upload script and modified the json-ld context.
This commit is contained in:
parent
8f054a6b99
commit
32aec1e533
@ -137,6 +137,8 @@ zip files and directories"
|
|||||||
dcterms_context = { 'dcterms':'http://purl.org/dc/terms/' }
|
dcterms_context = { 'dcterms':'http://purl.org/dc/terms/' }
|
||||||
|
|
||||||
for media_id in media_locations.keys():
|
for media_id in media_locations.keys():
|
||||||
|
files_attempted += 1
|
||||||
|
|
||||||
file_metadata = media_metadata[media_id]
|
file_metadata = media_metadata[media_id]
|
||||||
sanitized_metadata = check_metadata_format(file_metadata)
|
sanitized_metadata = check_metadata_format(file_metadata)
|
||||||
if sanitized_metadata == {}: continue
|
if sanitized_metadata == {}: continue
|
||||||
@ -149,7 +151,6 @@ zip files and directories"
|
|||||||
description = file_metadata.get('dcterms:description')
|
description = file_metadata.get('dcterms:description')
|
||||||
license = file_metadata.get('dcterms:license')
|
license = file_metadata.get('dcterms:license')
|
||||||
filename = url.path.split()[-1]
|
filename = url.path.split()[-1]
|
||||||
files_attempted += 1
|
|
||||||
|
|
||||||
if url.scheme == 'http':
|
if url.scheme == 'http':
|
||||||
media_file = tempfile.TemporaryFile()
|
media_file = tempfile.TemporaryFile()
|
||||||
@ -228,6 +229,7 @@ def check_metadata_format(metadata_dict):
|
|||||||
"$schema":"http://json-schema.org/schema#",
|
"$schema":"http://json-schema.org/schema#",
|
||||||
"properties":{
|
"properties":{
|
||||||
"@context":{},
|
"@context":{},
|
||||||
|
|
||||||
"dcterms:contributor":{},
|
"dcterms:contributor":{},
|
||||||
"dcterms:coverage":{},
|
"dcterms:coverage":{},
|
||||||
"dcterms:created":{},
|
"dcterms:created":{},
|
||||||
@ -246,8 +248,7 @@ def check_metadata_format(metadata_dict):
|
|||||||
"dcterms:source":{},
|
"dcterms:source":{},
|
||||||
"dcterms:subject":{},
|
"dcterms:subject":{},
|
||||||
"dcterms:title":{},
|
"dcterms:title":{},
|
||||||
"dcterms:type":{},
|
"dcterms:type":{}
|
||||||
"media:id":{}
|
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"required":["dcterms:title","@context","media:id"]
|
"required":["dcterms:title","@context","media:id"]
|
||||||
@ -260,7 +261,7 @@ def check_metadata_format(metadata_dict):
|
|||||||
title = metadata_dict.get('dcterms:title') or metadata_dict.get('media:id') or \
|
title = metadata_dict.get('dcterms:title') or metadata_dict.get('media:id') or \
|
||||||
_(u'UNKNOWN FILE')
|
_(u'UNKNOWN FILE')
|
||||||
print _(
|
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))
|
File will be skipped""".format(title=title))
|
||||||
output_dict = {}
|
output_dict = {}
|
||||||
except:
|
except:
|
||||||
|
@ -1,69 +1,69 @@
|
|||||||
{
|
{
|
||||||
"@context": {
|
"@context": {
|
||||||
"dc": "http://purl.org/dc/elements/1.1/",
|
"dcterms": "http://purl.org/dc/elements/1.1/",
|
||||||
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
||||||
"contributor":{
|
"contributor":{
|
||||||
"@id":"dc:title",
|
"@id":"dcterms:title",
|
||||||
"@type":"xsd:string"
|
"@type":"xsd:string"
|
||||||
},
|
},
|
||||||
"coverage":{
|
"coverage":{
|
||||||
"@id":"dc:coverage",
|
"@id":"dcterms:coverage",
|
||||||
"@type":"xsd:string"
|
"@type":"xsd:string"
|
||||||
},
|
},
|
||||||
"created":{
|
"created":{
|
||||||
"@id":"dc:created",
|
"@id":"dcterms:created",
|
||||||
"@type":"xsd:date"
|
"@type":"xsd:date"
|
||||||
},
|
},
|
||||||
"creator":{
|
"creator":{
|
||||||
"@id":"dc:created",
|
"@id":"dcterms:created",
|
||||||
"@type":"xsd:date"
|
"@type":"xsd:date"
|
||||||
},
|
},
|
||||||
"date":{
|
"date":{
|
||||||
"@id":"dc:date",
|
"@id":"dcterms:date",
|
||||||
"@type":"xsd:date"
|
"@type":"xsd:date"
|
||||||
},
|
},
|
||||||
"description":{
|
"description":{
|
||||||
"@id":"dc:description",
|
"@id":"dcterms:description",
|
||||||
"@type":"xsd:string"
|
"@type":"xsd:string"
|
||||||
},
|
},
|
||||||
"format":{
|
"format":{
|
||||||
"@id":"dc:format",
|
"@id":"dcterms:format",
|
||||||
"@type":"xsd:string"
|
"@type":"xsd:string"
|
||||||
},
|
},
|
||||||
"identifier":{
|
"identifier":{
|
||||||
"@id":"dc:identifier",
|
"@id":"dcterms:identifier",
|
||||||
"@type":"xsd:string"
|
"@type":"xsd:string"
|
||||||
},
|
},
|
||||||
"language":{
|
"language":{
|
||||||
"@id":"dc:language",
|
"@id":"dcterms:language",
|
||||||
"@type":"xsd:string"
|
"@type":"xsd:string"
|
||||||
},
|
},
|
||||||
"publisher":{
|
"publisher":{
|
||||||
"@id":"dc:publisher",
|
"@id":"dcterms:publisher",
|
||||||
"@type":"xsd:string"
|
"@type":"xsd:string"
|
||||||
},
|
},
|
||||||
"relation":{
|
"relation":{
|
||||||
"@id":"dc:relation",
|
"@id":"dcterms:relation",
|
||||||
"@type":"xsd:string"
|
"@type":"xsd:string"
|
||||||
},
|
},
|
||||||
"rights":{
|
"rights":{
|
||||||
"@id":"dc:rights",
|
"@id":"dcterms:rights",
|
||||||
"@type":"xsd:anyURI"
|
"@type":"xsd:anyURI"
|
||||||
},
|
},
|
||||||
"source":{
|
"source":{
|
||||||
"@id":"dc:source",
|
"@id":"dcterms:source",
|
||||||
"@type":"xsd:string"
|
"@type":"xsd:string"
|
||||||
},
|
},
|
||||||
"subject":{
|
"subject":{
|
||||||
"@id":"dc:subject",
|
"@id":"dcterms:subject",
|
||||||
"@type":"xsd:string"
|
"@type":"xsd:string"
|
||||||
},
|
},
|
||||||
"title": {
|
"title": {
|
||||||
"@id":"dc:title",
|
"@id":"dcterms:title",
|
||||||
"@type":"xsd:string"
|
"@type":"xsd:string"
|
||||||
},
|
},
|
||||||
"type":{
|
"type":{
|
||||||
"@id":"dc:type",
|
"@id":"dcterms:type",
|
||||||
"@type":"xsd:string"
|
"@type":"xsd:string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user