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:
parent
24e1b53aa8
commit
1f8565413a
30
app/main.py
30
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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user