# HG changeset patch # User hamidouk # Date 1326445758 -3600 # Node ID 4af2a8d56916baef86f93c774308058ac8a3588a # Parent 5f6012d0a7acaef33284ba15e157b056e51f566e# Parent 81a8dbb238093bc34bc5ac3180aec9c7cd01abaa Merging with the latest version from upstream diff -r 5f6012d0a7ac -r 4af2a8d56916 src/ldt/ldt/ldt_utils/projectserializer.py --- a/src/ldt/ldt/ldt_utils/projectserializer.py Fri Jan 13 10:07:16 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/projectserializer.py Fri Jan 13 10:09:18 2012 +0100 @@ -1,3 +1,4 @@ +from django.conf import settings from datetime import datetime from django.utils.datastructures import SortedDict from ldt.ldt_utils.models import Content @@ -15,7 +16,7 @@ """ class ProjectSerializer: - def __init__(self, project, from_contents=True, from_display=True): + def __init__(self, project, from_contents=True, from_display=True, first_cutting=None, viewable_contents=[]): self.project = project self.parsed = False self.ldt_doc = None @@ -32,6 +33,8 @@ self.display_contents_list = [] self.display_cuttings_list = [] self.display_ensemble_list = [] + self.viewable_contents = viewable_contents + self.first_cutting = first_cutting def __parse_views(self, display_node_list): @@ -41,6 +44,7 @@ continue content_list = [] cuttings_list = [] + new_display = { "id": display_id, "contents": content_list, @@ -62,9 +66,23 @@ ensemble_id = cutting_node.get("idens") if ensemble_id not in self.display_ensemble_list: self.display_ensemble_list.append(ensemble_id) + + # sets cutting to display in first position for the metadataplayer + if self.first_cutting: + first_cutting = "c_%s" % self.first_cutting.upper() + + annotation_types = new_display['annotation_types'] + if len(annotation_types) > 1: + index = -1 + for i, s in enumerate(annotation_types): + if s == first_cutting: + index = i + break + if index >= 0: + annotation_types[0], annotation_types[index] = annotation_types[index], annotation_types[0] + self.views_dict[display_id] = new_display - - + def __parse_ensemble(self, ensemble_node, content): @@ -329,7 +347,9 @@ href = "" meta_item_value = "" - if content.videopath: + if content.iri_id not in self.viewable_contents: + href = settings.FORBIDDEN_STREAM_URL + elif content.videopath: href = content.videopath.rstrip('/') + "/" + content.src meta_item_value = content.videopath.rstrip('/') + "/" @@ -396,8 +416,19 @@ res['annotation-types'] = self.annotation_types_dict.values() if len(self.annotation_types_dict) > 0 else None res['annotations'] = self.annotations_dict.values() if len(self.annotations_dict) > 0 else None + + if self.first_cutting: + first_cutting = "c_%s" % self.first_cutting.upper() + + index = -1 + for i, ann in enumerate(res['annotation-types']): + if ann['id'] == first_cutting: + index = i + break + + if index > 0: + res['annotation-types'][0], res['annotation-types'][1] = res['annotation-types'][1], res['annotation-types'][0] - return res def get_annotations(self, first_cutting=True): diff -r 5f6012d0a7ac -r 4af2a8d56916 src/ldt/ldt/ldt_utils/templates/front/front_all_contents.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ldt/ldt/ldt_utils/templates/front/front_all_contents.html Fri Jan 13 10:09:18 2012 +0100 @@ -0,0 +1,57 @@ +{% extends "front/front_base.html" %} +{% load i18n %} +{% load thumbnail %} +{% load front_tags %} + +{% block title %}Lignes de temps : groupe "{{group.name}}"{% endblock %} + +{% block js_import %} +{{block.super}} + + +{% endblock %} + +{% block css_import %} +{{block.super}} + +{% endblock %} + +{% block js_declaration %} +{{block.super}} + + +{% endblock %} + +{% block body %} +{{block.super}} + +
{% trans 'by' %} IRI | {{content.duration|str_duration:"h"}}
+
{% trans 'All medias' %}
+
{% trans 'All medias' %}
+ {{res.content.duration|str_duration:"::"}}