Changeset - 5bf63fe046e1
[Not reviewed]
fossy2024
0 2 0
Ben Sturmfels (bsturmfels) - 16 hours ago 2024-09-27 13:00:06
ben@sturm.com.au
Support YouTube videos
2 files changed with 24 insertions and 6 deletions:
0 comments (0 inline, 0 general)
pinaxcon/templates/symposion/schedule/presentation_detail.html
Show inline comments
...
 
@@ -53,19 +53,24 @@
 
      <h2 class="mt-4">Abstract</h4>
 
      {% autoescape off %}
 
      <div class="abstract pb-4"><p>{{ presentation.abstract_html|safe|clean_text|urlize }}</p></div>
 
      {% endautoescape %}
 

	
 
      {% if presentation.videos_split %}
 
        <h2 class="mt-4">Video</h4>
 
        <video controls style="max-width: 640px">
 
          {% for video in presentation.videos_split %}
 
            <source src="{{ video }}">
 
        <h2 class="mt-4">Videos</h4>
 
          {% for v in presentation.youtube_videos %}
 
            <iframe width="560" height="315" src="{{ v }}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
 
          {% endfor %}
 
        </video>
 
        <p style="margin-top: 1rem">Available formats:</p>
 
          {% if v.other_videos %}
 
            <video controls style="max-width: 640px">
 
              {% for video in presentation.other_videos %}
 
                <source src="{{ video }}">
 
              {% endfor %}
 
            </video>
 
          {% endif %}
 
        <p style="margin-top: 1rem">Available sources:</p>
 
        <ul>
 
          {% for video in presentation.videos_split %}
 
            <li>{{ video|urlize }}</li>
 
          {% endfor %}
 
        </ul>
 
      {% endif %}
vendor/symposion/symposion/schedule/models.py
Show inline comments
...
 
@@ -305,12 +305,25 @@ class Presentation(models.Model):
 
    def __str__(self):
 
        return "#%s %s (%s)" % (self.number, self.title, self.speaker)
 

	
 
    def videos_split(self):
 
        return [v.strip() for v in self.videos.split('\n') if v != '']
 

	
 
    def youtube_videos(self):
 
        return [
 
            v.replace('youtu.be', 'www.youtube.com/embed')
 
            for v in self.videos_split()
 
            if 'youtu.be' in v
 
        ]
 

	
 
    def other_videos(self):
 
        return [
 
            v for v in self.videos_split()
 
            if 'youtu.be' not in v
 
        ]
 

	
 
    class Meta:
 
        ordering = ["slot"]
 
        verbose_name = _("presentation")
 
        verbose_name_plural = _("presentations")
 

	
 

	
0 comments (0 inline, 0 general)