Implement dataset functionality with views, URLs, and management command

This commit is contained in:
Joakim Hellsén 2026-02-10 16:47:54 +01:00
commit a12b34a665
Signed by: Joakim Hellsén
SSH key fingerprint: SHA256:/9h/CsExpFp+PRhsfA0xznFx2CGfTT5R/kpuFfUgEQk
12 changed files with 812 additions and 51 deletions

View file

@ -155,6 +155,7 @@
</style>
</head>
<body>
<h1 style="margin-top: 0.5em; margin-bottom: 0.5em; ">ttvdrops</h1>
<strong>Twitch:</strong>
<a href="{% url 'twitch:dashboard' %}">Dashboard</a> |
<a href="{% url 'twitch:campaign_list' %}">Campaigns</a> |
@ -165,11 +166,14 @@
<a href="{% url 'twitch:badge_list' %}">Badges</a> |
<a href="{% url 'twitch:emote_gallery' %}">Emotes</a>
<br />
<a href="{% url 'twitch:docs_rss' %}">RSS</a> | <a href="{% url 'twitch:debug' %}">Debug</a>
<form action="{% url 'twitch:search' %}"
method="get"
style="display: inline;
margin-left: 1rem">
<strong>Other:</strong>
<a href="{% url 'twitch:docs_rss' %}">RSS</a> |
<a href="{% url 'twitch:debug' %}">Debug</a> |
<a href="{% url 'twitch:dataset_backups' %}">Dataset</a> |
<a href="https://github.com/sponsors/TheLovinator1">Donate</a> |
<a href="https://github.com/TheLovinator1/ttvdrops">GitHub</a>
<br />
<form action="{% url 'twitch:search' %}" method="get">
<input type="search"
name="q"
placeholder="Search..."

View file

@ -0,0 +1,48 @@
{% extends "base.html" %}
{% block title %}
Dataset Backups
{% endblock title %}
{% block content %}
<main>
<h1 id="page-title">Dataset Backups</h1>
<p>Scanning {{ data_dir }} for database backups.</p>
{% if datasets %}
<table>
<thead>
<tr>
<th>Name</th>
<th>Path</th>
<th>Size</th>
<th>Updated</th>
<th>Download</th>
</tr>
</thead>
<tbody>
{% for dataset in datasets %}
<tr id="dataset-row-{{ forloop.counter }}">
<td>{{ dataset.name }}</td>
<td>{{ dataset.display_path }}</td>
<td>{{ dataset.size }}</td>
<td>
<time datetime="{{ dataset.updated_at|date:'c' }}"
title="{{ dataset.updated_at|date:'DATETIME_FORMAT' }}">
{{ dataset.updated_at|timesince }} ago
</time>
</td>
<td>
{% if dataset.download_path %}
<a href="{% url 'twitch:dataset_backup_download' dataset.download_path %}">Download</a>
{% else %}
-
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<p>Found {{ dataset_count }} datasets.</p>
{% else %}
<p>No dataset backups found.</p>
{% endif %}
</main>
{% endblock content %}