]> git.parisson.com Git - mezzo.git/commitdiff
[Vertigo M&C] live streaming
authorEmilie <zawadzki@ircam.fr>
Wed, 15 Mar 2017 09:26:22 +0000 (10:26 +0100)
committerEmilie <zawadzki@ircam.fr>
Wed, 15 Mar 2017 09:26:22 +0000 (10:26 +0100)
13 files changed:
app/local_settings.py
app/organization/core/templatetags/organization_tags.py
app/organization/media/migrations/0015_livestreaming_event_location.py [new file with mode: 0644]
app/organization/media/models.py
app/organization/media/views.py
app/organization/projects/models.py
app/themes/base/static/img/vertigo-starts/vertigo_tx.png [deleted file]
app/themes/base/static/src/js/modules/live-streaming-counter.js
app/themes/base/static/src/sass/modules/_all.scss
app/themes/base/static/src/sass/modules/_live-streaming.scss [new file with mode: 0644]
app/themes/base/templates/media/live_streaming/base.html [new file with mode: 0644]
app/themes/base/templates/media/live_streaming/live_streaming_detail.html [new file with mode: 0644]
app/themes/base/templates/media/media_base.html [new file with mode: 0644]

index 4d77d16778d2495d4710725f2d6b4027066f0845..592145adfcce72eabbc50c696a15f343ac8101ef 100644 (file)
@@ -87,6 +87,7 @@ ADMIN_MENU_ORDER = (
                  'organization-core.LinkType')),
     (_('Media'), ('organization-media.Media',
                   'organization-media.Playlist',
+                  'organization-media.LiveStreaming',
                  'organization-media.MediaCategory',
                  (_('Media Library'), 'fb_browse'),
                  )),
index a3db871a6f121ac4c5108fb8fb18fdf679f87757..7b66bf79b0f14dfa9f9c0a163dd0f5272a39547a 100644 (file)
@@ -238,3 +238,7 @@ def filter_content(dynamic_contents):
         else :
             dict["other"].append(dc)
     return dict
+
+@register.filter
+def format_iso(date):
+    return date.isoformat()
diff --git a/app/organization/media/migrations/0015_livestreaming_event_location.py b/app/organization/media/migrations/0015_livestreaming_event_location.py
new file mode 100644 (file)
index 0000000..30c0286
--- /dev/null
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.11 on 2017-03-14 18:32
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('mezzanine_agenda', '0017_auto_20170222_1039'),
+        ('organization-media', '0014_livestreaming'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='livestreaming',
+            name='event_location',
+            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='live_streaming_location', to='mezzanine_agenda.EventLocation', verbose_name='Event Location'),
+        ),
+    ]
index ffe4957111f892c45236eaff4159cf370c7eef63..6baf03285a17b640a70ba05f94dc041100872987 100644 (file)
@@ -30,7 +30,7 @@ from mezzanine.core.models import RichText, Displayable, Slugged
 from mezzanine.core.fields import RichTextField, OrderField, FileField
 from mezzanine.utils.models import AdminThumbMixin, upload_to
 from organization.core.models import *
-from mezzanine_agenda.models import Event
+from mezzanine_agenda.models import Event, EventLocation
 from django.conf import settings
 import requests
 
@@ -183,6 +183,7 @@ class LiveStreaming(Displayable):
     html5_url = models.URLField(_('html5 url'), max_length=1024, blank=True)
     youtube_id = models.CharField(_('youtube id'), max_length=64, blank=True, null=True)
     type = models.CharField(_('type'), max_length=32, choices=LIVE_STREAMING_TYPE_CHOICES, default='html5')
+    event_location = models.ForeignKey(EventLocation, verbose_name=_('Event Location'), related_name='live_streaming_location', blank=True, null=True, on_delete=models.SET_NULL)
 
     class Meta:
         verbose_name = "live streaming"
index 8f89245c964aa1c0ff79837eb94b8a9713e75207..0f1c8d2534ffcc7c3b3b44bd59fa78832543c3c6 100644 (file)
@@ -25,6 +25,7 @@ from organization.media.models import *
 from organization.core.views import *
 from dal import autocomplete
 from django.core.exceptions import FieldDoesNotExist
+from datetime import datetime
 
 # temporarily excluse not ready models
 EXCLUDED_MODELS = ("organizationplaylist", "personplaylist")
@@ -132,4 +133,9 @@ class PlaylistOverlayView(SlugMixin, DetailView):
 class LiveStreamingDetailView(SlugMixin, DetailView):
 
     model = LiveStreaming
