]> git.0d.be Git - panikweb.git/blobdiff - panikweb/templates/includes/audio.html
move static & templates to panikweb project directory
[panikweb.git] / panikweb / templates / includes / audio.html
diff --git a/panikweb/templates/includes/audio.html b/panikweb/templates/includes/audio.html
new file mode 100644 (file)
index 0000000..673452d
--- /dev/null
@@ -0,0 +1,84 @@
+{% load soundfiles paniktags i18n %}
+{% if sound|is_format_available:'mp3' or sound|is_format_available:'ogg' %}
+       <div class="audio" data-sound-id="{{ sound.id }}">
+               {% if not embed %}
+               <button class="resymbol icon-plus-sign big"
+                       title="{% trans "Add to playlist" %}"
+                       data-sound-id="{{ sound.id }}"
+                       data-player-audio="Audio-{{ sound.file.url|slugify }}" 
+                       data-player-action="registerAudio" 
+                       ><span class="sr-only">{% trans "Add to playlist" %}</span></button>
+               {% endif %}
+               <button class="resymbol icon-play-sign big"
+                       title="{% trans "Play" %}"
+                       data-sound-id="{{ sound.id }}"
+                       data-player-action="playAudio" 
+                       ><span class="sr-only">{% trans "Play" %}</span></button>
+               {% if embed %}
+               <button class="icons icon-pause big"
+                       title="{% trans "Pause" %}"
+                       style="display: none;"
+                       data-sound-id="{{ sound.id }}"
+                       data-player-action="pauseSounds" 
+                       ><span class="sr-only">{% trans "Pause" %}</span></button>
+               {% endif %}
+               <button class="resymbol icon-download big"
+                       title="{% trans "Download file" %}"
+                       onclick="$(this).next().toggleClass('hidden-download-links');return false;"
+                       ><span class="sr-only">{% trans "Download file" %}</span></button>
+               <div class="download-links hidden-download-links">
+                       {% if sound|is_format_available:'ogg' %}
+                       <a target="_blank" rel="noopener" class="button inBlock" href="{{ sound|format_url:'ogg' }}">
+                               <span class="icon-file">&nbsp;ogg</span>
+                       </a>
+                       {% endif %}
+                       {% if sound|is_format_available:'mp3' %}
+                       <a target="_blank" rel="noopener" class="button inBlock" href="{{ sound|format_url:'mp3' }}">
+                               <span class="icon-file">&nbsp;mp3</span>
+                       </a>
+                       {% endif %}
+               </div>
+               {% if not embed %}
+               <button class="icon-share icons big"
+                       title="{% trans "Embed" %}"
+                       data-popup-href="{% url 'soundfile-dialog-embed-view' emission_slug=sound.episode.emission.slug episode_slug=sound.episode.slug pk=sound.pk %}"
+                       ><span class="sr-only">{% trans "Embed" %}</span></button>
+               {% endif %}
+       </div>
+       {% if display_fragment_name %}
+       <div class="fragment-name">
+               {{ sound.title }}
+       </div>
+       {% endif %}
+       <audio
+               data-player='true'
+               class='hidden'
+               data-url="{% url 'episode-view' emission_slug=sound.episode.emission.slug slug=sound.episode.slug %}"
+               data-sound-id="{{ sound.id }}"
+               {% if sound.fragment and sound.title %}title="{{ sound.title }}"
+               {% else %}title="{{sound.episode.title}}"{% endif %}
+               preload="{% if preload %}{{ preload }}{% else %}none{% endif %}"
+               controls="{% if controls %}{{ controls }}{% else %}controls{% endif%}"
+               >
+               {% if sound|is_format_available:'ogg' %}
+                       <source src="{{ sound|format_url:'ogg' }}" type="audio/ogg">
+               {% endif %}
+               {% if sound|is_format_available:'mp3' %}
+                       <source src="{{ sound|format_url:'mp3' }}" type="audio/mpeg">
+               {% endif %}
+               <div class="alternative padded">
+                       <div class="info smooth">Your browser can't play audio files</div>
+                       <strong>Download: </strong>
+                       {% if sound|is_format_available:'ogg' %}
+                               <a class="icon-headphones" href="{{ sound|format_url:'ogg' }}"> ogg</a>
+                       {% endif %}
+                       {% if sound|is_format_available:'mp3' %}
+                               <a class="icon-headphones" href="{{ sound|format_url:'mp3' }}"> mp3</a>
+                       {% endif %}
+               </div>
+       </audio>
+       <div class="waveform" data-sound-id="{{ sound.id }}" data-duration="{{ sound.duration }}"
+               data-duration-string="{{ sound.get_duration_string }}"></div>
+{% else %}
+       <div class="hidden error">No sound available!</div>
+{% endif%}