Fixed a minor error in the batch upload script and modified the json-ld context.
authortilly-Q <nattilypigeonfowl@gmail.com>
Thu, 27 Mar 2014 21:10:31 +0000 (17:10 -0400)
committertilly-Q <nattilypigeonfowl@gmail.com>
Mon, 21 Apr 2014 16:10:19 +0000 (12:10 -0400)
mediagoblin/gmg_commands/batchaddmedia.py
mediagoblin/templates/mediagoblin/metadata_contexts/v1

index 414e969ca4eca32f10ead55e025a7719b1e604f1..012a5ee4efeef1807b1c5c136e3540b7ede0c187 100644 (file)
@@ -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:
index 1325d9201d9ba7c03c0ed769171c8b64dfa7ff6b..99882de210132502b716016324d7891346db230b 100644 (file)
@@ -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"
     }
   }