Updates for improving Jellyfin track matching and downloading#199
Open
gtkashi wants to merge 26 commits into
Open
Updates for improving Jellyfin track matching and downloading#199gtkashi wants to merge 26 commits into
gtkashi wants to merge 26 commits into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.