changeset 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 bfa8009f0769
children 01738ae70f2d
files README sat_website/local_settings.py sat_website/screenshots.py sat_website/utils.py templates/sat_website/gallery.html
diffstat 5 files changed, 29 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/README	Thu May 14 22:46:57 2015 +0200
+++ b/README	Thu May 14 23:37:56 2015 +0200
@@ -35,8 +35,11 @@
 
 The following values can be set in site's settings.py:
 
+    # External URL pointing the external media files
+    MEDIA_EXTERNAL_URL = 'ftp://ftp.goffi.org/media'
+
     # External URL pointing the projects archives directory
-    PROJECTS_EXTERNAL_PATH = 'ftp://ftp.goffi.org'
+    PROJECTS_EXTERNAL_URL = 'ftp://ftp.goffi.org'
 
     # Internal path to the projects archives directory
     PROJECTS_INTERNAL_PATH = '/var/www/projects'
@@ -61,6 +64,10 @@
     # Subscription amounts as defined in the Rules of Procedure
     ASSO_SUBSCR_AMOUNTS = (0, 10, 20, 30, 50, 80, 100)
 
+    # Bank account information
+    ASSO_IBAN = u"FR76 1027 8060 4300 0207 3220 109"
+    ASSO_BIC = u"CMCIFR2A"
+
     # URL to the Statutes and Rules of the association
     ASSO_URL_STATUTES = 'http://repos.goffi.org/sat_docs/raw-file/tip/association/statuts.pdf'
     ASSO_URL_RULES = 'http://repos.goffi.org/sat_docs/raw-file/tip/association/r%C3%A8glement%20int%C3%A9rieur.pdf'
--- a/sat_website/local_settings.py	Thu May 14 22:46:57 2015 +0200
+++ b/sat_website/local_settings.py	Thu May 14 23:37:56 2015 +0200
@@ -107,8 +107,11 @@
 
 # Options for SàT website (see README)
 
+# External URL pointing the external media files
+MEDIA_EXTERNAL_URL = 'ftp://ftp.goffi.org/media'
+
 # External URL pointing the projects archives directory
-PROJECTS_EXTERNAL_PATH = 'ftp://ftp.goffi.org'
+PROJECTS_EXTERNAL_URL = 'ftp://ftp.goffi.org'
 
 # Internal path to the the projects archives directory
 PROJECTS_INTERNAL_PATH = '/var/www/projects'
@@ -133,7 +136,7 @@
 # Subscription amounts as defined in the Rules of Procedure
 ASSO_SUBSCR_AMOUNTS = (0, 10, 20, 30, 50, 80, 100)
 
-# Bank information
+# Bank account information
 ASSO_IBAN = u"FR76 1027 8060 4300 0207 3220 109"
 ASSO_BIC = u"CMCIFR2A"
 
--- 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"}),
     ]
 
--- a/sat_website/utils.py	Thu May 14 22:46:57 2015 +0200
+++ b/sat_website/utils.py	Thu May 14 23:37:56 2015 +0200
@@ -44,7 +44,7 @@
         int_path = join(settings.PROJECTS_INTERNAL_PATH, path)  # this is a symbolic link
         # base name of the real path MUST look like: <project>-<version><ARCHIVE_SUFFIX>
         version = basename(realpath(int_path))[len(name) + 1:-len(settings.ARCHIVE_SUFFIX)]
-        ext_path = join(settings.PROJECTS_EXTERNAL_PATH, path)
+        ext_path = join(settings.PROJECTS_EXTERNAL_URL, path)
         result[name] = (ext_path, version, infos[name] if name in infos else '')
 
     return result
--- a/templates/sat_website/gallery.html	Thu May 14 22:46:57 2015 +0200
+++ b/templates/sat_website/gallery.html	Thu May 14 23:37:56 2015 +0200
@@ -36,7 +36,7 @@
             {% for screenshot in row %}
                 <div class="col-md-4">
                     {% if screenshot.poster %}
-	                    <video index="{{ forloop.counter0 }}" class="thumbnail img-responsive" width="640" height="400" poster="{% static screenshot.poster %}" controls="controls" src="{% static screenshot.path %}" preload="none">
+	                    <video index="{{ forloop.counter0 }}" class="thumbnail img-responsive" width="640" height="400" poster="{{ screenshot.poster }}" controls="controls" src="{{ screenshot.path }}" preload="none">
 	                    {% blocktrans with firefox="<a href=\"http://www.mozilla.org/\">Firefox</a>" %}Your browser doesn't manage the « video » tag, you should update, e.g. with the last {{ firefox }}{% endblocktrans %}
 	                    </video>
                     {% else %}
@@ -78,7 +78,7 @@
                         {% for screenshot in screenshots %}
                             <div class="item{% if not forloop.counter0 %} active{% endif %}">
                                 {% if screenshot.poster %}
-	                                <video class="img-responsive" width="640" height="400" poster="{% static screenshot.poster %}" controls="controls" src="{% static screenshot.path %}" preload="none">
+	                                <video class="img-responsive" width="640" height="400" poster="{{ screenshot.poster }}" controls="controls" src="{{ screenshot.path }}" preload="none">
 	                                {% blocktrans with firefox="<a href=\"http://www.mozilla.org/\">Firefox</a>" %}Your browser doesn't manage the « video » tag, you should update, e.g. with the last {{ firefox }}{% endblocktrans %}
 	                                </video>
                                 {% else %}