-    template_name='media/live_streaming_detail.html'
+    template_name='media/live_streaming/live_streaming_detail.html'
+
+    def get_context_data(self, **kwargs):
+        context = super(LiveStreamingDetailView, self).get_context_data(**kwargs)
+        context['next_event'] = Event.objects.filter(location=self.object.event_location).filter(start__gt=datetime.now()).first()
+        return context
index 75116285534a32442a1d093c0831561ce4444a8a..3d5d14980e46b98f0f8227373484db117d67454c 100644 (file)
@@ -336,12 +336,12 @@ class ProjectPublicData(models.Model):
     project = models.ForeignKey(Project, verbose_name=_('project'), related_name='public_data', blank=True, null=True, on_delete=models.SET_NULL)
 
     brief_description = models.CharField(_('brief description'), max_length=110, help_text="Brief description of the challenges faced by the project to be used for wider communication strategy (e.g. Twitter) (110 characters max).")
-    challenges_description = models.TextField(_('challenges description'), help_text="Full description of the challenges faced by the project (100-150 words).")
+    challenges_description = models.TextField(_('full description'), help_text="Full description of the challenges faced by the project (100-150 words).")
     technology_description = models.TextField(_('technology description'), help_text="Must include the elements to be made available to the artist with sufficient functional and implementation details for enabling him/her to elaborate his/her technical approach (100-200 words).")
-    objectives_description = models.TextField(_('objectives description'), help_text="What the project is looking to gain from the collaboration and what kind of artist would be suitable (100 – 150 words).")
+    objectives_description = models.TextField(_('objective description'), help_text="What the project is looking to gain from the collaboration and what kind of artist would be suitable (100 – 150 words).")
     resources_description = models.TextField(_('resource description'), help_text="Resources available to the artist -- e.g. office facility, studio facility, technical equipment, internet connection, laboratory, and periods of availability for artistic production, staff possibly allocated to the project, available budget for travel, consumables and equipment, etc... (50 – 100 words).")
     period = models.CharField(_('period of implementation'), max_length=128, help_text="Possible period of implementation (must be part of the project implementation workplan)")
-    image = models.FileField(_("Image"), max_length=1024, upload_to="user/images/%Y/%m/%d/", help_text="Representing the project")
+    image = models.FileField(_("Image"), max_length=1024, upload_to="images", help_text="Representing the project")
     image_credits = models.CharField(_('Image credits'), max_length=256, blank=True, null=True)
 
     class Meta:
@@ -355,7 +355,7 @@ class ProjectPrivateData(models.Model):
 
     description = models.TextField(_('project description'), help_text="(500 - 1000 words)")
     affiliation = models.CharField(_('affiliation'), max_length=512)
-    commitment_letter = models.FileField(_("letter of commitment by the project coordinator"), max_length=1024, upload_to="user/documents/%Y/%m/%d/", help_text="Written on behalf of the whole project consortium, this letter will commit in implementing the collaboration of a residency application selected by the VERTIGO jury, on the conditions set by the project (in annex of letter: synthesis of all related information entered by project).")
+    commitment_letter = models.FileField(_("letter of commitment by the project coordinator"), max_length=1024, upload_to="Documents/%Y/%m/%d/", help_text="Written on behalf of the whole project consortium, this letter will commit in implementing the collaboration of a residency application selected by the VERTIGO jury, on the conditions set by the project (in annex of letter: synthesis of all related information entered by project).")
     persons = models.CharField(_('persons'), max_length=512, help_text="First name and last name of the persons from organization / project who will be part preliminary of the project team (separated by a comma)")
 
     class Meta:
diff --git a/app/themes/base/static/img/vertigo-starts/vertigo_tx.png b/app/themes/base/static/img/vertigo-starts/vertigo_tx.png
deleted file mode 100644 (file)
index 7f32d1a..0000000
Binary files a/app/themes/base/static/img/vertigo-starts/vertigo_tx.png and /dev/null differ
index 1af7d49d86ba44e9fdb064652a969bf15e27bc33..323b6e1545c69eff2af66e0221dbaa3496610242 100644 (file)
@@ -32,7 +32,7 @@ function cleanCounter() {
     $('#countdown').html('<br />');
 }
 
-function CountDownTimer(dt, id, video_id, video_url)
+function CountDownTimer(dt, id, video_id/*, video_url*/)
     {
         var end = new Date(dt);
 
@@ -52,7 +52,7 @@ function CountDownTimer(dt, id, video_id, video_url)
                 $('#countdown-title').html('<br /><br />');
                 $('#'+id).html('<br />');
                 $('#live').html('- Live !');
-                switchVideo(video_id, video_url);
+                //switchVideo(video_id, video_url);
                 return;
             }
 
