From 1f8565413a6956c614868fc42c123d27ee89f73f Mon Sep 17 00:00:00 2001 From: OpenClaw Agent Date: Sat, 2 May 2026 10:57:09 +0000 Subject: [PATCH] Qnet match VEDNO shranjen v job.qnet_match (audit + tv_station auto-fill), tudi ko client po\u0161lje artist+title --- app/main.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/app/main.py b/app/main.py index 765f289..e79bcff 100644 --- a/app/main.py +++ b/app/main.py @@ -1287,31 +1287,35 @@ async def upload_video( job["batch_id"] = batch_id # Artist + title — najprej user-provided, potem Qnet match, potem parse iz filename + # Qnet match poskusimo VEDNO (audit + tv_station auto-fill), ne glede na to + # ali je client že poslal artist+title (jih je morda dobil iz Qnet match-a sam) + qm = qnet_match.match_filename(file.filename) + if qm["matched"] and qm["confidence"] >= 0.85: + job["qnet_match"] = { + "method": qm["method"], + "confidence": qm["confidence"], + "matched_file": qm["file"], + "matched_station": qm["station"], + } + # Auto-set tv_station, če še ni — uporabnik ga lahko ročno spremeni v UI + if not job.get("tv_station"): + job["tv_station"] = qm["station"] + if artist and title: - # User je vpisal ali potrdil + # User je vpisal ali potrdil (lahko prihaja iz client-side Qnet match-a) job["parsed_artist"] = artist.strip() job["parsed_title"] = title.strip() job["has_clean_name"] = True else: - # 1) Probaj match proti Qnet bazi (clean Artist+Title direct iz playlistov) - qm = qnet_match.match_filename(file.filename) + # Fallback: Qnet match (server-side) → parse_artist_title regex if qm["matched"] and qm["confidence"] >= 0.85: job["parsed_artist"] = qm["artist"] job["parsed_title"] = qm["title"] job["has_clean_name"] = True - # Če station ni že nastavljen ročno, vzemi iz Qnet match-a - if not job.get("tv_station"): - job["tv_station"] = qm["station"] - job["qnet_match"] = { - "method": qm["method"], - "confidence": qm["confidence"], - "matched_file": qm["file"], - "matched_station": qm["station"], - } print(f"🎯 Qnet match [{qm['method']}, {qm['confidence']}]: " f"{qm['station']} — {qm['artist']} — {qm['title']}", flush=True) else: - # 2) Fallback: filename parser (regex-based) + # Fallback: regex parser a, t = parse_artist_title(file.filename) if a: job["parsed_artist"] = a