-
Notifications
You must be signed in to change notification settings - Fork 205
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
Wrong album art when title includes ampersand (no urlencode on GET request ?) #714
Comments
|
Yes it's true... If the album name contains "&", the local cover search takes the 1st track filename as a directory and searches in subdirs of it. Instead of using the parent directory. |
In MPDroid/src/main/java/com/namelessdev/mpdroid/cover/AbstractWebCover.java, instead of properly urlencoding the text, I see this attempt to change spaces to %20. This will easily break with any non-english language, and probably also with hyphens in album names (although I didn't check):
In my limited knowledge, cause I do embedded C, I understand that the proper way to do this is to use the URI class and its toURL() method. At top level you build a hierarchical URI with the query and then construct a proper URL before sending the GET request. However, while browsing the source code, this will probably involve a lot of rewriting, so a package like URLEncoder would be a better option. request = URL + "?method=album.getInfo&artist=" + albumInfo.getArtist() + "&album=" Both albumInfo.getArtist() and albumInfo.getAlbum() need to be urlencoded. A trivial solution like the above "space escaping" can't be applied here since it will break the '&' used for parameter separation. Should I try to fix it myself ? |
We had a lot of problems with that code (and seriously rewritten it a THOUSAND times), especially with slashes ending up URL Encoded, which broke. Don't know why it's that way, but you also have to take into account that even with the builder, we have to use user added URLs that may contain slashes, that shouldn't be escaped. so it's really annoying to deal with. |
Can't the strings be escaped just when coming into this cover searching stuff? You would avoid confusion with parameter sep. |
And what does the local server problem have to do with it? |
Hmm they could be escaped before yeah. What's the local server problem ? |
Using files as directories and searching for cover.jpg there |
Perhaps: request = URL + "?method=album.getInfo&artist=" + URLEncoder.encode(albumInfo.getArtist(),"utf-8") + "&album="+ URLEncoder.encode(albumInfo.getAlbum(),"utf-8") + "&api_key=" + sKey; will do ? (at least in LastFMCover.java) |
Oh I see, you pass AlbumInfo, so you will have to do this everywhere ... |
I would change the ICoverRetriever.getCoverUrl to use album and artist name Strings (have to rewrite all implementing classes), and URLencode these in CoverManager. |
The local cover problem occurs when I press "reset cover", then the AlbumInfo.mParentDirectory suddenly contains the first track's filename |
After browsing some files, I still think it is easier to just urlencode inside specific superclasses for each provider; they build the query string and extend AbstractWebCover, all query strings are different. |
One could add a getCoverUrl(Albuminfo) in AbstractWebCover which calls like this
|
should fix remote part of abarisain#714
should fix remote part of abarisain#714
Oh, I see, my knowledge of object oriented and Java is very limited. LocalCover still requires AlbumInfo as a parameter cause it uses albumInfo.getFilename(), but I guess method overloading handles this ? |
Yes, LocalCover is not an AbstractWebCover so it's not changed here |
Any chances to have this merged/backported and updated in Play store in a reasonable future or should I get a zip and build it myself ? Thanks! |
We're really really late on play store releases anyway, and will be for a 2015-04-27 20:33 GMT+02:00 scaprile notifications@github.com:
|
My fork has also a lot of other patches, some of which are bugfixes, too, and I am waiting to be accepted for ages ... |
No problem at all, thank you both |
should fix remote part of abarisain#714
should fix remote part of abarisain#714
should fix remote part of abarisain#714
should fix remote part of abarisain#714
should fix remote part of abarisain#714
should fix remote part of abarisain#714
Hi there,
using latest version from play store, album art off the Internet.
Albums like Dream Theater's Black Clouds & Silver Lining or Maceo Parker's Roots & Grooves get wrong album art. This looks as if an HTTP GET request is not urlencoded and so the '&' is interpreted by the server as a field separator.
Best regards,
The text was updated successfully, but these errors were encountered: