Archive Twitch chat badges

This commit is contained in:
Joakim Hellsén 2026-01-16 00:28:25 +01:00
commit 6842581656
No known key found for this signature in database
14 changed files with 1394 additions and 1 deletions

View file

@ -0,0 +1,48 @@
{% extends "base.html" %}
{% block title %}
Chat Badges - ttvdrops
{% endblock title %}
{% block content %}
<h1>Twitch Chat Badges</h1>
<pre>
These are the global chat badges available on Twitch.
</pre>
{% if badge_sets %}
<p>total badge sets: {{ badge_sets.count }}</p>
{% for data in badge_data %}
<hr />
<h2>
<a href="{% url 'twitch:badge_set_detail' set_id=data.set.set_id %}">[{{ data.set.set_id }}]</a>
</h2>
{% for badge in data.badges %}
<table>
<tr>
<td style="width: 40px;">
<a href="{% url 'twitch:badge_set_detail' set_id=data.set.set_id %}">
<img src="{{ badge.image_url_4x }}"
height="36"
width="36"
alt="{{ badge.title }}"
title="{{ badge.description }}" />
</a>
</td>
<td>
<strong>{{ badge.title }}</strong>
<br />
<br />
{{ badge.description }}
</td>
</tr>
</table>
{% endfor %}
<br />
{% if data.badges|length > 1 %}<small>versions: {{ data.badges|length }}</small>{% endif %}
{% endfor %}
<hr />
{% else %}
<p>no badge sets found.</p>
<p>
run: <code>uv run python manage.py import_chat_badges</code>
</p>
{% endif %}
{% endblock content %}

View file

@ -0,0 +1,79 @@
{% extends "base.html" %}
{% block title %}
{{ badge_set.set_id }} Badges - ttvdrops
{% endblock title %}
{% block content %}
<h1>
Badge Set: <strong>{{ badge_set.set_id }}</strong>
</h1>
<p>
<a href="{% url 'twitch:badge_list' %}">Back to all badges</a>
</p>
<ul>
<li>
<strong>Set ID:</strong> {{ badge_set.set_id }}
</li>
<li>
<strong>Total Versions:</strong> {{ badges.count }}
</li>
<li>
<strong>Added:</strong> {{ badge_set.added_at|date:"Y-m-d H:i:s T" }}
</li>
<li>
<strong>Updated:</strong> {{ badge_set.updated_at|date:"Y-m-d H:i:s T" }}
</li>
</ul>
{% if badges %}
<h2>Badge Versions ({{ badges.count }})</h2>
<table>
<thead>
<tr>
<th>ID</th>
<th>Preview</th>
<th>Title</th>
<th>Description</th>
<th>Images</th>
<th>Action</th>
</tr>
</thead>
<tbody>
{% for badge in badges %}
<tr>
<td>
<code>{{ badge.badge_id }}</code>
</td>
<td>
<img src="{{ badge.image_url_4x }}"
height="72"
width="72"
alt="{{ badge.title }}"
title="{{ badge.description }}"
style="width: 72px !important;
height: 72px !important;
object-fit: contain" />
</td>
<td>
<strong>{{ badge.title }}</strong>
</td>
<td>{{ badge.description }}</td>
<td style="font-size: 0.85em">
<a href="{{ badge.image_url_1x }}" target="_blank">18px</a> |
<a href="{{ badge.image_url_2x }}" target="_blank">36px</a> |
<a href="{{ badge.image_url_4x }}" target="_blank">72px</a>
</td>
<td>
{% if badge.click_url %}
<a href="{{ badge.click_url }}" target="_blank" rel="noopener">{{ badge.click_action|default:"visit_url" }}</a>
{% else %}
<em>None</em>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No badges found in this set.</p>
{% endif %}
{{ set_data|safe }}
{% endblock content %}

View file

@ -5,7 +5,7 @@
{% block content %}
<div class="container" id="search-results-container">
<h1 id="page-title">Search Results for "{{ query }}"</h1>
{% if not results.organizations and not results.games and not results.campaigns and not results.drops and not results.benefits and not results.reward_campaigns %}
{% if not results.organizations and not results.games and not results.campaigns and not results.drops and not results.benefits and not results.reward_campaigns and not results.badge_sets and not results.badges %}
<p id="no-results">No results found.</p>
{% else %}
{% if results.organizations %}
@ -82,6 +82,27 @@
{% endfor %}
</ul>
{% endif %}
{% if results.badge_sets %}
<h2 id="badge-sets-header">Badge Sets</h2>
<ul id="badge-sets-list">
{% for badge_set in results.badge_sets %}
<li id="badge-set-{{ badge_set.set_id }}">
<a href="{% url 'twitch:badge_set_detail' set_id=badge_set.set_id %}">{{ badge_set.set_id }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% if results.badges %}
<h2 id="badges-header">Chat Badges</h2>
<ul id="badges-list">
{% for badge in results.badges %}
<li id="badge-{{ badge.badge_set.set_id }}-{{ badge.badge_id }}">
<a href="{% url 'twitch:badge_set_detail' set_id=badge.badge_set.set_id %}">{{ badge.title }}</a>
<small>({{ badge.badge_set.set_id }}/{{ badge.badge_id }})</small>
</li>
{% endfor %}
</ul>
{% endif %}
{% endif %}
</div>
{% endblock content %}