From 945a3d9bf65a5672c4c6cfaf31d48e59b362ca6f Mon Sep 17 00:00:00 2001 From: codey Date: Sun, 12 Jan 2025 20:20:57 -0500 Subject: [PATCH] WIP --- lyric_search_new/sources/cache.py | 4 +--- lyric_search_new/sources/genius.py | 10 ++-------- lyric_search_new/utils.py | 31 ------------------------------ 3 files changed, 3 insertions(+), 42 deletions(-) diff --git a/lyric_search_new/sources/cache.py b/lyric_search_new/sources/cache.py index 461013e..2a9998b 100644 --- a/lyric_search_new/sources/cache.py +++ b/lyric_search_new/sources/cache.py @@ -3,6 +3,4 @@ class Cache: """Cache Search Module""" def __init__(self): - pass - - + pass \ No newline at end of file diff --git a/lyric_search_new/sources/genius.py b/lyric_search_new/sources/genius.py index 1c98e11..b096119 100644 --- a/lyric_search_new/sources/genius.py +++ b/lyric_search_new/sources/genius.py @@ -1,8 +1,8 @@ #!/usr/bin/env python3.12 +from aiohttp import ClientTimeout, ClientSession, ClientError from .. import private from . import common -from aiohttp import ClientTimeout, ClientSession, ClientError class Genius: """Genius Search Module""" @@ -16,10 +16,4 @@ class Genius: """ @artist: the artist to search @song: the song to search - """ - - - - - - + """ \ No newline at end of file diff --git a/lyric_search_new/utils.py b/lyric_search_new/utils.py index 3ae7351..3622f6e 100644 --- a/lyric_search_new/utils.py +++ b/lyric_search_new/utils.py @@ -4,37 +4,6 @@ from difflib import SequenceMatcher from typing import List, Optional, Tuple import re -# Example usage: -if __name__ == "__main__": - matcher = TrackMatcher(threshold=0.85) - - candidate_tracks = [ - "The Beatles - Hey Jude", - "Led Zeppelin - Stairway to Heaven", - "Queen - Bohemian Rhapsody", - "Pink Floyd - Comfortably Numb", - "The Beatles - Hey Jules", # Intentionally similar to "Hey Jude" - ] - - # Test cases - test_tracks = [ - "The Beatles - Hey Jude", # Exact match - "Beatles - Hey Jude", # Similar match - "The Beatles - Hey Jules", # Similar but different - "Metallica - Nothing Else Matters", # No match - "Queen - bohemian rhapsody", # Different case - ] - - for test_track in test_tracks: - result = matcher.find_best_match(test_track, candidate_tracks) - if result: - match, score = result - print(f"Input: {test_track}") - print(f"Best match: {match}") - print(f"Similarity score: {score:.3f}\n") - else: - print(f"No good match found for: {test_track}\n") - class TrackMatcher: """Track Matcher""" def __init__(self, threshold: float = 0.85):