# HG changeset patch # User cavaliet # Date 1401187025 -7200 # Node ID 878a2c621fcf86f1dec9cb64a943213a3450b761 # Parent 86fa41dd11fbae7b9194a90e115bcddfbec66f64 v0.5.19 enhance import for content title diff -r 86fa41dd11fb -r 878a2c621fcf src/spel/__init__.py --- a/src/spel/__init__.py Tue May 27 11:07:49 2014 +0200 +++ b/src/spel/__init__.py Tue May 27 12:37:05 2014 +0200 @@ -1,4 +1,4 @@ -VERSION = (0, 5, 18, "final", 0) +VERSION = (0, 5, 19, "final", 0) VERSION_STR = unicode(".".join(map(lambda i:"%02d" % (i,), VERSION[:2]))) diff -r 86fa41dd11fb -r 878a2c621fcf src/spel/management/commands/loadoperadata.py --- a/src/spel/management/commands/loadoperadata.py Tue May 27 11:07:49 2014 +0200 +++ b/src/spel/management/commands/loadoperadata.py Tue May 27 12:37:05 2014 +0200 @@ -23,6 +23,7 @@ import time import logging +from string import replace logger = logging.getLogger(__name__) @@ -77,8 +78,10 @@ #print("Parsing walk %s, %s, %s" % (dirpath, dirnames, filenames)) for filename in filenames: if filename == "cinelab_iri.json": + ctt_id = os.path.basename(dirpath) + # dirname is like "acte-1-stuff-thing_1234" and we want "Acte 1 stuff thing" + content_title = ctt_id.split("_")[0].replace("-"," ").capitalize() json_path = os.path.join(dirpath, filename) - print("json_path %s" % json_path) print("Parsing json file %s ..." % json_path) json_data = False try: @@ -88,7 +91,6 @@ except: print("Error while parsing json file.") if json_data: - ctt_id = os.path.basename(dirpath) dur = int(json_data["medias"][0]["meta"]["duration"]) # Save media and content media, _ = Media.objects.get_or_create(src="/data/opera/"+ctt_id+"/original_web.mp4", duration=dur) @@ -96,7 +98,7 @@ content = Content.objects.create(iri_id=ctt_id, iriurl=ctt_id+u"/"+ctt_id+u".iri", media_obj=media, - title=json_data["meta"]["ucm:oeuvre"] + " " + json_data["meta"]["dc:created"][:10], + title=content_title, duration=dur, content_creation_date = json_data["meta"]["dc:created"]) content.is_public = True diff -r 86fa41dd11fb -r 878a2c621fcf src/spel/templates/partial/spel_opera_annotations.html --- a/src/spel/templates/partial/spel_opera_annotations.html Tue May 27 11:07:49 2014 +0200 +++ b/src/spel/templates/partial/spel_opera_annotations.html Tue May 27 12:37:05 2014 +0200 @@ -40,8 +40,10 @@