Qnet match VEDNO shranjen v job.qnet_match (audit + tv_station auto-fill), tudi ko client po\u0161lje artist+title

This commit is contained in:
OpenClaw Agent 2026-05-02 10:57:09 +00:00
parent 24e1b53aa8
commit 1f8565413a

View File

@ -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
if artist and title:
# User je vpisal ali potrdil
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)
# 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["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"],
}
# 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 (lahko prihaja iz client-side Qnet match-a)
job["parsed_artist"] = artist.strip()
job["parsed_title"] = title.strip()
job["has_clean_name"] = True
else:
# 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
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