Initial commit: source code only
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Check which episodes are already transcribed/analyzed."""
|
||||
|
||||
import os
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
TRANSCRIPT_DIR = "transcripts"
|
||||
ANALYSIS_DIR = "data/analysis"
|
||||
|
||||
def check_progress():
|
||||
print("=" * 60)
|
||||
print("Dick Show Index - Progress Check")
|
||||
print("=" * 60)
|
||||
|
||||
# All episodes from the feed
|
||||
all_episodes = set()
|
||||
# Load from episodes.jsonl if available
|
||||
if os.path.exists("data/episodes.jsonl"):
|
||||
with open("data/episodes.jsonl", "r") as f:
|
||||
for line in f:
|
||||
ep = json.loads(line)
|
||||
if ep.get("ep_num"):
|
||||
all_episodes.add(ep["ep_num"])
|
||||
|
||||
# Check transcripts
|
||||
transcript_files = set()
|
||||
if os.path.exists("transcripts"):
|
||||
for f in os.listdir("transcripts"):
|
||||
if f.startswith("ep") and f.endswith(".json"):
|
||||
try:
|
||||
ep_num = int(f[2:6])
|
||||
transcript_files.add(ep_num)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
# Check analyses
|
||||
analysis_files = set()
|
||||
if os.path.exists("data/analysis"):
|
||||
for f in os.listdir("data/analysis"):
|
||||
if f.startswith("ep") and f.endswith(".json"):
|
||||
try:
|
||||
ep_num = int(f[2:6])
|
||||
analysis_files.add(ep_num)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
# Check verified analyses
|
||||
verified = set()
|
||||
if os.path.exists("data/analysis"):
|
||||
for f in os.listdir("data/analysis"):
|
||||
if f.startswith("ep") and f.endswith(".json"):
|
||||
try:
|
||||
ep_num = int(f[2:6])
|
||||
path = f"data/analysis/{f}"
|
||||
with open(path, "r") as f:
|
||||
data = json.load(f)
|
||||
if data.get("_verification", {}).get("verdict") in ("pass", "fix"):
|
||||
verified.add(ep_num)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
all_eps = sorted(all_episodes)
|
||||
if not all_eps:
|
||||
all_eps = sorted(transcript_files | analysis_files)
|
||||
|
||||
print(f"\n{'Ep':>4} {'Title':<45} {'Transcript':^10} {'Analysis':^10} {'Verified':^8}")
|
||||
print("-" * 85)
|
||||
|
||||
stats = {"total": 0, "transcript": 0, "analysis": 0, "verified": 0}
|
||||
|
||||
for ep in all_eps:
|
||||
has_t = ep in transcript_files
|
||||
has_a = ep in analysis_files
|
||||
has_v = ep in verified
|
||||
|
||||
stats["total"] += 1
|
||||
if has_t: stats["transcript"] += 1
|
||||
if has_a: stats["analysis"] += 1
|
||||
if has_v: stats["verified"] += 1
|
||||
|
||||
t_status = "[OK]" if has_t else "[..]"
|
||||
a_status = "[OK]" if has_a else "[..]"
|
||||
v_status = "[OK]" if has_v else "[..]"
|
||||
|
||||
# Try to get title
|
||||
title = ""
|
||||
try:
|
||||
with open(f"transcripts/ep{ep:04d}.json", "r") as f:
|
||||
data = json.load(f)
|
||||
title = data.get("title", "")[:43]
|
||||
except:
|
||||
pass
|
||||
|
||||
print(f"{ep:>4} {title:<45} {t_status:^10} {a_status:^10} {v_status:^8}")
|
||||
|
||||
print("-" * 85)
|
||||
print(f"Total episodes in feed: {stats['total']}")
|
||||
print(f"Transcripts complete: {stats['transcript']}/{stats['total']}")
|
||||
print(f"Analyses complete: {stats['analysis']}/{stats['total']}")
|
||||
print(f"Verified: {stats['verified']}/{stats['total']}")
|
||||
|
||||
# Missing
|
||||
missing_t = [ep for ep in all_eps if ep not in transcript_files]
|
||||
missing_a = [ep for ep in all_eps if ep not in analysis_files]
|
||||
missing_v = [ep for ep in all_eps if ep not in verified]
|
||||
|
||||
if missing_t:
|
||||
print(f"\nMissing transcripts ({len(missing_t)}): {missing_t[:20]}{'...' if len(missing_t) > 20 else ''}")
|
||||
if missing_a:
|
||||
print(f"Missing analyses ({len(missing_a)}): {missing_a[:20]}{'...' if len(missing_a) > 20 else ''}")
|
||||
if missing_v:
|
||||
print(f"Unverified ({len(missing_v)}): {missing_v[:20]}{'...' if len(missing_v) > 20 else ''}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
check_progress()
|
||||
Reference in New Issue
Block a user