mirror of
https://github.com/calibrain/shelfmark.git
synced 2026-10-04 11:51:13 +01:00
Fix local download (#282)
This commit is contained in:
@@ -81,6 +81,12 @@ def queue_status() -> Dict[str, Dict[str, Any]]:
|
||||
Dict: Queue status organized by status type
|
||||
"""
|
||||
status = book_queue.get_status()
|
||||
for _, books in status.items():
|
||||
for _, book_info in books.items():
|
||||
if book_info.download_path:
|
||||
if not os.path.exists(book_info.download_path):
|
||||
book_info.download_path = None
|
||||
|
||||
# Convert Enum keys to strings and properly format the response
|
||||
return {
|
||||
status_type.value: books
|
||||
|
||||
+5
-1
@@ -229,6 +229,10 @@
|
||||
for (const [name, items] of Object.entries(data || {})) {
|
||||
if (!items || Object.keys(items).length === 0) continue;
|
||||
const rows = Object.values(items).map((b) => {
|
||||
const titleText = utils.e(b.title) || '-';
|
||||
const maybeLinkedTitle = b.download_path
|
||||
? `<a href="/request/api/localdownload?id=${encodeURIComponent(b.id)}" class="text-blue-600 hover:underline">${titleText}</a>`
|
||||
: titleText;
|
||||
const actions = (name === 'queued' || name === 'downloading')
|
||||
? `<button class="px-2 py-1 rounded border text-xs" data-cancel="${utils.e(b.id)}" style="border-color: var(--border-muted);">Cancel</button>`
|
||||
: '';
|
||||
@@ -236,7 +240,7 @@
|
||||
? `<div class="h-2 bg-black/10 rounded overflow-hidden"><div class="h-2 bg-blue-600" style="width:${Math.round(b.progress)}%"></div></div>`
|
||||
: '';
|
||||
return `<li class="p-3 rounded border flex flex-col gap-2" style="border-color: var(--border-muted); background: var(--bg-soft)">
|
||||
<div class="text-sm"><span class="opacity-70">${utils.e(name)}</span> • <strong>${utils.e(b.title || '-') }</strong></div>
|
||||
<div class="text-sm"><span class="opacity-70">${utils.e(name)}</span> • <strong>${maybeLinkedTitle}</strong></div>
|
||||
${progress}
|
||||
<div class="flex items-center gap-2">${actions}</div>
|
||||
</li>`;
|
||||
|
||||
Reference in New Issue
Block a user