Files
AudioBookRequest/templates/sources.html
T
2025-02-21 12:31:44 +01:00

91 lines
2.7 KiB
HTML

{% extends "base.html" %} {% block head %}
<title>Sources</title>
<script>
const onDownload = (index, path) => {
const checkbox = document.getElementById(`checkbox-${index}`);
checkbox.disabled = true;
fetch(path, {
method: "POST",
}).then(resp => {
if (resp.ok) {
window.location.href = "/wishlist";
}
});
};
</script>
{% endblock %} {% block body %}
<div class="w-screen p-2 md:p-4 lg:p-8 flex flex-col gap-2">
<a href="/wishlist#{{ book.asin|quote_plus }}" class="w-fit btn btn-ghost">
&lt; Back to wishlist
</a>
<h1 class="text-3xl font-bold">Sources for {{ book.title }}</h1>
{% if not sources %}
<div role="alert" class="alert">
<span class="stroke-info h-6 w-6 shrink-0">
{% include 'icons/info-circle.html' %}
</span>
<span
>No results found for "{{ book.title }}" by {{book.authors|join(",")}}.
Might have to be looked up manually.</span
>
</div>
{% endif %}
<div class="overflow-x-auto">
<table class="table table-zebra table-pin-rows min-w-[60rem]">
<thead>
<tr>
<th></th>
<th>title</th>
<th>indexer</th>
<th>flags</th>
<th>seed / leech</th>
<th>size (MB)</th>
<th>publish date</th>
<th></th>
</tr>
</thead>
<tbody>
{% for source in sources %}
<tr
class="text-xs lg:text-sm {% if loop.index==1 %}bg-success{% endif %}"
>
<th>{{ loop.index }}</th>
<td>
<a href="{{ source.info_url }}" class="link">{{ source.title }}</a>
</td>
<td>{{ indexers[source.indexer_id].name }}</td>
<td>{{ source.indexer_flags|join(', ') }}</td>
<td>{{ source.seeders }} / {{ source.leechers }}</td>
<td>{{ source.size_MB }}</td>
<td>{{ source.publish_date.strftime("%d. %b %Y") }}</td>
<td>
<label
id="form-{{ loop.index }}"
class="swap swap-flip"
title="Send to download client"
>
<input
id="checkbox-{{ loop.index }}"
type="checkbox"
onclick="onDownload('{{ loop.index }}','/wishlist/sources/{{ book.asin|quote_plus }}?indexer_id={{ source.indexer_id }}&guid={{ source.guid|quote_plus }}')"
/>
<span class="swap-off">
{% include 'icons/download.html' %}
</span>
<span class="swap-on text-success">
{% include 'icons/checkmark.html' %}
</span>
</label>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}