mopidy/mopidy — pull request #608 by gitkemmer (2013-12-10 04:55:34+00:00)
Title: Add Support for Extended M3U Playlists

Motivation: To listen to local public radio stations, I have an M3U playlist containing the URIs to the respective live streams. Now, for lack of meta information, clients such as MPoD can only display the URI in their user interface, which may not be very descriptive. Other clients, such as reMPD and MPDroid, just display a blank "title" field. Family members found this embarrasing, so I had to do something about it (quickly).

WIth M3U support, I am able to create a playlist containing a "track title" and optional runtime length information like this:

```
#EXTM3U
#EXTINF:-1,FM4
http://mp3stream1.apasf.apa.at:8000/
#EXTINF:-1,Radio Österreich 1
http://mp3stream3.apasf.apa.at:8000/
#EXTINF:-1,Radio Wien
http://mp3stream17.apasf.apa.at:8000/
```

If an EXTINF comment is present, the title will be mapped to `Track.name`, and a runtime length greater zero will be mapped to `Track.length` (converted to ms). This seems to work fine with all three clients mentioned above. Note that .m3u files have to be in Latin-1 encoding; no support for .m3u8 yet.

When saving playlists, extended format is only used if any of the tracks contains a `name` field. EXTINF comments are also generated only for tracks containing `name` fields.