]> git.parisson.com Git - telemeta.git/commitdiff
Don't display media related items if their mime type is in private_extra_types dict
authorGuillaume Pellerin <yomguy@parisson.com>
Mon, 16 Mar 2015 23:36:27 +0000 (00:36 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Mon, 16 Mar 2015 23:36:27 +0000 (00:36 +0100)
telemeta/models/core.py
telemeta/templates/telemeta/inc/mediaitem_related.html
telemeta/views/item.py

index ce9b77384e3f4f923a40a95589a1e51149ae6e3e..8605fde9c498f2c51701285acab9b7fac1c907c6 100644 (file)
@@ -63,15 +63,21 @@ from xml.dom.minidom import getDOMImplementation
 PUBLIC_ACCESS_CHOICES = (('none', _('none')), ('metadata', _('metadata')),
                          ('mixed', _('mixed')), ('full', _('full')))
 
-extra_types = {
+public_extra_types = {
     '.webm': 'video/webm',
+}
+
+private_extra_types = {
     '.eaf': 'text/xml',  # ELAN Annotation Format
     '.trs':  'text/xml', # Trancriber Annotation Format
     '.svl':  'text/xml',  # Sonic Visualiser layer file
     '.TextGrid': 'text/praat-textgrid',  # Praat TextGrid annotation file
 }
 
-for ext,mime_type in extra_types.items():
+for ext,mime_type in public_extra_types.items():
+    mimetypes.add_type(mime_type, ext)
+
+for ext,mime_type in private_extra_types.items():
     mimetypes.add_type(mime_type, ext)
 
 app_name = 'telemeta'
index ff5bfd9585fc7afb411bccfe342a4e1186cb55c8..9fe8eb864fd23f6dc13921de1d6be0d48f86253f 100644 (file)
@@ -15,6 +15,7 @@
                     </thead>
                     <tbody>
                         {% for media in related_media %}
+                        {% if not media.mime_type in private_extra_types %}
                         <tr>
                             <td style="font-size: 1em;">
                             <dl class="listing">
@@ -68,6 +69,7 @@
                                 {% endif %}
                             </td>
                         </tr>
+                        {% endif %}
                         {% endfor %}
                     </tbody>
                 </table>
index 368a82206ae3503c9c6615ca35093d7e9cb971b3..ae94e36a246d0b9177da065bda2b878d66989c42 100644 (file)
@@ -1010,13 +1010,12 @@ class ItemDetailView(ItemViewMixin, DetailView):
         context['mime_type'] = self.mime_type
         context['last_revision'] = last_revision
         context['format'] = format
-
+        context['private_extra_types'] = private_extra_types.values()
         return context
 
 
-
 class DublinCoreToFormatMetadata(object):
-    """ a mapping class to get item DublinCore metadata dictionaries
+    """a mapping class to get item DublinCore metadata dictionaries
     in various audio metadata format (MP3, OGG, etc...)"""
 
     #FIXME: should be given by timeside