A kind of initial commit

This commit is contained in:
heboba
2026-02-26 19:33:05 +00:00
commit 9ab125b1a6
37 changed files with 3053 additions and 0 deletions

14
app/utils/text.py Normal file
View File

@@ -0,0 +1,14 @@
from __future__ import annotations
import re
_WS_RE = re.compile(r"\s+")
_FEAT_RE = re.compile(r"\s*[\(\[\-–—]\s*(feat|ft)\.?.*$", re.IGNORECASE)
def normalize_track_signature(name: str, artists: list[str]) -> str:
clean_name = _FEAT_RE.sub("", name).strip().lower()
clean_name = _WS_RE.sub(" ", clean_name)
clean_artists = ",".join(sorted(a.strip().lower() for a in artists if a.strip()))
return f"{clean_name}::{clean_artists}"