-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix: Spotify plugin unable to recognize Chinese and Japanese albums. #5705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Spotify plugin unable to recognize Chinese and Japanese albums. #5705
Conversation
Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry. |
This comment was marked as outdated.
This comment was marked as outdated.
Seems like both PRs were opened almost at the same time. (The other one is #5703.) As it is done here, the However, I'm wondering about the original reasoning for adding Maybe you could check the |
Was added in a commit in part of the initial spotify plugin implementation. The reason for adding is explained in a comment, I don't think it is up to date anymore. We would need to test if spotify still has issues with ascii. refs:
Addition: |
As there wasn't any commit from @dhruvravii for some time on this. I just added a config option to enable the legacy behavior and adjusted the tests to check for ascii encoding. Hope we can get this going again. |
@beetbox/maintainers Could we get another look and some feedback here? I think this is an easy win. |
d33337f
to
dde48a9
Compare
a test to check if the query is ascii/nonascii.
dde48a9
to
aea30a1
Compare
@semohr just had a high level look on this and trying to think about what's best from a user's point of view. I often have diffculties finding things on spotify and yes the @mgoltzsche issue you found might also be related to all this. Basically I think your idea of keeping the original "decode to asciii" strategy with a config option is good and should stay. But also my first thoughts went to something similar to what @wisp3rwind suggested initially: The idea of searching with the original unicode string and then falling back on bad (zero) results to the ascii strategy is worth considering! Would that be difficult to implement? And last but not least: Does the original idea of the contributor make any sense? Only searching in ascii if all is ascii in the first place? Just throwing this idea in the mix again... |
I think it would be rather difficult to reliable check. Getting zero result is quite unusual even for wrong queries. For instance
I don't think this makes any difference, we send a string-query to spotify (spotify expects utf-8 afaik) and will treat any string identical. Whether we convert or query to a single byte representation (ascii) should therefore make no difference here. I'm not even sure if python treats ascii and utf-16 different... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the essential code changes are only a few lines and depend on a config option this is a minimal change and the old behavior can be reverted / be experimented with if people want that. Tiny grammar correction within. Thanks for resurrecting and polishing this PR @semohr
Also I see the point now that it is difficult to decide if zero results is a bad result or if "random" results is worse. So let's keep it simple!
Co-authored-by: J0J0 Todos <2733783+JOJ0@users.noreply.github.com>
It seems like windows tests are broken at the moment. Will wait with the merge until they are fixed :) |
…eetbox#5705) Fixes an issue where each spotify query was converted to ascii before sending. Adds a new config option to enable legacy behaviour. A file called japanese_track_request.json was made to mimic the Spotify API response since I don't have the credentials. Entries in that will need to be modified with the actual entries. Co-authored-by: Sebastian Mohr <sebastian@mohrenclan.de> Co-authored-by: Sebastian Mohr <39738318+semohr@users.noreply.github.com> Co-authored-by: J0J0 Todos <2733783+JOJ0@users.noreply.github.com>
…eetbox#5705) Fixes an issue where each spotify query was converted to ascii before sending. Adds a new config option to enable legacy behaviour. A file called japanese_track_request.json was made to mimic the Spotify API response since I don't have the credentials. Entries in that will need to be modified with the actual entries. Co-authored-by: Sebastian Mohr <sebastian@mohrenclan.de> Co-authored-by: Sebastian Mohr <39738318+semohr@users.noreply.github.com> Co-authored-by: J0J0 Todos <2733783+JOJ0@users.noreply.github.com>
Fixes for Issue #5699 (close #5699)
Have made changes to spotify.py (in lines 399 - 407) to allow Chinese and Japanese characters to be read. Previously these were converted to their ASCII values which led to them not being matched. Made changes to test_spotify.py to check parsing of Chinese and Japanese characters. The changes were tested and passed.
A file called japanese_track_request.json was made to mimic the Spotify API response since I don't have the credentials. Entries in that will need to be modified with the actual entries.
Let me know if any changes need to be made.