web/ldt/ldt_utils/projectserializer.py
changeset 26 d5b6908e4da5
parent 10 84e31387a741
child 27 f81da251d0aa
equal deleted inserted replaced
25:9508e39672bb 26:d5b6908e4da5
    33         
    33         
    34         list_items = []
    34         list_items = []
    35         new_list = {
    35         new_list = {
    36             "id" : ensemble_id,
    36             "id" : ensemble_id,
    37             "items" : list_items,
    37             "items" : list_items,
    38             "metas" : {
    38             "meta" : {
    39                 "dc:creator":ensemble_author,
    39                 "dc:creator":ensemble_author,
    40                 "dc:created": ensemble_created,
    40                 "dc:created": ensemble_created,
    41                 "dc:contributor":"undefined",
    41                 "dc:contributor":"undefined",
    42                 "dc:modified": ensemble_modified,
    42                 "dc:modified": ensemble_modified,
    43                 "dc:title":ensemble_title,
    43                 "dc:title":ensemble_title,
   146                 tag_date = datetime.utcnow().isoformat()
   146                 tag_date = datetime.utcnow().isoformat()
   147                 for tag_id in tags_list:
   147                 for tag_id in tags_list:
   148                     if tag_id not in self.tags:
   148                     if tag_id not in self.tags:
   149                         new_tag = {
   149                         new_tag = {
   150                             "id":tag_id,
   150                             "id":tag_id,
   151                             "metas" : {
   151                             "meta" : {
   152                                 "dc:creator":"IRI",
   152                                 "dc:creator":"IRI",
   153                                 "dc:created": tag_date,
   153                                 "dc:created": tag_date,
   154                                 "dc:contributor":"IRI",
   154                                 "dc:contributor":"IRI",
   155                                 "dc:modified": tag_date,
   155                                 "dc:modified": tag_date,
   156                                 "dc:title":tag_id
   156                                 "dc:title":tag_id
   173                             "src" : element_audio_src,
   173                             "src" : element_audio_src,
   174                             "mimetype": "audio/mp3",
   174                             "mimetype": "audio/mp3",
   175                             "href": element_audio_href
   175                             "href": element_audio_href
   176                         },
   176                         },
   177                     },
   177                     },
   178                     "metas": {
   178                     "meta": {
   179                         "id-ref": decoupage_id,
   179                         "id-ref": decoupage_id,
   180                         "dc:creator": decoupage_creator,
   180                         "dc:creator": decoupage_creator,
   181                         "dc:contributor": decoupage_contributor,
   181                         "dc:contributor": decoupage_contributor,
   182                         "dc:created": decoupage_created,
   182                         "dc:created": decoupage_created,
   183                         "dc:modified": decoupage_modified
   183                         "dc:modified": decoupage_modified
   248 
   248 
   249         
   249         
   250         new_media = {
   250         new_media = {
   251              "http://advene.liris.cnrs.fr/ns/frame_of_reference/ms" : "o=0",
   251              "http://advene.liris.cnrs.fr/ns/frame_of_reference/ms" : "o=0",
   252              "id" : content.iri_id,
   252              "id" : content.iri_id,
   253              "url" : content.videopath.rstrip('/') + "/" + content.src,
   253              "href" : content.videopath.rstrip('/') + "/" + content.src,
   254              "dc:creator" : author,
   254              "unit" : "ms",
   255              "dc:created" : content.creation_date.isoformat(),
   255              "origin" : "0",
   256              "dc:contributor" : contributor,
   256              "meta": {
   257              "dc:modified" : content.update_date.isoformat(),
   257                  "dc:creator" : author,
   258              "dc:creator.contents" : content_author,
   258                  "dc:created" : content.creation_date.isoformat(),
   259              "dc:created.contents" : content_date,
   259                  "dc:contributor" : contributor,
   260              "dc:title" : content.title,
   260                  "dc:modified" : content.update_date.isoformat(),
   261              "dc:description" : content.description,
   261                  "dc:creator.contents" : content_author,
   262              "dc:duration" : content.get_duration(),
   262                  "dc:created.contents" : content_date,
       
   263                  "dc:title" : content.title,
       
   264                  "dc:description" : content.description,
       
   265                  "dc:duration" : content.get_duration(),
       
   266                  "item": {
       
   267                      "name" : "streamer",
       
   268                      "value": content.videopath.rstrip('/') + "/"
       
   269                  },
       
   270              }
   263         }
   271         }
   264         
   272         
   265         self.medias.append(new_media)
   273         self.medias.append(new_media)
   266         
   274         
   267         
   275         
   279         
   287         
   280         project_main_media = ""
   288         project_main_media = ""
   281         if len(self.medias) > 0:
   289         if len(self.medias) > 0:
   282             project_main_media = self.medias[0]["id"]
   290             project_main_media = self.medias[0]["id"]
   283         
   291         
   284         res['metas'] = {
   292         res['meta'] = {
   285              'id': self.project.ldt_id,
   293              'id': self.project.ldt_id,
   286              'dc:created':self.project.creation_date.isoformat(),
   294              'dc:created':self.project.creation_date.isoformat(),
   287              'dc:modified':self.project.modification_date.isoformat(),
   295              'dc:modified':self.project.modification_date.isoformat(),
   288              'dc:contributor':self.project.changed_by,
   296              'dc:contributor':self.project.changed_by,
   289              'dc:creator':self.project.created_by,
   297              'dc:creator':self.project.created_by,