From 1bbfa3faea473a43121d10dcefbfc4147363bf01 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Sat, 20 Dec 2025 22:00:05 +0100 Subject: [PATCH] fix album versions comparison match too flexible --- music_assistant/helpers/compare.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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: -- 2.34.1