minor
This commit is contained in:
parent
5d4335f92d
commit
1ab5adfc2d
@ -21,7 +21,7 @@ class RadioUtil:
|
||||
def __init__(self, constants) -> None:
|
||||
self.constants = constants
|
||||
self.gpt = gpt.GPT(self.constants)
|
||||
self.ls_uri: str = "http://10.10.10.101:29000"
|
||||
self.ls_uri: str = self.constants.LS_URI
|
||||
self.sqlite_exts: list[str] = ['/home/singer/api/solibs/spellfix1.cpython-311-x86_64-linux-gnu.so']
|
||||
self.active_playlist_path: Union[str, LiteralString] = os.path\
|
||||
.join("/usr/local/share",
|
||||
@ -146,7 +146,7 @@ class RadioUtil:
|
||||
"""
|
||||
|
||||
db_query: str = """SELECT distinct(LOWER(TRIM(artist)) || " - " || LOWER(TRIM(song))), (TRIM(artist) || " - " || TRIM(song)) AS artistdashsong, id, artist, song, genre, file_path, duration FROM tracks\
|
||||
WHERE genre LIKE "%metalcore%"\
|
||||
WHERE (genre LIKE "%metalcore%"\
|
||||
OR genre LIKE "%rock%"\
|
||||
OR genre LIKE "%pop punk%"\
|
||||
OR genre LIKE "%math rock%"\
|
||||
@ -178,7 +178,8 @@ class RadioUtil:
|
||||
OR genre LIKE "%synthwave%"\
|
||||
OR genre LIKE "%trap%"\
|
||||
OR genre LIKE "%indie pop%"\
|
||||
OR genre LIKE "untagged"\
|
||||
OR genre LIKE "%dnb%"\
|
||||
OR genre LIKE "untagged")\
|
||||
GROUP BY artistdashsong ORDER BY RANDOM()"""
|
||||
|
||||
"""
|
||||
@ -186,7 +187,7 @@ class RadioUtil:
|
||||
"""
|
||||
|
||||
# db_query = 'SELECT distinct(artist || " - " || song) AS artistdashsong, id, artist, song, genre, file_path, duration FROM tracks\
|
||||
# WHERE artist LIKE "%bad omens%" GROUP BY artistdashsong ORDER BY RANDOM()'
|
||||
# WHERE artist LIKE "%wage war%" GROUP BY artistdashsong ORDER BY id DESC'
|
||||
|
||||
async with sqlite3.connect(self.active_playlist_path,
|
||||
timeout=2) as db_conn:
|
||||
|
@ -34,7 +34,7 @@ class Transcriptions(FastAPI):
|
||||
db_query: Optional[str] = None
|
||||
show_title: Optional[str] = None
|
||||
|
||||
if not show_id:
|
||||
if not isinstance(show_id, int):
|
||||
return JSONResponse(status_code=500, content={
|
||||
'err': True,
|
||||
'errorText': 'Invalid request',
|
||||
|
@ -257,7 +257,7 @@ class Cache:
|
||||
matched = self.get_matched(redis_results=redis_result, matched_candidate=candidate,
|
||||
confidence=confidence)
|
||||
|
||||
if matched:
|
||||
if matched and confidence >= 90:
|
||||
time_end: float = time.time()
|
||||
time_diff: float = time_end - time_start
|
||||
matched.confidence = confidence
|
||||
@ -295,7 +295,7 @@ class Cache:
|
||||
candidate_tracks=result_tracks)
|
||||
else:
|
||||
best_match = (result_tracks[0], 100)
|
||||
if not best_match:
|
||||
if not best_match or confidence < 90:
|
||||
return None
|
||||
(candidate, confidence) = best_match
|
||||
logging.info("Result found on %s", self.label)
|
||||
|
@ -41,6 +41,8 @@ class TrackMatcher:
|
||||
|
||||
for candidate in candidate_tracks:
|
||||
normalized_candidate = self._normalize_string(candidate[1])
|
||||
if normalized_candidate.strip().lower() == input_track.strip().lower():
|
||||
return (candidate, 100.0)
|
||||
|
||||
# Calculate various similarity scores
|
||||
exact_score = 1.0 if input_track == normalized_candidate else 0.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user