This commit is contained in:
codey 2025-01-12 20:20:57 -05:00
parent 725e463992
commit 945a3d9bf6
3 changed files with 3 additions and 42 deletions

View File

@ -4,5 +4,3 @@ class Cache:
"""Cache Search Module""" """Cache Search Module"""
def __init__(self): def __init__(self):
pass pass

View File

@ -1,8 +1,8 @@
#!/usr/bin/env python3.12 #!/usr/bin/env python3.12
from aiohttp import ClientTimeout, ClientSession, ClientError
from .. import private from .. import private
from . import common from . import common
from aiohttp import ClientTimeout, ClientSession, ClientError
class Genius: class Genius:
"""Genius Search Module""" """Genius Search Module"""
@ -17,9 +17,3 @@ class Genius:
@artist: the artist to search @artist: the artist to search
@song: the song to search @song: the song to search
""" """

View File

@ -4,37 +4,6 @@ from difflib import SequenceMatcher
from typing import List, Optional, Tuple from typing import List, Optional, Tuple
import re 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: class TrackMatcher:
"""Track Matcher""" """Track Matcher"""
def __init__(self, threshold: float = 0.85): def __init__(self, threshold: float = 0.85):