devsnd / cherrymusic

Stream your own music collection to all your devices! The easy to use free and open-source music streaming server.
http://www.fomori.org/cherrymusic
GNU General Public License v3.0
1.03k stars 189 forks source link

Can display, but not play, songs with paths that contain unicode #644

Closed thevorpalblade closed 6 years ago

thevorpalblade commented 7 years ago

When I attempt to play songs with a unicode character somewhere in the file path, the playback silently fails. The following path triggers the bug:

/home/matthew/Music/Anaïs Mitchell/Hadestown/13 If It's True.flac

The following error shows up in the log roughly every 100 ms until the song is manually skipped:


ERROR    [2016-10-18 14:59:22,868] : cherrypy.error.3054734508 : from line (217) at
    /usr/lib/python3.5/site-packages/cherrypy/_cplogging.py
    --
    [18/Oct/2016:14:59:22] HTTP 
Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/cherrypy/_cprequest.py", line 670, in respond
    response.body = self.handler()
  File "/usr/lib/python3.5/site-packages/cherrypy/lib/encoding.py", line 220, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/lib/python3.5/site-packages/cherrypy/_cpdispatch.py", line 60, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/usr/lib/python3.5/site-packages/cherrymusicserver/httphandler.py", line 256, in trans
    path = codecs.decode(codecs.encode(path, 'latin1'), 'utf-8')
  File "/usr/lib/python3.5/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xef in position 3: invalid continuation byte
--------------------------------------------------------------------------------

I'm running version 0.37 under arch linux, with python 3.5.2. Testing that the appropriate locales are installed seems to indicate that they are:

>>> locale.getlocale()
('en_US', 'UTF-8')

This seems like it could be related to: https://github.com/devsnd/cherrymusic/issues/595 But I don't have that problem (I can browse to the folder containing this album with no issue) It doesn't seem related to https://github.com/devsnd/cherrymusic/issues/611 or https://github.com/devsnd/cherrymusic/issues/642, since those are throwing ascii decode errors, not unicode decode errors.

tilboerner commented 7 years ago

@thevorpalblade Which version of CherryPy is Cherrymusic using? (It's listed in the output of $ ./cherrymusic --info)

thevorpalblade commented 7 years ago

looks like CherryPy: 8.1.0, which is the latest version in the arch linux community repository.

tilboerner commented 6 years ago

This should be resolved by #659.