@@ -82,4 +82,3 @@ jQuery.fn.center = function () {
                                                 $(window).scrollLeft()) + "px");
     return this;
 }
-
index be0adf8baf0e33ac63d302833d1884436259df9f..53b1c05e035147a2a7b44a356c0e7b4db0520346 100755 (executable)
@@ -70,6 +70,8 @@
 @import 'instagram';
 @import 'hero';
 @import 'overlay';
+@import 'live-streaming';
+
 
 // Typography modules
 @import 'dashed';
diff --git a/app/themes/base/static/src/sass/modules/_live-streaming.scss b/app/themes/base/static/src/sass/modules/_live-streaming.scss
new file mode 100644 (file)
index 0000000..8fb6e44
--- /dev/null
@@ -0,0 +1,53 @@
+// -*- coding: utf-8 -*-
+
+// Copyright (c) 2016-2017 Ircam
+// Copyright (c) 2016-2017 Jérémy Fabre
+
+// This file is part of mezzanine-organization.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU Affero General Public License for more details.
+
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+$module: ".page--live-streaming";
+
+#{$module} {
+
+    & .page__content {
+
+        text-align: center;
+
+    }
+
+    video {
+
+    }
+
+    .overlay {
+        background: #FFFFFF;
+        position:relative;
+        top:-260px;
+        z-index:90;
+        color: white;
+        font-size:1.3em;
+        height: 720px;
+    }
+
+    #countdown {
+        margin-top: 1em;
+        font-weight: bold;
+        color: red;
+    }
+
+
+
+}
diff --git a/app/themes/base/templates/media/live_streaming/base.html b/app/themes/base/templates/media/live_streaming/base.html
new file mode 100644 (file)
index 0000000..3e3fd0b
--- /dev/null
@@ -0,0 +1,174 @@
+{% extends "base.html" %}
+{% load i18n mezzanine_tags keyword_tags organization_tags pages_tags %}
+
+{% block meta_title %}{{ page.meta_title }}{% endblock %}
+
+{% block meta_keywords %}{% metablock %}
+{% keywords_for page as keywords %}
+{% for keyword in keywords %}
+    {% if not forloop.first %}, {% endif %}
+    {{ keyword }}
+{% endfor %}
+{% endmetablock %}{% endblock %}
+
+{% block meta_description %}{% metablock %}
+{{ page.description }}
+{% endmetablock %}{% endblock %}
+
+{% block main %}
+
+    {% block hero %}
+    {% endblock %}
+
+    <div class="page page--{% spaceless %}{% block page_class %}{% endblock %}{% endspaceless %}">
+        <div class="container">
+
+            <div class="row">
+
+                <div class="col-sm-16 col-md-12 col-md-push-2 tac">
+                    {% block page_title %}
+                        {{ page.title }}
+                    {% endblock %}
+                </div>
+
+            </div>
+
+            <div class="row">
+
+                <div class="col-md-2 page__sidebar">
+
+                    <div style="position: relative;">
+                        {% block page_sidebar %}
+                        {% endblock %}
+                    </div>
+
+                </div>
+
+                <div class="mb2 col-sm-16 col-md-12 page__content" data-summary-content>
+                    {% block page_content %}
+                        {{ page.content }}
+                    {% endblock %}
+                    {% block page_link %}
+                        {% with object.links.all as links %}
+                            {% if links %}
+                                {% include 'core/inc/link.html' %}
+                            {% endif %}
+                        {% endwith %}
+                    {% endblock %}
+                    {% block page_file %}
+                        {% with object.files.all as files %}
+                            {% if files %}
+                                {% include 'core/inc/files.html' %}
+                            {% endif %}
+                        {% endwith %}
+                    {% endblock %}
+                    {% block page_audio %}
+                        {% for related in object.playlists.all %}
+                            {% with related.playlist as playlist %}
+                                {% if playlist.type == 'audio' %}
+                                    {% include 'media/inc/playlist_audio_detail.html' %}
+                                {% endif %}
+                            {% endwith %}
+                        {% endfor %}
+                    {% endblock %}
+                </div>
+
+            </div>
+
+        </div>
+
+        {% block page_slider %}
+        {% with object.images.all|get_type:'page_slider' as slider_images %}
+            {% if slider_images %}
+                {% include 'core/inc/slider.html' %}
+            {% endif %}
+        {% endwith %}
+        {% endblock %}
+
+        {% block page_video %}
+            {% for related in object.playlists.all %}
+                {% with related.playlist as playlist %}
+                    {% if playlist.type == 'video' %}
+                        {% include 'media/inc/playlist_video_slider.html' %}
+                    {% endif %}
+                {% endwith %}
+            {% endfor %}
+        {% endblock %}
+
+        <div class="">
+
+            {% block page_person_list %}
+            {% endblock %}
+
+            {% block page_demo %}
+            {% endblock %}
+
+            {% block page_blog %}
+            {% endblock %}
+
+            {% block page_sub_content %}
+                {% with object.blocks.all as blocks %}
+                    {% include "core/inc/block.html" %}
+                {% endwith %}
+            {% endblock %}
+
+            {% block related_project %}
+            {% endblock %}
+
+            {% block products %}
+                {% if page.product_lists.all|length > 0 %}
+                    {% for page_product_list in page.product_lists.all %}
+                      {% with page_product_list.list as list %}
+                        {% with "shop/includes/product_list_"|add:list.style|add:"_style.html" as template %}
+                          {% include template %}
+                        {% endwith %}
+                      {% endwith %}
+                    {% endfor %}
+                {% endif %}
+            {% endblock %}
+
+            {% block page_sub_content_2 %}
+            {% endblock %}
+
+            {% block page_person_list_team %}
+            {% endblock %}
+
+            {% block page_sub_content_3 %}
+            {% endblock %}
+
+            {% block logo %}
+                {% with page.images.all|get_type:'logo' as images %}
+                    {% if images %}
+                        <div class="page__block{% if block.background_color %} page__block--{{ block.background_color }}{% endif %}">
+                            <div class="white-bg pb2">
+                                <div class="container">
+                                    <div class="row" data-summary-content>
+                                        <div class="col-sm-16">
+                                            <ul class="partners-list">
+                                                {% include 'core/inc/logo.html' %}
+                                            </ul>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    {% endif %}
+                {% endwith %}
+            {% endblock %}
+
+        </div>
+
+    </div>
+
+    <div>
+
+        {% block page_related_content %}
+            {% with dynamic_content=page.dynamic_content_pages.all|filter_content object=page %}
+                {% include "core/inc/related_content.html" %}
+            {% endwith %}
+        {% endblock %}
+
+    </div>
+
+
+{% endblock %}
diff --git a/app/themes/base/templates/media/live_streaming/live_streaming_detail.html b/app/themes/base/templates/media/live_streaming/live_streaming_detail.html
new file mode 100644 (file)
index 0000000..11a142e
--- /dev/null
@@ -0,0 +1,53 @@
+{% extends "media/media_base.html" %}
+{% load mezzanine_tags keyword_tags i18n organization_tags staticfiles %}
+
+{% block meta_title %}{% trans "Live Streaming" %}{% endblock %}
+
+
+{% block page_class %}
+    live-streaming
+{% endblock %}
+
+{% block page_title %}
+    {% editable person.title %}
+        <h1 class="section-title section-title--uppercase section-title--main">{{ object.title }}</h1>
+    {% endeditable %}
+{% endblock %}
+
+{% block page_sidebar %}
+{% endblock %}
+
+{% block page_content %}
+    {% if object.type = "youtube" %}
+        {% if object.youtube_id %}
+            <div style="position:relative;height:0;padding-bottom:75.0%">
+                <iframe src="https://www.youtube.com/embed/{{ object.youtube_id }}?ecver=2" width="1280" height="720" frameborder="0" style="position:absolute;width:100%;height:100%;left:0" allowfullscreen></iframe>
+            </div>
+        {% else %}
+            <p>Please fill youtube id</p>
+        {% endif %}
+    {% elif object.type = "html5" %}
+        {% if object.html5_url %}
+            <video id="live-streaming" width="1280" height="720"  controls autoplay>
+                <source src="{{ object.html5_url }}" type="video/webm">
+            </video>
+        {% else %}
+            <p>Please fill html5 live streaming url</p>
+        {% endif %}
+    {% endif %}
+
+    <div class="overlay">
+        <div id="countdown-title"></div>
+        <div id="countdown"></div>
+    </div>
+{% endblock %}
+
+{% block footer_scripts %}
+    {{ block.super }}
+    <script src="{% static "src/js/modules/live-streaming-counter.js" %}"></script>
+
+    <script type="text/javascript">
+        var countdowndate = '{{ next_event.start|format_iso }}';
+        CountDownTimer(countdowndate, 'countdown', 'live-streaming');
+    </script>
+{% endblock %}
diff --git a/app/themes/base/templates/media/media_base.html b/app/themes/base/templates/media/media_base.html
new file mode 100644 (file)
index 0000000..cfe5065
--- /dev/null
@@ -0,0 +1,152 @@
+{% extends "pages/page.html" %}
+{% load mezzanine_tags keyword_tags i18n organization_tags %}
+
+
+{% block main %}
+
+    {% block hero %}
+    {% endblock %}
+
+    <div class="page page--{% spaceless %}{% block page_class %}{% endblock %}{% endspaceless %}">
+        <div class="container">
+
+            <div class="row">
+
+                <div class="col-sm-16 col-md-12 col-md-push-2 tac">
+                    {% block page_title %}
+                        {{ page.title }}
+                    {% endblock %}
+                </div>
+
+            </div>
+
+            <div class="row">
+
+                <div class="mb2 col-sm-16 col-md-12 col-lg-16 page__content" data-summary-content>
+                    {% block page_content %}
+                        {{ page.content }}
+                    {% endblock %}
+                    {% block page_link %}
+                        {% with object.links.all as links %}
+                            {% if links %}
+                                {% include 'core/inc/link.html' %}
+                            {% endif %}
+                        {% endwith %}
+                    {% endblock %}
+                    {% block page_file %}
+                        {% with object.files.all as files %}
+                            {% if files %}
+                                {% include 'core/inc/files.html' %}
+                            {% endif %}
+                        {% endwith %}
+                    {% endblock %}
+                    {% block page_audio %}
+                        {% for related in object.playlists.all %}
+                            {% with related.playlist as playlist %}
+                                {% if playlist.type == 'audio' %}
+                                    {% include 'media/inc/playlist_audio_detail.html' %}
+                                {% endif %}
+                            {% endwith %}
+                        {% endfor %}
+                    {% endblock %}
+                </div>
+
+            </div>
+
+        </div>
+
+        {% block page_slider %}
+        {% with object.images.all|get_type:'page_slider' as slider_images %}
+            {% if slider_images %}
+                {% include 'core/inc/slider.html' %}
+            {% endif %}
+        {% endwith %}
+        {% endblock %}
+
+        {% block page_video %}
+            {% for related in object.playlists.all %}
+                {% with related.playlist as playlist %}
+                    {% if playlist.type == 'video' %}
+                        {% include 'media/inc/playlist_video_slider.html' %}
+                    {% endif %}
+                {% endwith %}
+            {% endfor %}
+        {% endblock %}
+
+        <div class="">
+
+            {% block page_person_list %}
+            {% endblock %}
+
+            {% block page_demo %}
+            {% endblock %}
+
+            {% block page_blog %}
+            {% endblock %}
+
+            {% block page_sub_content %}
+                {% with object.blocks.all as blocks %}
+                    {% include "core/inc/block.html" %}
+                {% endwith %}
+            {% endblock %}
+
+            {% block related_project %}
+            {% endblock %}
+
+            {% block products %}
+                {% if page.product_lists.all|length > 0 %}
+                    {% for page_product_list in page.product_lists.all %}
+                      {% with page_product_list.list as list %}
+                        {% with "shop/includes/product_list_"|add:list.style|add:"_style.html" as template %}
+                          {% include template %}
+                        {% endwith %}
+                      {% endwith %}
+                    {% endfor %}
+                {% endif %}
+            {% endblock %}
+
+            {% block page_sub_content_2 %}
+            {% endblock %}
+
+            {% block page_person_list_team %}
+            {% endblock %}
+
+            {% block page_sub_content_3 %}
+            {% endblock %}
+
+            {% block logo %}
+                {% with page.images.all|get_type:'logo' as images %}
+                    {% if images %}
+                        <div class="page__block{% if block.background_color %} page__block--{{ block.background_color }}{% endif %}">
+                            <div class="white-bg pb2">
+                                <div class="container">
+                                    <div class="row" data-summary-content>
+                                        <div class="col-sm-16">
+                                            <ul class="partners-list">
+                                                {% include 'core/inc/logo.html' %}
+                                            </ul>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    {% endif %}
+                {% endwith %}
+            {% endblock %}
+
+        </div>
+
+    </div>
+
+    <div>
+
+        {% block page_related_content %}
+            {% with dynamic_content=page.dynamic_content_pages.all|filter_content object=page %}
+                {% include "core/inc/related_content.html" %}
+            {% endwith %}
+        {% endblock %}
+
+    </div>
+
+
+{% endblock %}