Spaces:
Paused
Paused
Upload 20 files
Browse files- app.py +28 -25
- static/app.js +12 -11
app.py
CHANGED
|
@@ -350,26 +350,26 @@ def add_event(state: dict, level: str, message: str) -> None:
|
|
| 350 |
state["events"] = state["events"][:MAX_EVENTS]
|
| 351 |
|
| 352 |
|
| 353 |
-
def state_label(raw_state: str) -> str:
|
| 354 |
-
mapping = {
|
| 355 |
-
"downloading": "Downloading",
|
| 356 |
-
"stalledDL": "Stalled",
|
| 357 |
-
"metaDL": "Fetching Metadata",
|
| 358 |
-
"pausedDL": "Paused",
|
| 359 |
-
"pausedUP": "Paused",
|
| 360 |
-
"uploading": "Seeding",
|
| 361 |
-
"stalledUP": "
|
| 362 |
-
"queuedDL": "Queued",
|
| 363 |
-
"queuedUP": "Queued",
|
| 364 |
-
"checkingUP": "Checking",
|
| 365 |
-
"checkingDL": "Checking",
|
| 366 |
-
"forcedDL": "Forced Download",
|
| 367 |
-
"forcedMetaDL": "Forced Metadata",
|
| 368 |
-
"forcedUP": "
|
| 369 |
-
"error": "Error",
|
| 370 |
-
"missingFiles": "Missing Files",
|
| 371 |
-
}
|
| 372 |
-
return mapping.get(raw_state, raw_state)
|
| 373 |
|
| 374 |
|
| 375 |
def status_badge(raw_state: str) -> str:
|
|
@@ -401,13 +401,13 @@ def effective_state_label(torrent, state_entry: dict | None = None) -> str:
|
|
| 401 |
if raw_state in {"uploading", "forcedUP"}:
|
| 402 |
return "Seeding"
|
| 403 |
if raw_state == "stalledUP":
|
| 404 |
-
return "
|
| 405 |
if raw_state == "pausedUP":
|
| 406 |
return "Paused"
|
| 407 |
if raw_state == "queuedUP":
|
| 408 |
-
return "Queued"
|
| 409 |
if raw_state == "checkingUP":
|
| 410 |
-
return "Checking"
|
| 411 |
|
| 412 |
return state_label(raw_state)
|
| 413 |
|
|
@@ -427,11 +427,14 @@ def effective_status_badge(torrent, state_entry: dict | None = None) -> str:
|
|
| 427 |
progress = float(getattr(torrent, "progress", 0) or 0)
|
| 428 |
upspeed = int(getattr(torrent, "upspeed", 0) or 0)
|
| 429 |
|
| 430 |
-
if progress >= 1 and raw_state in {"uploading", "forcedUP"
|
| 431 |
-
if upspeed > 0
|
| 432 |
return "border-sky-500/30 bg-sky-500/10 text-sky-100"
|
| 433 |
return "border-lime/30 bg-lime/10 text-lime"
|
| 434 |
|
|
|
|
|
|
|
|
|
|
| 435 |
return status_badge(raw_state)
|
| 436 |
|
| 437 |
|
|
|
|
| 350 |
state["events"] = state["events"][:MAX_EVENTS]
|
| 351 |
|
| 352 |
|
| 353 |
+
def state_label(raw_state: str) -> str:
|
| 354 |
+
mapping = {
|
| 355 |
+
"downloading": "Downloading",
|
| 356 |
+
"stalledDL": "Stalled",
|
| 357 |
+
"metaDL": "Fetching Metadata",
|
| 358 |
+
"pausedDL": "Paused",
|
| 359 |
+
"pausedUP": "Paused",
|
| 360 |
+
"uploading": "Seeding",
|
| 361 |
+
"stalledUP": "Stalled Up",
|
| 362 |
+
"queuedDL": "Queued",
|
| 363 |
+
"queuedUP": "Queued Up",
|
| 364 |
+
"checkingUP": "Checking",
|
| 365 |
+
"checkingDL": "Checking",
|
| 366 |
+
"forcedDL": "Forced Download",
|
| 367 |
+
"forcedMetaDL": "Forced Metadata",
|
| 368 |
+
"forcedUP": "Seeding",
|
| 369 |
+
"error": "Error",
|
| 370 |
+
"missingFiles": "Missing Files",
|
| 371 |
+
}
|
| 372 |
+
return mapping.get(raw_state, raw_state)
|
| 373 |
|
| 374 |
|
| 375 |
def status_badge(raw_state: str) -> str:
|
|
|
|
| 401 |
if raw_state in {"uploading", "forcedUP"}:
|
| 402 |
return "Seeding"
|
| 403 |
if raw_state == "stalledUP":
|
| 404 |
+
return "Stalled Up"
|
| 405 |
if raw_state == "pausedUP":
|
| 406 |
return "Paused"
|
| 407 |
if raw_state == "queuedUP":
|
| 408 |
+
return "Queued Up"
|
| 409 |
if raw_state == "checkingUP":
|
| 410 |
+
return "Checking Up"
|
| 411 |
|
| 412 |
return state_label(raw_state)
|
| 413 |
|
|
|
|
| 427 |
progress = float(getattr(torrent, "progress", 0) or 0)
|
| 428 |
upspeed = int(getattr(torrent, "upspeed", 0) or 0)
|
| 429 |
|
| 430 |
+
if progress >= 1 and raw_state in {"uploading", "forcedUP"}:
|
| 431 |
+
if upspeed > 0:
|
| 432 |
return "border-sky-500/30 bg-sky-500/10 text-sky-100"
|
| 433 |
return "border-lime/30 bg-lime/10 text-lime"
|
| 434 |
|
| 435 |
+
if progress >= 1 and raw_state == "stalledUP":
|
| 436 |
+
return "border-amber-500/30 bg-amber-500/10 text-amber-100"
|
| 437 |
+
|
| 438 |
return status_badge(raw_state)
|
| 439 |
|
| 440 |
|
static/app.js
CHANGED
|
@@ -113,6 +113,16 @@
|
|
| 113 |
}
|
| 114 |
|
| 115 |
const label = normalizeStateLabel(torrent.state_label);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
if (label.includes("download")) {
|
| 117 |
return {
|
| 118 |
dotClass: "bg-neon",
|
|
@@ -551,17 +561,9 @@
|
|
| 551 |
const endpointMeta = torrent.gofile_endpoint
|
| 552 |
? `<span class="rounded-full border border-white/10 bg-white/[0.04] px-2 py-1 font-mono text-[10px] uppercase tracking-[0.2em] text-stone-400">${escapeHtml(torrent.gofile_endpoint)}</span>`
|
| 553 |
: "";
|
| 554 |
-
const
|
| 555 |
? "fa-cloud-arrow-up"
|
| 556 |
-
:
|
| 557 |
-
? "fa-arrow-up"
|
| 558 |
-
: "fa-arrow-down";
|
| 559 |
-
const activeSpeed = torrent.display_speed && torrent.display_speed !== "-"
|
| 560 |
-
? `<span class="inline-flex items-center gap-2 whitespace-nowrap text-sm font-semibold ${tone.text}"><i class="fa-solid ${speedIcon} shrink-0 text-[11px]"></i><span class="whitespace-nowrap">${escapeHtml(torrent.display_speed_label || "Speed")}</span><span class="whitespace-nowrap font-mono">${escapeHtml(torrent.display_speed)}</span></span>`
|
| 561 |
-
: "";
|
| 562 |
-
const statusIconName = torrent.gofile_uploading
|
| 563 |
-
? "fa-cloud-arrow-up"
|
| 564 |
-
: isSeeding
|
| 565 |
? "fa-arrow-up"
|
| 566 |
: isDownloading
|
| 567 |
? "fa-arrow-down"
|
|
@@ -601,7 +603,6 @@
|
|
| 601 |
<span class="h-2 w-2 shrink-0 rounded-full ${tone.dotClass || ""}" style="${tone.dotStyle || ""}"></span>
|
| 602 |
<span class="leading-none">${escapeHtml(tone.label)}</span>
|
| 603 |
</span>
|
| 604 |
-
${activeSpeed ? `<span class="inline-flex min-h-[2.25rem] items-center justify-center rounded-full px-3 py-1.5 text-xs ${tone.pillClass} whitespace-nowrap" style="background-color: rgba(10, 14, 22, 0.62); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);">${activeSpeed}</span>` : ""}
|
| 605 |
${endpointMeta}
|
| 606 |
</div>
|
| 607 |
</div>
|
|
|
|
| 113 |
}
|
| 114 |
|
| 115 |
const label = normalizeStateLabel(torrent.state_label);
|
| 116 |
+
if (label.includes("stalled up")) {
|
| 117 |
+
return {
|
| 118 |
+
dotClass: "bg-amber",
|
| 119 |
+
dotStyle: "background-color: #f7c84b;",
|
| 120 |
+
text: "text-amber",
|
| 121 |
+
pillClass: "text-amber-100",
|
| 122 |
+
pillStyle: "background-color: rgba(247, 200, 75, 0.18); box-shadow: inset 0 0 0 1px rgba(247, 200, 75, 0.22);",
|
| 123 |
+
label: torrent.state_label || "Stalled Up",
|
| 124 |
+
};
|
| 125 |
+
}
|
| 126 |
if (label.includes("download")) {
|
| 127 |
return {
|
| 128 |
dotClass: "bg-neon",
|
|
|
|
| 561 |
const endpointMeta = torrent.gofile_endpoint
|
| 562 |
? `<span class="rounded-full border border-white/10 bg-white/[0.04] px-2 py-1 font-mono text-[10px] uppercase tracking-[0.2em] text-stone-400">${escapeHtml(torrent.gofile_endpoint)}</span>`
|
| 563 |
: "";
|
| 564 |
+
const statusIconName = torrent.gofile_uploading
|
| 565 |
? "fa-cloud-arrow-up"
|
| 566 |
+
: isSeeding
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 567 |
? "fa-arrow-up"
|
| 568 |
: isDownloading
|
| 569 |
? "fa-arrow-down"
|
|
|
|
| 603 |
<span class="h-2 w-2 shrink-0 rounded-full ${tone.dotClass || ""}" style="${tone.dotStyle || ""}"></span>
|
| 604 |
<span class="leading-none">${escapeHtml(tone.label)}</span>
|
| 605 |
</span>
|
|
|
|
| 606 |
${endpointMeta}
|
| 607 |
</div>
|
| 608 |
</div>
|