feat: rename downloaded video files to package name before upload
This commit is contained in:
@@ -942,7 +942,7 @@ def worker(jobid: str):
|
|||||||
if not links:
|
if not links:
|
||||||
with lock:
|
with lock:
|
||||||
job.status = "collecting"
|
job.status = "collecting"
|
||||||
job.message = "Warte auf Link-Crawler\u2026"
|
job.message = "Warte auf Link-Crawler…"
|
||||||
job.progress = 0.0
|
job.progress = 0.0
|
||||||
time.sleep(POLL_SECONDS)
|
time.sleep(POLL_SECONDS)
|
||||||
continue
|
continue
|
||||||
@@ -952,7 +952,7 @@ def worker(jobid: str):
|
|||||||
cancel_msg = cancel_job(dev, jobid)
|
cancel_msg = cancel_job(dev, jobid)
|
||||||
with lock:
|
with lock:
|
||||||
job.status = "failed"
|
job.status = "failed"
|
||||||
base_msg = "JDownloader lieferte das Demo-Video Big Buck Bunny statt des gew\u00fcnschten Links."
|
base_msg = "JDownloader lieferte das Demo-Video Big Buck Bunny statt des gewünschten Links."
|
||||||
job.message = f"{base_msg} {cancel_msg}" if cancel_msg else base_msg
|
job.message = f"{base_msg} {cancel_msg}" if cancel_msg else base_msg
|
||||||
job.progress = 0.0
|
job.progress = 0.0
|
||||||
return
|
return
|
||||||
@@ -963,7 +963,7 @@ def worker(jobid: str):
|
|||||||
with lock:
|
with lock:
|
||||||
job.status = "downloading"
|
job.status = "downloading"
|
||||||
done = sum(1 for l in links if l.get("finished"))
|
done = sum(1 for l in links if l.get("finished"))
|
||||||
job.message = f"Download l\u00e4uft\u2026 ({done}/{len(links)} fertig)"
|
job.message = f"Download läuft… ({done}/{len(links)} fertig)"
|
||||||
job.progress = progress
|
job.progress = progress
|
||||||
time.sleep(POLL_SECONDS)
|
time.sleep(POLL_SECONDS)
|
||||||
continue
|
continue
|
||||||
@@ -982,13 +982,28 @@ def worker(jobid: str):
|
|||||||
if not valid_videos:
|
if not valid_videos:
|
||||||
with lock:
|
with lock:
|
||||||
job.status = "failed"
|
job.status = "failed"
|
||||||
job.message = "ffprobe: keine g\u00fcltige Video-Datei."
|
job.message = "ffprobe: keine gültige Video-Datei."
|
||||||
job.progress = 0.0
|
job.progress = 0.0
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Rename local files to package name before upload
|
||||||
|
pkg_base = sanitize_name(job.package_name) if job.package_name and job.package_name != "WebGUI" else ""
|
||||||
|
if pkg_base:
|
||||||
|
renamed = []
|
||||||
|
for idx, f in enumerate(valid_videos):
|
||||||
|
ext = os.path.splitext(f)[1]
|
||||||
|
suffix = f".part{idx + 1}" if len(valid_videos) > 1 else ""
|
||||||
|
new_path = os.path.join(os.path.dirname(f), f"{pkg_base}{suffix}{ext}")
|
||||||
|
try:
|
||||||
|
os.rename(f, new_path)
|
||||||
|
renamed.append(new_path)
|
||||||
|
except Exception:
|
||||||
|
renamed.append(f)
|
||||||
|
valid_videos = renamed
|
||||||
|
|
||||||
with lock:
|
with lock:
|
||||||
job.status = "upload"
|
job.status = "upload"
|
||||||
job.message = f"Download fertig. MD5/Upload/Verify f\u00fcr {len(valid_videos)} Datei(en)\u2026"
|
job.message = f"Download fertig. MD5/Upload/Verify für {len(valid_videos)} Datei(en)…"
|
||||||
job.progress = 100.0
|
job.progress = 100.0
|
||||||
|
|
||||||
ssh = ssh_connect()
|
ssh = ssh_connect()
|
||||||
@@ -1104,7 +1119,7 @@ def render_page(error: str = "") -> str:
|
|||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="/static/style.css">
|
<link rel="stylesheet" href="/static/style.css">
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>JD \u2192 Jellyfin</title>
|
<title>JD → Jellyfin</title>
|
||||||
<script>
|
<script>
|
||||||
async function refreshJobs() {{
|
async function refreshJobs() {{
|
||||||
if (document.hidden) return;
|
if (document.hidden) return;
|
||||||
@@ -1121,7 +1136,7 @@ def render_page(error: str = "") -> str:
|
|||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>JD \u2192 Jellyfin</h1>
|
<h1>JD → Jellyfin</h1>
|
||||||
{render_nav("downloads")}
|
{render_nav("downloads")}
|
||||||
{err_html}
|
{err_html}
|
||||||
|
|
||||||
@@ -1185,7 +1200,7 @@ def render_logs_page() -> str:
|
|||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="/static/style.css">
|
<link rel="stylesheet" href="/static/style.css">
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>JD \u2192 Jellyfin (Logs)</title>
|
<title>JD → Jellyfin (Logs)</title>
|
||||||
<script>
|
<script>
|
||||||
async function refreshLogs() {{
|
async function refreshLogs() {{
|
||||||
if (document.hidden) return;
|
if (document.hidden) return;
|
||||||
@@ -1206,9 +1221,9 @@ def render_logs_page() -> str:
|
|||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>JD \u2192 Jellyfin</h1>
|
<h1>JD → Jellyfin</h1>
|
||||||
{render_nav("logs")}
|
{render_nav("logs")}
|
||||||
<p class="hint">Verbindungs-Debugger (Echtzeit). Letzte {LOG_BUFFER_LIMIT} Eintr\u00e4ge.</p>
|
<p class="hint">Verbindungs-Debugger (Echtzeit). Letzte {LOG_BUFFER_LIMIT} Einträge.</p>
|
||||||
<textarea id="log-body" class="log-area" rows="20" readonly></textarea>
|
<textarea id="log-body" class="log-area" rows="20" readonly></textarea>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -1229,10 +1244,10 @@ def render_proxies_page(
|
|||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="/static/style.css">
|
<link rel="stylesheet" href="/static/style.css">
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>JD \u2192 Jellyfin (Proxies)</title>
|
<title>JD → Jellyfin (Proxies)</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>JD \u2192 Jellyfin</h1>
|
<h1>JD → Jellyfin</h1>
|
||||||
{render_nav("proxies")}
|
{render_nav("proxies")}
|
||||||
{err_html}
|
{err_html}
|
||||||
{msg_html}
|
{msg_html}
|
||||||
@@ -1252,7 +1267,7 @@ def render_proxies_page(
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h2 style="margin-top:18px;">JDownloader Import-Liste</h2>
|
<h2 style="margin-top:18px;">JDownloader Import-Liste</h2>
|
||||||
<p class="hint">Format: <code>socks5://IP:PORT</code>, <code>socks4://IP:PORT</code>. Keine Pr\u00fcfung/Validierung.</p>
|
<p class="hint">Format: <code>socks5://IP:PORT</code>, <code>socks4://IP:PORT</code>. Keine Prüfung/Validierung.</p>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<textarea id="out" rows="12" readonly style="width:100%; max-width:860px; padding:10px; border:1px solid #ccc; border-radius:8px;">{esc(out_text)}</textarea>
|
<textarea id="out" rows="12" readonly style="width:100%; max-width:860px; padding:10px; border:1px solid #ccc; border-radius:8px;">{esc(out_text)}</textarea>
|
||||||
@@ -1260,8 +1275,8 @@ def render_proxies_page(
|
|||||||
|
|
||||||
<button type="button" onclick="navigator.clipboard.writeText(document.getElementById('out').value)">Kopieren</button>
|
<button type="button" onclick="navigator.clipboard.writeText(document.getElementById('out').value)">Kopieren</button>
|
||||||
|
|
||||||
<h2 style="margin-top:18px;">Datei f\u00fcr Connection Manager</h2>
|
<h2 style="margin-top:18px;">Datei für Connection Manager</h2>
|
||||||
<p class="hint">Speichert die Liste als <code>.jdproxies</code> im Container, z. B. zum Import in JDownloader \u2192 Verbindungsmanager \u2192 Importieren.</p>
|
<p class="hint">Speichert die Liste als <code>.jdproxies</code> im Container, z. B. zum Import in JDownloader → Verbindungsmanager → Importieren.</p>
|
||||||
|
|
||||||
<form method="post" action="/proxies/save">
|
<form method="post" action="/proxies/save">
|
||||||
<textarea name="socks5_in" style="display:none;">{esc(socks5_in)}</textarea>
|
<textarea name="socks5_in" style="display:none;">{esc(socks5_in)}</textarea>
|
||||||
@@ -1337,7 +1352,7 @@ def cancel(jobid: str):
|
|||||||
if job.status in {"finished", "failed", "canceled"}:
|
if job.status in {"finished", "failed", "canceled"}:
|
||||||
return RedirectResponse(url="/", status_code=303)
|
return RedirectResponse(url="/", status_code=303)
|
||||||
job.cancel_requested = True
|
job.cancel_requested = True
|
||||||
job.message = "Abbruch angefordert\u2026"
|
job.message = "Abbruch angefordert…"
|
||||||
return RedirectResponse(url="/", status_code=303)
|
return RedirectResponse(url="/", status_code=303)
|
||||||
|
|
||||||
@app.post("/clear-finished")
|
@app.post("/clear-finished")
|
||||||
|
|||||||
Reference in New Issue
Block a user