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/' }
|
||||
|
||||
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
|
||||
@ -149,7 +151,6 @@ zip files and directories"
|
||||
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()
|
||||
@ -228,6 +229,7 @@ def check_metadata_format(metadata_dict):
|
||||
"$schema":"http://json-schema.org/schema#",
|
||||
"properties":{
|
||||
"@context":{},
|
||||
|
||||
"dcterms:contributor":{},
|
||||
"dcterms:coverage":{},
|
||||
"dcterms:created":{},
|
||||
@ -246,8 +248,7 @@ def check_metadata_format(metadata_dict):
|
||||
"dcterms:source":{},
|
||||
"dcterms:subject":{},
|
||||
"dcterms:title":{},
|
||||
"dcterms:type":{},
|
||||
"media:id":{}
|
||||
"dcterms:type":{}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"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 \
|
||||
_(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:
|
||||
|
@ -1,69 +1,69 @@
|
||||
{
|
||||
"@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"
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user