diff --git a/playlist/models/track.py b/playlist/models/track.py index fb44a33..af120d6 100644 --- a/playlist/models/track.py +++ b/playlist/models/track.py @@ -12,7 +12,7 @@ class Track(models.Model): s = f"'{self.name}'" if self.artists.count() > 0: artists = list(map(lambda a:a.name, self.artists.all())) - s += " by " + s += " door " s += " & ".join(artists) return s id = models.CharField(primary_key=True, max_length=128) diff --git a/playlist/static/img/draakje/draakje-headphones.gif b/playlist/static/img/draakje/draakje-headphones.gif new file mode 100644 index 0000000..b997080 Binary files /dev/null and b/playlist/static/img/draakje/draakje-headphones.gif differ diff --git a/playlist/static/img/draakje/draakje-headphones2.gif b/playlist/static/img/draakje/draakje-headphones2.gif new file mode 100644 index 0000000..ce5a507 Binary files /dev/null and b/playlist/static/img/draakje/draakje-headphones2.gif differ diff --git a/playlist/static/img/draakje/draakje-headphones3.gif b/playlist/static/img/draakje/draakje-headphones3.gif new file mode 100644 index 0000000..260eda6 Binary files /dev/null and b/playlist/static/img/draakje/draakje-headphones3.gif differ diff --git a/playlist/static/img/draakje/draakje-waiting.gif b/playlist/static/img/draakje/draakje-waiting.gif new file mode 100644 index 0000000..03a57c1 Binary files /dev/null and b/playlist/static/img/draakje/draakje-waiting.gif differ diff --git a/playlist/static/style.css b/playlist/static/style.css new file mode 100644 index 0000000..10f0b01 --- /dev/null +++ b/playlist/static/style.css @@ -0,0 +1,12 @@ +.popup { + position: fixed; + z-index:99; + min-width: 380px; + max-width:540px; + resize: both; + overflow-y:scroll; + overflow-x:visible; + display: flex; + flex-flow: column nowrap; + justify-content: space-between; +} diff --git a/playlist/tasks.py b/playlist/tasks.py index 254957b..92456a0 100644 --- a/playlist/tasks.py +++ b/playlist/tasks.py @@ -17,7 +17,6 @@ def get_banter(id): track = Track.objects.get(pk=id) r = requests.post( os.getenv('AI_ENDPOINT'), - #'http://localhost:11434/api/generate', json={ 'model': os.getenv('AI_MODEL'), 'prompt': str(track) @@ -41,18 +40,3 @@ def get_banter(id): track.banter_done = True track.save() return body['context'] -@shared_task -def get_banter_test(id): - letters = ["a","b","c","d","e","q","w", " "] - track = Track.objects.get(pk=id) - time.sleep(20) - track.banter = "Lorem " - track.save() - time.sleep(.5) - - for i in range(100): - track.banter += choice(letters) - track.save() - time.sleep(.3) - track.banter_done = True - track.save() diff --git a/playlist/templates/Banter.html b/playlist/templates/Banter.html index 365efba..4cb3b6e 100644 --- a/playlist/templates/Banter.html +++ b/playlist/templates/Banter.html @@ -1,14 +1,13 @@ +{% load static %}
- {% if track.banter != "" %} - {{track.banter}} - {% else %} - {{ waiting | random }} - {% endif %} + {% include "Popup.html" with body=track.banter title=track img="img/draakje/draakje-headphones3.gif" %} +
diff --git a/playlist/templates/Base.html b/playlist/templates/Base.html index dddb075..0262f77 100644 --- a/playlist/templates/Base.html +++ b/playlist/templates/Base.html @@ -1,21 +1,52 @@ {% load static %} + + + + + + - +
- -

{% block page-name %}Muzak{% endblock %}

- {% block main-content %}{% endblock %}
+ +
+
+
+ {% block window-title %}{% endblock %} +
+
+ + +
+
+
+ +
  • + Stemmen +
  • +
  • + Nomineren +
  • +
  • + Statistieken +
  • +
    +
    +
    + {% block main-content %}{% endblock %} +
    +
    + {% block popup %}{% endblock %} + +
    diff --git a/playlist/templates/Nominate.html b/playlist/templates/Nominate.html index e9a5df3..196af88 100644 --- a/playlist/templates/Nominate.html +++ b/playlist/templates/Nominate.html @@ -1,7 +1,10 @@ {% extends "Base.html" %} +{% block window-title %} +Nomineren +{% endblock %} + {% block main-content %} -

    Nominate

    {% if warning %}
    {{warning}}
    {% endif %} @@ -14,7 +17,6 @@ {% if nominated %} -
    {% if error %}❌{% else %}✅{% endif %} {{nominated}}
    {% include "Banter.html" with track=nominated %} {% endif %} {% endblock %} diff --git a/playlist/templates/Popup.html b/playlist/templates/Popup.html new file mode 100644 index 0000000..548d590 --- /dev/null +++ b/playlist/templates/Popup.html @@ -0,0 +1,31 @@ +{% load static %} + + diff --git a/playlist/templates/SpotifyEmbed.html b/playlist/templates/SpotifyEmbed.html index 12794d4..bd9e5a5 100644 --- a/playlist/templates/SpotifyEmbed.html +++ b/playlist/templates/SpotifyEmbed.html @@ -2,30 +2,45 @@
    {% if error %}
    {{ error }}
    {% endif %} -
    - - - - - +
    +
    + Dit vind ik een leuk nummer! + + + + + +
    + {% if track.banter %} + {% block popup %} + {% include "Popup.html" with body=track.banter title=track img="img/draakje/draakje-headphones3.gif" %} + {% endblock %} + {% endif %}
    {% else %}

    diff --git a/playlist/templates/Vote.html b/playlist/templates/Vote.html index 98854e8..8df201a 100644 --- a/playlist/templates/Vote.html +++ b/playlist/templates/Vote.html @@ -1,7 +1,10 @@ {% extends "Base.html" %} +{% block window-title %} +Stemmen +{% endblock %} + {% block main-content %} -

    Lekker stemmen

    Laden...