Skip to content

Updates for improving Jellyfin track matching and downloading#199

Open
gtkashi wants to merge 26 commits into
LumePart:devfrom
gtkashi:dev
Open

Updates for improving Jellyfin track matching and downloading#199
gtkashi wants to merge 26 commits into
LumePart:devfrom
gtkashi:dev

Conversation

@gtkashi

@gtkashi gtkashi commented Jul 2, 2026

Copy link
Copy Markdown

After hitting my head against a wall trying to get track matching to work nicely in Jellyfin, ran this through Gemini several times to get the hit rate up to 100%.

Improves Jellyfin client track searching mechanism, resolving issues where Explo repeatedly logs [jellyfin] failed to find X for songs that are already present in the media library.

Changes (mainly jellyfin.go):

Alphanumeric Matching:
Replaced string matches with alphanumeric-only normalization comparisons on both sides (currentAlnumItemTitle == targetAlnumTitle) to bypass typography differences (e.g., curly vs. straight apostrophes like Where’d and Where'd).

Array/Substring Multi-Artist Tracking:
Upgraded the artist matching verification block to evaluate elements against Jellyfin’s discrete split-string JSON array slices (item.Artists). This handles collaborations cleanly (e.g., Artist A & Artist B vs Artist A feat. Artist B).

Result Pool Expansion:
Increased the API query fetch scope to Limit=300 to prevent Jellyfin from truncating matching tracks inside generic search pools.

Fuzzy Root-Word Fallback Strategy:
Implemented a non-alphanumeric split fail-safe. If an exact database query fails due to complex brackets or parentheses syntax breaking the index parser, the code automatically falls back to searching Jellyfin by the track's first continuous block of alphanumeric characters (e.g., matching Rollin' (Air Raid Vehicle) seamlessly via a root search for Rollin).

Changes to downloader.go:
Adding retry attempts due to YT time outs. 49/50 success rater, which was good enough for me to move on to dealing with all of the above items.

Change to config.go:
Just adding attempts value.

Change to sanitize.go:
Changes to string normalization. This is where the first changes were attempted, but eventually the lion's share ended up in jellyfin.go.

gtkashi added 26 commits July 1, 2026 12:37
Adding retry logic for timeouts
Refactor title cleaning functions to improve clarity and maintainability. Introduced StripFeat for removing feat annotations and updated NormalizeTitle and NormalizeArtist to use it.
Updated functions to handle featuring clauses more accurately and normalize artist names with semicolons.
Refactor artist matching logic to improve accuracy by isolating the primary artist and updating fuzzy matching.
Refactor SearchSongs to improve search parameters by stripping punctuation, isolating primary artist, and using explicit filters.
Updated search logic to improve reliability and added limit to prevent truncation of results.
Added regex to clean search titles and improved normalization of item titles.
Refactor comments for clarity and structure in SearchSongs method.
Updated comments for clarity and added diagnostic logging for search results and item comparisons.
Updated search query to use explicit Name lookup to avoid indexing bugs in Jellyfin. Removed diagnostic logging for search results and item comparisons.
Updated search functionality to clean typography drift and revert to indexed SearchTerm query for better results.
Removed unused regexp import from jellyfin.go
Refactor fallback search logic to use the first complete word of the song title and improve punctuation handling.
Refined fallback search logic to isolate the first alphanumeric block from the song title for better search accuracy.
Cleaning up for pull request
Cleanup for pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant