mopidy / mopidy

Mopidy is an extensible music server written in Python
https://mopidy.com
Apache License 2.0
8.03k stars 686 forks source link

Enhance M3U UTF-8 encoding support #1370

Open tkem opened 8 years ago

tkem commented 8 years ago

As observed by @Joolee in #1364, there are several issues with the M3U backend's current (lack of) UTF-8 encoding support:

Generally speaking, the M3U backend badly needs some love, and also a major refactoring IMHO.

tkem commented 8 years ago

Note that @Joolee's patch uses the external chardet module, which is not used by Mopidy yet. Whether we want to introduce an additional dependency remains TBD. This wouldn't be much of an issue if the M3U backend was split from Mopidy core, as already planned, and made a separate extension.

jodal commented 8 years ago

I'd prefer to not add any deps as long as it is part of Mopidy core.

adamcik commented 8 years ago

Then BOM check can probably be done just fine without the extra chardet module, as we only need that if we want to guess what the rest of the file is. An other option could also just be to have a list of encodings to fallback to. But at the same time I'd rather kill our playlist parsing in favor of the totem libs.

tkem commented 8 years ago

@adamcik: Parsing is just "half" part of the API - do the totem libs also support writing playlists? @jodal: Me too, so as a first step I consider making the encoding for *.m3u configurable, with default latin1 but can be set to utf-8-sig by the user.

kingosticks commented 8 years ago

https://developer.gnome.org/totem-pl-parser/3.10/TotemPlParser.html#totem-pl-parser-save Looks like it supports writing and manipulation too.

tkem commented 8 years ago

@kingosticks: Thanks! However, since totem-pl supports several playlist formats, I'm wondering whether this shouldn't become a separate backend.