From 2eb595552d09b5133e859cc20798ffbc0413e689 Mon Sep 17 00:00:00 2001 From: Gmer4Lfe Date: Sat, 11 Jul 2026 18:03:32 -0400 Subject: [PATCH] Fix Unicode dash mismatch in Lidarr discovery dedup check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit blink-182 kept getting rescored and re-added every week despite already being in the library (id=155). Root cause: MusicBrainz's canonical name is 'blink‐182' using a Unicode hyphen (U+2010), while Last.fm's candidate list returns the plain ASCII hyphen — the exact-string _in_lidarr() / _in_emby_library() checks never matched, so it was treated as a new artist every run, scored, accepted, and its add attempt correctly failed against Lidarr's duplicate-MBID rejection. Added _normalize_dashes() to collapse Unicode hyphen/dash variants (U+2010 through U+2014) to ASCII '-' before comparing, applied to both the stored library name lists and each candidate name at match time. Fixes this for any artist with a stylized dash in their canonical name, not just this one. --- Arrs_Stack/playback_aware_lidarr_discovery.sh | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Arrs_Stack/playback_aware_lidarr_discovery.sh b/Arrs_Stack/playback_aware_lidarr_discovery.sh index b3fe62a..32d4073 100755 --- a/Arrs_Stack/playback_aware_lidarr_discovery.sh +++ b/Arrs_Stack/playback_aware_lidarr_discovery.sh @@ -529,8 +529,25 @@ EMBY_ARTIST_NAMES=$(echo "$EMBY_LIBRARY_JSON" | jq -r '.Items[] | .AlbumArtists[ EMBY_ARTIST_COUNT=$(echo "$EMBY_ARTIST_NAMES" | grep -c . 2>/dev/null || echo 0) log "$EMBY_ARTIST_COUNT album artists in Emby library" -_in_lidarr() { echo "$LIDARR_NAMES" | grep -iq "^${1}$"; } -_in_emby_library(){ [[ -n "$EMBY_ARTIST_NAMES" ]] && echo "$EMBY_ARTIST_NAMES" | grep -iq "^${1}$"; } +# MusicBrainz's canonical name for some artists (e.g. "blink‐182") uses a Unicode +# hyphen/dash rather than plain ASCII "-". Last.fm's candidate names are plain ASCII, +# so an exact-string match against Lidarr/Emby's names silently misses these artists +# every time — they never register as "already known" and get retried (and rejected +# as duplicates) on every future run. Normalize both sides before comparing. +_normalize_dashes() { + local n="$1" + n="${n//‐/-}" # U+2010 HYPHEN + n="${n//‑/-}" # U+2011 NON-BREAKING HYPHEN + n="${n//‒/-}" # U+2012 FIGURE DASH + n="${n//–/-}" # U+2013 EN DASH + n="${n//—/-}" # U+2014 EM DASH + echo "$n" +} +LIDARR_NAMES=$(_normalize_dashes "$LIDARR_NAMES") +EMBY_ARTIST_NAMES=$(_normalize_dashes "$EMBY_ARTIST_NAMES") + +_in_lidarr() { echo "$LIDARR_NAMES" | grep -iq "^$(_normalize_dashes "$1")$"; } +_in_emby_library(){ [[ -n "$EMBY_ARTIST_NAMES" ]] && echo "$EMBY_ARTIST_NAMES" | grep -iq "^$(_normalize_dashes "$1")$"; } # ============================================================================================== # ━━━ Score Stage 2 Candidates ━━━