google-code-export / musicpm

Automatically exported from code.google.com/p/musicpm
0 stars 0 forks source link

custom cover art URL {path} substitution #67

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
There are two problems with the path variable substitution;

1) it uses encodeURI() for url encoding, but valid paths may include @ or
#, a pactical example is "Aimee Mann - @#%&x! Smilers"

Using encodeURIComponent() instead fixes the issue.

2) mpd treats multi song flac files as directories, so
"http://myserver/music/{path}/cover.jpg" would become
"http://myserver/music/Aimee Mann - @#%&x! Smilers/Aimee Mann - @#%&x!
Smilers.flac/cover.jpg" instead of the required
"http://myserver/music/Aimee Mann - @#%&x! Smilers/cover.jpg"

Attached is a simple patch that fixes both issues.

Original issue reported on code.google.com by leon.van...@gmail.com on 16 Mar 2010 at 8:34

GoogleCodeExporter commented 9 years ago
Here's the diff

Original comment by leon.van...@gmail.com on 16 Mar 2010 at 8:39

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Leon,

The problem is much more complex than initially thought.
It is because there's some special characters that are not encoded with 
encodeURI.
I thought it could have been solved with encodeURIComponent, but this function
encodes '/' as well.

checkout these pages :
https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Functions/
encodeURI
https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Functions/
encodeURIComponent

I'm currently testing a solution...

Original comment by aurelien...@gmail.com on 22 Apr 2010 at 1:21

GoogleCodeExporter commented 9 years ago

Original comment by aurelien...@gmail.com on 22 Apr 2010 at 1:29