From: Marcel van der Veldt Date: Sat, 20 Dec 2025 21:00:05 +0000 (+0100) Subject: fix album versions comparison match too flexible X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=1bbfa3faea473a43121d10dcefbfc4147363bf01;p=music-assistant-server.git fix album versions comparison match too flexible --- diff --git a/music_assistant/helpers/compare.py b/music_assistant/helpers/compare.py index 10bc55cf..81b05029 100644 --- a/music_assistant/helpers/compare.py +++ b/music_assistant/helpers/compare.py @@ -529,14 +529,16 @@ def loose_compare_strings(base: str, alt: str) -> bool: """Compare strings and return True even on partial match.""" # this is used to display 'versions' of the same track/album # where we account for other spelling or some additional wording in the title - word_count = len(base.split(" ")) + if len(base) <= 3 or len(alt) <= 3: + return compare_strings(base, alt, True) + word_count = len(base.strip().split(" ")) if word_count == 1 and len(base) < 10: return compare_strings(base, alt, False) base_comp = create_safe_string(base) alt_comp = create_safe_string(alt) if base_comp in alt_comp: return True - return alt_comp in base_comp + return base_comp in alt_comp def compare_strings(str1: str, str2: str, strict: bool = True) -> bool: