From: Guillaume Pellerin Date: Mon, 23 Jan 2023 14:50:47 +0000 (+0100) Subject: add random hash to monitoring X-Git-Tag: 1.0^2~2 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=ef17c2e2927219df5010c21c749e7ea568c5122b;p=telecaster-client.git add random hash to monitoring --- diff --git a/telecaster/models.py b/telecaster/models.py index 8896e43..fa4323f 100644 --- a/telecaster/models.py +++ b/telecaster/models.py @@ -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): diff --git a/telecaster/templates/telecaster/base.html b/telecaster/templates/telecaster/base.html index 3b9c8b0..87f5742 100644 --- a/telecaster/templates/telecaster/base.html +++ b/telecaster/templates/telecaster/base.html @@ -78,7 +78,7 @@ jQuery(window).ready(function() { {% block video %}
{% endblock video %} diff --git a/telecaster/templates/telecaster/index.html b/telecaster/templates/telecaster/index.html index 1a1fd2f..f751837 100644 --- a/telecaster/templates/telecaster/index.html +++ b/telecaster/templates/telecaster/index.html @@ -59,7 +59,7 @@ server_status_callback(); {% block video %}
{% endblock video %} diff --git a/telecaster/templatetags/telecaster_utils.py b/telecaster/templatetags/telecaster_utils.py index bb309f8..349ec40 100644 --- a/telecaster/templatetags/telecaster_utils.py +++ b/telecaster/templatetags/telecaster_utils.py @@ -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() + +