log output
This commit is contained in:
@@ -14,7 +14,7 @@ Kein LLM, keine Netzwerk. Reine lokale Analyse zum Planen.
|
||||
Aufruf:
|
||||
python3 classify_pdfs.py --src ~/data/S
|
||||
"""
|
||||
import os, re, glob, argparse
|
||||
import os, re, glob, argparse, sys
|
||||
from collections import defaultdict
|
||||
from pypdf import PdfReader
|
||||
|
||||
@@ -45,6 +45,7 @@ def main():
|
||||
args = ap.parse_args()
|
||||
|
||||
pdfs = sorted(glob.glob(os.path.join(args.src, "*.pdf")))
|
||||
print(f"{len(pdfs)} PDFs (nur oberste Ebene) gefunden. Analysiere...\n")
|
||||
persons = defaultdict(list)
|
||||
for p in pdfs:
|
||||
persons[person_from_filename(p)].append(p)
|
||||
@@ -55,6 +56,8 @@ def main():
|
||||
only_image_persons = []
|
||||
person_has_text = {}
|
||||
|
||||
processed = 0
|
||||
total_files = len(pdfs)
|
||||
for person, files in persons.items():
|
||||
non_notes = [f for f in files if "notes" not in os.path.basename(f).lower()]
|
||||
notes = [f for f in files if "notes" in os.path.basename(f).lower()]
|
||||
@@ -71,11 +74,19 @@ def main():
|
||||
else:
|
||||
n_image += 1
|
||||
|
||||
# Person hat NUR Image-PDFs (oder nur Notes)?
|
||||
# Fortschritt in EINER Zeile (mit \r ueberschreibend)
|
||||
processed += len(files)
|
||||
name_short = person[:40]
|
||||
sys.stdout.write(f"\r {processed}/{total_files} bearbeitet - {name_short:<42}")
|
||||
sys.stdout.flush()
|
||||
|
||||
if not has_any_text:
|
||||
only_image_persons.append(person)
|
||||
person_has_text[person] = has_any_text
|
||||
|
||||
sys.stdout.write("\r" + " " * 70 + "\r") # Zeile loeschen
|
||||
print("Analyse fertig.\n")
|
||||
|
||||
print(f"=== Analyse: {args.src} ===")
|
||||
print(f"PDFs gesamt: {len(pdfs)}")
|
||||
print(f"Distinkte Personen: {total_persons}")
|
||||
|
||||
Reference in New Issue
Block a user