aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/gmg_commands/batchaddmedia.py
diff options
context:
space:
mode:
authortilly-Q <nattilypigeonfowl@gmail.com>2014-03-27 17:10:31 -0400
committertilly-Q <nattilypigeonfowl@gmail.com>2014-03-27 17:10:31 -0400
commit32aec1e533e9de8b843e54d5a08b55d26e81f87e (patch)
treee5901aff517f0896e6c465604676a8808a80a4b1 /mediagoblin/gmg_commands/batchaddmedia.py
parent8f054a6b99a594da36a859f7bb5f11464c1602bd (diff)
downloadmediagoblin-32aec1e533e9de8b843e54d5a08b55d26e81f87e.tar.lz
mediagoblin-32aec1e533e9de8b843e54d5a08b55d26e81f87e.tar.xz
mediagoblin-32aec1e533e9de8b843e54d5a08b55d26e81f87e.zip
Fixed a minor error in the batch upload script and modified the json-ld context.
Diffstat (limited to 'mediagoblin/gmg_commands/batchaddmedia.py')
-rw-r--r--mediagoblin/gmg_commands/batchaddmedia.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/mediagoblin/gmg_commands/batchaddmedia.py b/mediagoblin/gmg_commands/batchaddmedia.py
index 414e969c..012a5ee4 100644
--- a/mediagoblin/gmg_commands/batchaddmedia.py
+++ b/mediagoblin/gmg_commands/batchaddmedia.py
@@ -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: