fix: trim .ext from title to optimize query. #52
Merged
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.
The unexpected . field in the title directly
corrupts local.go:findFile, so that the last part
of the title never accurately matches the lrc file.
I'm using Rhythmbox to play local music and the lyrics are also local. Then I noticed that for files with missing metatags, sptlrx always confused different songs by the same artist.
After debugging, I found that the reason is that Rhythmbox will use the file name together with its extension as the fall-back title, and when matching local lyrics, the extension will be processed and glued together with another part at the end of the file name -- usually the real title of the song.
This means that unless this mechanism is known in advance and all lyric files are renamed accordingly, accurate matching is impossible to occur for a player like Rhythmbox.
This fix may also introduce new issues with certain file/player combinations, such as when the song title contains a dot but the url does not contain the file extension. But I think this situation should be rare enough.
Maybe it would be better to put meta["xesam:url"] into the player.State structure, so that local.go can compare the file extensions by itself, and also get the accurate lrc file with the same name based on the url without configuring the lyrics directory.