reparations

This commit is contained in:
2025-01-18 14:46:05 -05:00
parent d7fef03f1b
commit bfe09e8afc
2 changed files with 19 additions and 15 deletions

View File

@@ -50,7 +50,7 @@ class Cache:
artist=row['artist'],
song=row['song'],
lyrics=row['lyrics'],
src=f"{row['src']} (redis cache, id: {row['id']})",
src=f"{row['src']} (redis cache, id: {key})",
confidence=row['confidence']
)
else:
@@ -171,21 +171,21 @@ class Cache:
else:
best_match = (result_tracks[0], 100)
if not best_match:
return None
(candidate, confidence) = best_match
matched = self.get_matched(redis_results=redis_result, matched_candidate=candidate,
if best_match:
(candidate, confidence) = best_match
matched = self.get_matched(redis_results=redis_result, matched_candidate=candidate,
confidence=confidence)
time_end: float = time.time()
time_diff: float = time_end - time_start
matched.confidence = confidence
matched.time = time_diff
if matched:
time_end: float = time.time()
time_diff: float = time_end - time_start
matched.confidence = confidence
matched.time = time_diff
if matched:
logging.info("Found %s on redis cache, skipping SQLite...",
f"{artist} - {song}")
return matched
logging.info("Found %s on redis cache, skipping SQLite...",
f"{artist} - {song}")
return matched
"""SQLite: Fallback"""