diff --git a/patches/reclip/app.py b/patches/reclip/app.py
index 3c3c9c8..1dfbbd0 100644
--- a/patches/reclip/app.py
+++ b/patches/reclip/app.py
@@ -3,6 +3,7 @@ import uuid
import glob
import json
import re
+import hashlib
import subprocess
import threading
import time
@@ -56,6 +57,7 @@ def record_history(job):
"job_id": job.get("job_id"),
"url": job.get("url", ""),
"title": job.get("title", ""),
+ "thumbnail": job.get("thumbnail", ""),
"filename": job.get("filename", ""),
"file": job.get("file", ""),
"transcript": job.get("transcript") or "",
@@ -67,6 +69,44 @@ def record_history(job):
save_history(history[:200])
+MEDIA_EXTS = (".mp4", ".mkv", ".webm", ".m4a", ".mp3", ".flac", ".mov", ".avi", ".wav", ".ts")
+
+
+def backfill_history():
+ """Add on-disk downloads that predate history.json (or were dropped into
+ the downloads dir manually) so the whole library shows up on the page.
+ The transcript flag is resolved live at read time, so backfilled entries
+ pick up manual yt-transcribe sidecars automatically."""
+ for name in sorted(os.listdir(DOWNLOAD_DIR)):
+ path = os.path.join(DOWNLOAD_DIR, name)
+ if not os.path.isfile(path) or not name.lower().endswith(MEDIA_EXTS):
+ continue
+ with _history_lock:
+ history = load_history()
+ if any(h.get("file") == path for h in history):
+ continue
+ stem = os.path.splitext(name)[0]
+ # a 10-hex stem is a reclip job id — the real title wasn't kept
+ title = "" if re.fullmatch(r"[0-9a-f]{10}", stem) else stem
+ history.insert(0, {
+ "job_id": hashlib.sha1(path.encode()).hexdigest()[:10],
+ "url": "",
+ "title": title,
+ "filename": name,
+ "file": path,
+ "transcript": "",
+ "transcript_name": "",
+ "has_transcript": False,
+ "size": os.path.getsize(path),
+ "date": time.strftime("%Y-%m-%d %H:%M:%S",
+ time.localtime(os.path.getmtime(path))),
+ })
+ save_history(history[:200])
+
+
+backfill_history()
+
+
def parse_ytdlp_json(stdout):
"""Parse yt-dlp JSON output.
@@ -282,7 +322,8 @@ def start_download():
return jsonify({"error": "No URL provided"}), 400
job_id = uuid.uuid4().hex[:10]
- jobs[job_id] = {"job_id": job_id, "status": "downloading", "url": url, "title": title}
+ jobs[job_id] = {"job_id": job_id, "status": "downloading", "url": url, "title": title,
+ "thumbnail": (data.get("thumbnail") or "")[:500]}
thread = threading.Thread(target=run_download, args=(job_id, url, format_choice, format_id))
thread.daemon = True
diff --git a/patches/reclip/index.html b/patches/reclip/index.html
index 9017db6..4807aa1 100644
--- a/patches/reclip/index.html
+++ b/patches/reclip/index.html
@@ -343,41 +343,16 @@
.dl-all-btn:hover { background: #2d2d2a; }
.dl-all-btn:disabled { opacity: 0.4; cursor: not-allowed; }
- /* History */
+ /* History — same card language as the fetch results */
.hist-h {
font-family: 'Instrument Serif', serif;
- font-size: 1.4rem;
+ font-size: 1.9rem;
font-weight: 400;
- margin: 32px 0 10px;
+ letter-spacing: -0.02em;
+ margin: 44px 0 14px;
color: var(--fg);
}
- .hist-row {
- display: flex;
- gap: 10px;
- align-items: center;
- border: 1.5px solid var(--card-border);
- border-radius: 10px;
- background: var(--card);
- padding: 10px 12px;
- margin-bottom: 6px;
- }
- .hist-main { flex: 1; min-width: 0; }
- .hist-title {
- font-size: 0.8rem;
- color: var(--fg);
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .hist-meta {
- font-size: 0.65rem;
- color: var(--muted);
- text-transform: uppercase;
- letter-spacing: 0.03em;
- margin-top: 2px;
- }
- .hist-meta .t-flag { color: var(--success); }
- .hist-actions { display: flex; gap: 6px; }
+ #history .card { animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
a.card-dl-btn { text-decoration: none; display: inline-block; }
.spin {
@@ -673,6 +648,7 @@
format: currentFormat,
format_id: c.selectedFormatId,
title: c.title || '',
+ thumbnail: c.thumbnail || '',
}),
});
const data = await res.json();
@@ -763,17 +739,29 @@
const rows = await res.json();
const box = document.getElementById('history');
if (!Array.isArray(rows) || !rows.length) return;
- const items = rows.map(r => `
-
-
-
${esc(r.title || r.filename || r.url || '')}
-
${esc(r.date || '')}${r.size ? ' · ' + fmtSize(r.size) : ''} · ${r.has_transcript ? 'transcript ✓' : 'no transcript'}
+ const items = rows.map(r => {
+ let thumbHtml;
+ if (r.thumbnail) {
+ thumbHtml = `

`;
+ } else {
+ thumbHtml = `
`;
+ }
+ const flag = r.has_transcript
+ ? `
transcript ✓`
+ : `
no transcript`;
+ return `
+
+
${thumbHtml}
+
+
${esc(r.title || r.filename || r.url || 'Untitled')}
+
${esc(r.date || '')}${r.size ? ' · ' + fmtSize(r.size) : ''} · ${r.has_transcript ? 'transcript ✓' : 'no transcript'}
+
-
-
`).join('');
+
`;
+ }).join('');
box.innerHTML = `
History
${items}`;
} catch { /* history unavailable */ }
}
diff --git a/patches/reclip/reclip-transcript.patch b/patches/reclip/reclip-transcript.patch
index 5fa4969..34602fb 100644
--- a/patches/reclip/reclip-transcript.patch
+++ b/patches/reclip/reclip-transcript.patch
@@ -1,19 +1,20 @@
diff --git a/app.py b/app.py
-index 2b5eaa5..3c3c9c8 100644
+index 2b5eaa5..1dfbbd0 100644
--- a/app.py
+++ b/app.py
-@@ -2,8 +2,10 @@ import os
+@@ -2,8 +2,11 @@ import os
import uuid
import glob
import json
+import re
++import hashlib
import subprocess
import threading
+import time
from flask import Flask, request, jsonify, send_file, render_template
app = Flask(__name__)
-@@ -12,6 +14,58 @@ os.makedirs(DOWNLOAD_DIR, exist_ok=True)
+@@ -12,6 +15,97 @@ os.makedirs(DOWNLOAD_DIR, exist_ok=True)
jobs = {}
@@ -59,6 +60,7 @@ index 2b5eaa5..3c3c9c8 100644
+ "job_id": job.get("job_id"),
+ "url": job.get("url", ""),
+ "title": job.get("title", ""),
++ "thumbnail": job.get("thumbnail", ""),
+ "filename": job.get("filename", ""),
+ "file": job.get("file", ""),
+ "transcript": job.get("transcript") or "",
@@ -68,11 +70,49 @@ index 2b5eaa5..3c3c9c8 100644
+ "date": time.strftime("%Y-%m-%d %H:%M:%S"),
+ })
+ save_history(history[:200])
++
++
++MEDIA_EXTS = (".mp4", ".mkv", ".webm", ".m4a", ".mp3", ".flac", ".mov", ".avi", ".wav", ".ts")
++
++
++def backfill_history():
++ """Add on-disk downloads that predate history.json (or were dropped into
++ the downloads dir manually) so the whole library shows up on the page.
++ The transcript flag is resolved live at read time, so backfilled entries
++ pick up manual yt-transcribe sidecars automatically."""
++ for name in sorted(os.listdir(DOWNLOAD_DIR)):
++ path = os.path.join(DOWNLOAD_DIR, name)
++ if not os.path.isfile(path) or not name.lower().endswith(MEDIA_EXTS):
++ continue
++ with _history_lock:
++ history = load_history()
++ if any(h.get("file") == path for h in history):
++ continue
++ stem = os.path.splitext(name)[0]
++ # a 10-hex stem is a reclip job id — the real title wasn't kept
++ title = "" if re.fullmatch(r"[0-9a-f]{10}", stem) else stem
++ history.insert(0, {
++ "job_id": hashlib.sha1(path.encode()).hexdigest()[:10],
++ "url": "",
++ "title": title,
++ "filename": name,
++ "file": path,
++ "transcript": "",
++ "transcript_name": "",
++ "has_transcript": False,
++ "size": os.path.getsize(path),
++ "date": time.strftime("%Y-%m-%d %H:%M:%S",
++ time.localtime(os.path.getmtime(path))),
++ })
++ save_history(history[:200])
++
++
++backfill_history()
+
def parse_ytdlp_json(stdout):
"""Parse yt-dlp JSON output.
-@@ -29,6 +83,53 @@ def parse_ytdlp_json(stdout):
+@@ -29,6 +123,53 @@ def parse_ytdlp_json(stdout):
raise ValueError("yt-dlp returned no data")
@@ -126,7 +166,7 @@ index 2b5eaa5..3c3c9c8 100644
def run_download(job_id, url, format_choice, format_id):
job = jobs[job_id]
out_template = os.path.join(DOWNLOAD_DIR, f"{job_id}.%(ext)s")
-@@ -81,6 +182,12 @@ def run_download(job_id, url, format_choice, format_id):
+@@ -81,6 +222,12 @@ def run_download(job_id, url, format_choice, format_id):
job["filename"] = f"{safe_title}{ext}" if safe_title else os.path.basename(chosen)
else:
job["filename"] = os.path.basename(chosen)
@@ -139,16 +179,17 @@ index 2b5eaa5..3c3c9c8 100644
except subprocess.TimeoutExpired:
job["status"] = "error"
job["error"] = "Download timed out (5 min limit)"
-@@ -175,7 +282,7 @@ def start_download():
+@@ -175,7 +322,8 @@ def start_download():
return jsonify({"error": "No URL provided"}), 400
job_id = uuid.uuid4().hex[:10]
- jobs[job_id] = {"status": "downloading", "url": url, "title": title}
-+ jobs[job_id] = {"job_id": job_id, "status": "downloading", "url": url, "title": title}
++ jobs[job_id] = {"job_id": job_id, "status": "downloading", "url": url, "title": title,
++ "thumbnail": (data.get("thumbnail") or "")[:500]}
thread = threading.Thread(target=run_download, args=(job_id, url, format_choice, format_id))
thread.daemon = True
-@@ -184,6 +291,18 @@ def start_download():
+@@ -184,6 +332,18 @@ def start_download():
return jsonify({"job_id": job_id})
@@ -167,7 +208,7 @@ index 2b5eaa5..3c3c9c8 100644
@app.route("/api/status/
")
def check_status(job_id):
job = jobs.get(job_id)
-@@ -193,15 +312,48 @@ def check_status(job_id):
+@@ -193,15 +353,48 @@ def check_status(job_id):
"status": job["status"],
"error": job.get("error"),
"filename": job.get("filename"),
@@ -221,54 +262,29 @@ index 2b5eaa5..3c3c9c8 100644
if __name__ == "__main__":
diff --git a/templates/index.html b/templates/index.html
-index 1f566d1..9017db6 100644
+index 1f566d1..4807aa1 100644
--- a/templates/index.html
+++ b/templates/index.html
-@@ -343,6 +343,43 @@
+@@ -343,6 +343,18 @@
.dl-all-btn:hover { background: #2d2d2a; }
.dl-all-btn:disabled { opacity: 0.4; cursor: not-allowed; }
-+ /* History */
++ /* History — same card language as the fetch results */
+ .hist-h {
+ font-family: 'Instrument Serif', serif;
-+ font-size: 1.4rem;
++ font-size: 1.9rem;
+ font-weight: 400;
-+ margin: 32px 0 10px;
++ letter-spacing: -0.02em;
++ margin: 44px 0 14px;
+ color: var(--fg);
+ }
-+ .hist-row {
-+ display: flex;
-+ gap: 10px;
-+ align-items: center;
-+ border: 1.5px solid var(--card-border);
-+ border-radius: 10px;
-+ background: var(--card);
-+ padding: 10px 12px;
-+ margin-bottom: 6px;
-+ }
-+ .hist-main { flex: 1; min-width: 0; }
-+ .hist-title {
-+ font-size: 0.8rem;
-+ color: var(--fg);
-+ overflow: hidden;
-+ text-overflow: ellipsis;
-+ white-space: nowrap;
-+ }
-+ .hist-meta {
-+ font-size: 0.65rem;
-+ color: var(--muted);
-+ text-transform: uppercase;
-+ letter-spacing: 0.03em;
-+ margin-top: 2px;
-+ }
-+ .hist-meta .t-flag { color: var(--success); }
-+ .hist-actions { display: flex; gap: 6px; }
++ #history .card { animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
+ a.card-dl-btn { text-decoration: none; display: inline-block; }
+
.spin {
display: inline-block;
width: 10px; height: 10px;
-@@ -399,6 +436,7 @@
+@@ -399,6 +411,7 @@
@@ -276,7 +292,7 @@ index 1f566d1..9017db6 100644