Add support for serving #EXTM3U formatted .m3u's?

View: New views
1 Messages — Rating Filter:   Alert me  

Add support for serving #EXTM3U formatted .m3u's?

by Anders Skogheim Liane :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,
first post to the list, I have been using Edna for some time.

A little idea: I really like to have the songs properly formatted in
my playlist before they are actually played, and added a really dirty
hack to accomplish this.

I saw that Alan Martin suggested something like it in 2001, but it
seems to have been forgotten :)

The EXTM3U format is simple: The first line of the file needs to be
#EXTM3U, and then you add a line containing the metadata you want from
the file before the path/url. A one song m3u might look like this:

--snip
#EXTM3U
#EXTINF:655,3rd and the Mortal - Nightswan - 01 - Neurosis
http://localhost:8080/Albums/3rd%20and%20the%20Mortal/Nightswan/01%20-%20Neurosis.mp3
--snip

Here 655 is the length of the song in seconds, and the rest is of
course artist - album - tracknumber - title, all from MP3Info.

This line will show in xmms or Winamp when you load the list from
Edna. Unfortunately some players seem to choke on it (foobar2000).It
will scan all the files when building a m3u, but it is a lot faster at
it than for instance Winamp, for me it is worth the extra wait.

The code added in make_list where the url is appended:

--snip
        base, ext = os.path.splitext(name)
        if extensions.has_key(string.lower(ext)):
          # add the song's URL to the list we're building
          try:
            songinfo = FileInfo(fullpath+'/'+name)
            songs.append('#EXTINF:'+str(songinfo.total_time)+ ',' +
str(songinfo.artist) + ' - ' + str(songinfo.album)+' - ' +
str(songinfo.track) + ' - '+ str(songinfo.title) + '\n')
          except:
            self.log_message('Extinf error file ' +fullpath)
          songs.append(self.build_url(url, name) + '\n')
--snip

I never coded Python before, so go easy on me :)
This is dirty, has pretty poor error checking and so on, but it works
nicely for me as all my mp3's are properly tagged.

If anyone with better abilities than me feel like giving it a go, I'm
sure it could be made configurable and a lot more stable.

Any thoughts?

Regards,
Anders Liane
_______________________________________________
edna mailing list
edna@...
http://mailman.lyra.org/mailman/listinfo/edna
LightInTheBox - Buy quality products at wholesale price