diff sat_website/screenshots.py @ 58:746e53efc188

allow large media files (screencasts) to be stored on an external server
author souliane <souliane@mailoo.org>
date Thu, 14 May 2015 23:37:56 +0200
parents 3e460ca969d2
children 6652924221ba
line wrap: on
line diff
--- a/sat_website/screenshots.py	Thu May 14 22:46:57 2015 +0200
+++ b/sat_website/screenshots.py	Thu May 14 23:37:56 2015 +0200
@@ -20,11 +20,17 @@
 along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
 """
 from django.utils.translation import ugettext_lazy as _
+from django.conf import settings
 from collections import namedtuple
+import os.path
 
 ImageDesc = namedtuple("ImageDesc", "path description data")
 VideoDesc = namedtuple("VideoDesc", "path description poster data")
 
+media_path = os.path.normpath(settings.MEDIA_EXTERNAL_URL)
+screencasts = os.path.join(media_path, "screencasts") + "/"
+
+
 #list the pictures
 
 screenshots = [
@@ -34,7 +40,7 @@
               {_(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("videos/screencasts/présentation_SàT_5_radio_collective.webm", _(u"Demo of the new Libervia UI, and of the collective radio feature"), "videos/screencasts/posters/radiocol.jpg",
+    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"}),
     ImageDesc("images/screenshots/libervia/libervia_login.png", _(u"Libervia's login page"),
               {_(u"frontend"): "libervia", _(u"version"): "0.3D", _(u"year"): "2011"}),
@@ -42,26 +48,26 @@
               {_(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("videos/screencasts/présentation_SàT_3.webm", _(u"This video focuses on Libervia. The UI is really outdated, but we can see some features"), "videos/screencasts/posters/présentation_SàT_3.jpg",
+    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"}),
     ]
 
 screenshots_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("videos/screencasts/présentation_SàT_7_télécommande_universelle.webm", _(u"Use ad-hoc commands to control a VLC player from Libervia"), "videos/screencasts/posters/présentation_SàT_7_télécommande_universelle.png",
+    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("videos/screencasts/présentation_SàT_6_export_commande.webm", _(u"Exporting a command: an FTP client is exported to a Gajim contact"), "videos/screencasts/posters/présentation_SàT_6_export_commande.jpg",
+    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("videos/screencasts/présentation_SàT_4_copie_et_pipe.webm", _(u"How to copy and pipe streams over XMPP"), "videos/screencasts/posters/présentation_SàT_4.jpg",
+    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.jpg",
               {_(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("videos/screencasts/présentation_SàT_2.webm", _(u"This video shows french Tarot game, and how to use Thunderbird with SàT"), "videos/screencasts/posters/présentation_SàT_2.jpg",
+    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("videos/screencasts/présentation_SàT.webm", _(u"The first video shows wix, primitivus and jp"), "videos/screencasts/posters/présentation_SàT.jpg",
+    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"}),
     ]