Add priority query for Artist + Album + Title in matching
Introduces a new priority 0 query that combines artist, album, and title for improved matching, especially for YouTube and hybrid download modes. This helps better match tracks where the album is significant, such as soundtracks, and only applies when the album is not a generic label like 'single' or 'greatest hits'.
This commit is contained in:
parent
ddd2ebdb13
commit
9bf1948097
1 changed files with 14 additions and 1 deletions
|
|
@ -4,9 +4,11 @@ from dataclasses import dataclass
|
|||
from difflib import SequenceMatcher
|
||||
from unidecode import unidecode
|
||||
from utils.logging_config import get_logger
|
||||
from config.settings import config_manager
|
||||
|
||||
from core.spotify_client import Track as SpotifyTrack
|
||||
from core.plex_client import PlexTrackInfo
|
||||
from core.soulseek_client import TrackResult
|
||||
from core.soulseek_client import TrackResult, AlbumResult
|
||||
|
||||
|
||||
logger = get_logger("matching_engine")
|
||||
|
|
@ -409,6 +411,17 @@ class MusicMatchingEngine:
|
|||
if album_name:
|
||||
break
|
||||
|
||||
# PRIORITY 0: Try exact Artist + Album + Title (Best for OSTs)
|
||||
# Often YouTube videos are titled "Artist - Album - Title" or similar
|
||||
# Only include if mode is youtube or hybrid (safe for Soulseek default)
|
||||
download_mode = config_manager.get('download_source.mode', 'soulseek')
|
||||
if download_mode in ['youtube', 'hybrid'] and album_name and album_name.lower() not in ['single', 'ep', 'greatest hits']:
|
||||
album_clean = self.clean_album_name(album_name)
|
||||
if album_clean:
|
||||
# Standard query: Artist Album Title
|
||||
queries.append(f"{artist} {album_clean} {self.clean_title(original_title)}".strip())
|
||||
logger.debug(f"PRIORITY 0: Artist + Album + Title query: '{artist} {album_clean} {self.clean_title(original_title)}'")
|
||||
|
||||
# PRIORITY 1: Try removing potential album from title FIRST
|
||||
cleaned_title, album_detected = self.detect_album_in_title(original_title, album_name)
|
||||
if album_detected and cleaned_title != original_title:
|
||||
|
|
|
|||
Loading…
Reference in a new issue