diff sat_website/media.py @ 90:5de2a3dd4e67

change VideoDesc attribute path to paths, a dict where you can specify a different path for each language
author souliane <souliane@mailoo.org>
date Tue, 16 Jun 2015 17:23:15 +0200
parents 4b4a5d7602f8
children 7a79cb5ed43b
line wrap: on
line diff
--- a/sat_website/media.py	Tue Jun 16 12:35:32 2015 +0200
+++ b/sat_website/media.py	Tue Jun 16 17:23:15 2015 +0200
@@ -21,24 +21,25 @@
 """
 from django.utils.translation import ugettext_lazy as _
 from django.conf import settings
-from collections import namedtuple
+from collections import namedtuple, OrderedDict
 import os.path
 
 ImageDesc = namedtuple("ImageDesc", "path description data")
-VideoDesc = namedtuple("VideoDesc", "path description poster data")
+VideoDesc = namedtuple("VideoDesc", "paths description poster data")
 
 screencasts = os.path.join(settings.MEDIA_EXTERNAL_URL, "screencasts") + "/"
 video = os.path.join(settings.MEDIA_EXTERNAL_URL, "video") + "/"
 
-
 #list the pictures
 
 media = [
 
-    VideoDesc(video + "libervia_adhesion_2015_fr.webm",
+    # use OrderedDict when more than one language, the first item is the default one
+    VideoDesc(OrderedDict({"en": video + "libervia_adhesion_2015_en.webm",
+                           "fr": video + "libervia_adhesion_2015_fr.webm"}),
               _(u"Membership campaign for Libervia"),
               video + "posters/libervia_adhesion_2015.png",
-              {_(u"version"): "0.5", _(u"year"): "2015", _(u"language"): "fr"}),
+              {_(u"version"): "0.5", _(u"year"): "2015"}),
 
     ImageDesc("images/screenshots/0.5/overview_libervia.png", _(u"Overview"),
               {_(u"frontend"): "libervia", _(u"version"): "0.5", _(u"year"): "2014"}),
@@ -46,35 +47,58 @@
               {_(u"frontend"): "libervia", _(u"version"): "0.5", _(u"year"): "2014"}),
     ImageDesc("images/screenshots/0.4/sat_wysiwyg.png", _(u"Rich text editor"),
               {_(u"frontend"): "libervia", _(u"version"): "0.4", _(u"year"): "2014"}),
-    VideoDesc(screencasts + "présentation_SàT_5_radio_collective.webm", _(u"Demo of the new Libervia UI, and of the collective radio feature"), screencasts + "posters/radiocol.jpg",
-              {_(u"frontend"): "libervia", _(u"version"): "0.3D", _(u"year"): "2012", _(u"language"): "fr"}),
+
+    VideoDesc({"fr": screencasts + "présentation_SàT_5_radio_collective.webm"},
+              _(u"Demo of the new Libervia UI, and of the collective radio feature"),
+              screencasts + "posters/radiocol.jpg",
+              {_(u"frontend"): "libervia", _(u"version"): "0.3D", _(u"year"): "2012"}),
+
     ImageDesc("images/screenshots/libervia/libervia_login.png", _(u"Libervia's login page"),
               {_(u"frontend"): "libervia", _(u"version"): "0.3D", _(u"year"): "2011"}),
     ImageDesc("images/screenshots/libervia/libervia_discussions.png", _(u"Libervia's main view"),
               {_(u"frontend"): "libervia", _(u"version"): "0.3D", _(u"year"): "2011"}),
     ImageDesc("images/screenshots/wix/wix_tarot.png", _(u"Wix showing a french Tarot play"),
               {_(u"frontend"): "wix", _(u"version"): "0.2", _(u"year"): "2011"}),
-    VideoDesc(screencasts + "présentation_SàT_3.webm", _(u"This video focuses on Libervia. The UI is really outdated, but we can see some features"), screencasts + "posters/présentation_SàT_3.jpg",
-              {_(u"frontend"): "libervia", _(u"version"): "0.2", _(u"year"): "2011", _(u"language"): "fr"}),
+
+    VideoDesc({"fr": screencasts + "présentation_SàT_3.webm"},
+              _(u"This video focuses on Libervia. The UI is really outdated, but we can see some features"),
+              screencasts + "posters/présentation_SàT_3.jpg",
+              {_(u"frontend"): "libervia", _(u"version"): "0.2", _(u"year"): "2011"}),
     ]
 
 media_tech = [
     ImageDesc("images/screenshots/0.5/adhoc_administration.png", _(u"Server administration from the web frontend Libervia."),
               {_(u"frontend"): "libervia", _(u"version"): "0.5", _(u"year"): "2014"}),
-    VideoDesc(screencasts + "présentation_SàT_7_télécommande_universelle.webm", _(u"Use ad-hoc commands to control a VLC player from Libervia"), screencasts + "posters/présentation_SàT_7_télécommande_universelle.png",
-              {_(u"version"): "0.4", _(u"year"): "2014", _(u"language"): "fr"}),
-    VideoDesc(screencasts + "présentation_SàT_6_export_commande.webm", _(u"Exporting a command: an FTP client is exported to a Gajim contact"), screencasts + "posters/présentation_SàT_6_export_commande.jpg",
-              {_(u"version"): "0.4D", _(u"year"): "2013", _(u"language"): "fr"}),
-    VideoDesc(screencasts + "présentation_SàT_4_copie_et_pipe.webm", _(u"How to copy and pipe streams over XMPP"), screencasts + "posters/présentation_SàT_4.png",
+
+    VideoDesc({"fr": screencasts + "présentation_SàT_7_télécommande_universelle.webm"},
+              _(u"Use ad-hoc commands to control a VLC player from Libervia"),
+              screencasts + "posters/présentation_SàT_7_télécommande_universelle.png",
+              {_(u"version"): "0.4", _(u"year"): "2014"}),
+
+    VideoDesc({"fr": screencasts + "présentation_SàT_6_export_commande.webm"},
+              _(u"Exporting a command: an FTP client is exported to a Gajim contact"),
+              screencasts + "posters/présentation_SàT_6_export_commande.jpg",
+              {_(u"version"): "0.4D", _(u"year"): "2013"}),
+
+    VideoDesc({"fr": screencasts + "présentation_SàT_4_copie_et_pipe.webm"},
+              _(u"How to copy and pipe streams over XMPP"),
+              screencasts + "posters/présentation_SàT_4.png",
               {_(u"version"): "0.3D", _(u"year"): "2011", _(u"language"): "fr"}),
+
     ImageDesc("images/screenshots/jp/jp.png", _(u"Cowsay sent in conversation through jp"),
               {_(u"version"): "0.2", _(u"year"): "2011"}),
     ImageDesc("images/screenshots/primitivus/primitivus_tarot.png", _(u"Primitivus showing a french Tarot play"),
               {_(u"frontend"): "primitivus", _(u"version"): "0.2", _(u"year"): "2011"}),
-    VideoDesc(screencasts + "présentation_SàT_2.webm", _(u"This video shows french Tarot game, and how to use Thunderbird with SàT"), screencasts + "posters/présentation_SàT_2.jpg",
-              {_(u"version"): "0.2", _(u"year"): "2011", _(u"language"): "fr"}),
-    VideoDesc(screencasts + "présentation_SàT.webm", _(u"The first video shows wix, primitivus and jp"), screencasts + "posters/présentation_SàT.jpg",
-              {_(u"version"): "0.2", _(u"year"): "2011", _(u"language"): "fr"}),
+
+    VideoDesc({"fr": screencasts + "présentation_SàT_2.webm"},
+              _(u"This video shows french Tarot game, and how to use Thunderbird with SàT"),
+              screencasts + "posters/présentation_SàT_2.jpg",
+              {_(u"version"): "0.2", _(u"year"): "2011"}),
+
+    VideoDesc({"fr": screencasts + "présentation_SàT.webm"},
+              _(u"The first video shows wix, primitivus and jp"),
+              screencasts + "posters/présentation_SàT.jpg",
+              {_(u"version"): "0.2", _(u"year"): "2011"}),
     ]