]> git.parisson.com Git - telecaster-client.git/commitdiff
add random hash to monitoring
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 23 Jan 2023 14:50:47 +0000 (15:50 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 23 Jan 2023 14:50:47 +0000 (15:50 +0100)
telecaster/models.py
telecaster/templates/telecaster/base.html
telecaster/templates/telecaster/index.html
telecaster/templatetags/telecaster_utils.py

index 8896e438d0f7299c00afd6e6ca79d7ab8ea9e7c0..fa4323f306fd3cb86ff344da3a694a91a534ae14 100644 (file)
@@ -40,6 +40,7 @@ import datetime
 import time
 import urllib2
 import liblo
+import random
 
 from mutagen.oggvorbis import OggVorbis
 from mutagen.id3 import ID3, TIT2, TP1, TAL, TDA, TDAT, TDRC, TCO, COM
@@ -60,6 +61,11 @@ app_label = 'telecaster'
 spacer = '_-_'
 
 
+def get_random_hash():
+    hash = random.getrandbits(128)
+    return "%032x" % hash
+
+
 class ShortTextField(models.TextField):
 
     def formfield(self, **kwargs):
index 3b9c8b0ace3c274ee88d0e812ef67a857673caa6..87f57425265fd56f344af47b1b2f7ed144c66eed 100644 (file)
@@ -78,7 +78,7 @@ jQuery(window).ready(function() {
 {% block video %}
 <div class="video">
 <video id="video_1" class="video-js vjs-default-skin" controls autoplay preload="auto" width="360" height="240" data-setup="{}">
-<source src="http://{{ host }}:8000/monitor.webm" type="video/webm">
+<source src="http://{{ host }}:8000/monitor.webm#{% get_random_hash %}" type="video/webm">
 </video>
 </div>
 {% endblock video %}
index 1a1fd2f6facebf1bb8396bdbf46e797fc6ab669a..f75183721c9c37a645b0a6216c707d6dc17a9054 100644 (file)
@@ -59,7 +59,7 @@ server_status_callback();
 {% block video %}
 <div class="video">
 <video id="video_1" class="video-js vjs-default-skin" controls autoplay preload="auto" width="360" height="240" data-setup="{}">
-<source src="http://{{ host }}:8000/monitor.webm" type="video/webm">
+<source src="http://{{ host }}:8000/monitor.webm#{% get_random_hash %}" type="video/webm">
 </video>
 </div>
 {% endblock video %}
index bb309f8eed6c904af1c324728eff159467780d19..349ec40055969547ced0b57d0e23f0e9019492ff 100644 (file)
@@ -15,8 +15,17 @@ from django.conf import settings
 import re
 import datetime
 
+from ..models import get_random_hash
+
 register = template.Library()
 
 @register.filter
 def len(list):
     return len(list)
+
+
+@register.simple_tag(takes_context=True)
+def get_random_hash(context):
+    return get_random_hash()
+
+