Click here to Skip to main content
Click here to Skip to main content

MP3 Playlist Generator

, 2 Jul 2003 CPOL
Rate this:
Please Sign up or sign in to vote.
This is a free tool for enumerating a specifically-structured MP3 collection and creating .m3u playlist files.
<!-- Article image -->

Sample Image - playlistgenerator.gif

<!-- Add the rest of your HTML here -->

Generated HTML file without stylesheet applied

Introduction

I wrote this tool because I grew tired of manually creating playlists each and every time I added an album to my collection. The tool recurses the directories of a specifically-structured MP3 collection on your hard disk. During the enumeration, several MP3 playlist files are created, allowing you to access your collection via a Web page.

This tool is for you if:

  • Your collection contains entire CDs and is arranged by artist and album (see "Directory Structure" below).
  • Your collection resides on a machine capable of being a Web server.

If you don't meet the above requirements, then please stop reading here.

Terminology

Host Name Your Web server's host name (e.g., server in the URL http://server/).
Virtual Directory The path in the URL that points to your MP3 collection (e.g., mp3 in the URL http://server/mp3/).
MP3 Root Directory The physical path on disk to your MP3 collection (e.g., E:\mp3).

Directory Structure

The playlist generator will work for you if your collection has the following directory structure:

  • <MP3 Root>
    • <Artist0>
      • <Album0>
        • <Song0>.mp3
        • <Sing1>.mp3
          ...
        • <SongN>.mp3
      • <Album1>
        • <Song0>.mp3
        • <Sing1>.mp3
          ...
        • <SongN>.mp3
    • <Artist1>
      • <Album0>
        • <Song0>.mp3
        • <Sing1>.mp3
          ...
        • <SongN>.mp3
      • <Album1>
        • <Song0>.mp3
        • <Sing1>.mp3
          ...
        • <SongN>.mp3
      ...
    • <ArtistN>
      • <Album0>
        • <Song0>.mp3
        • <Sing1>.mp3
          ...
        • <SongN>.mp3
      • Album1>
        • <Song0>.mp3
        • <Sing1>.mp3
          ...
        • <SongN>.mp3

The artist, album, and song names do not have to be in any particular format; however, I find that prepending the track number to the song name helps if you like to listen to the tracks in the same order that they appear on the CD. A typical directory might look like the following:

  • mp3
    • Weird Al Yankovic
      • Permanent Record - Al In The Box - Disc 1
        • 01 My Bologna.mp3
        • 02 Another One Rides The Bus.mp3
          ...
        • 12 King Of Suede.mp3

The physical path on disk to such a directory would look like this: <drive letter>:\mp3\Weird Al Yankovic\Permanent Record - Al In The Box - Disc 1\.

Files Created During Execution (.htm and .m3u)

The following files are created during the execution of the MP3 Playlist Generator:

index.htm Located in the MP3 Root Directory, this file contains links to all of the generated .m3u files, sorted alphabetically by artist and album. This is the file that you access via the Web server.
(e.g., <MP3 Root Directory>\index.htm)
All.m3u Located in the MP3 Root Directory, this playlist contains entries for all songs by all artists in your collection
(e.g., <MP3 Root Directory>\All.m3u)
<Artist>.m3u Located in the artist's directory, these playlists contain entries for all songs in all albums for the specified artist
(e.g., <MP3 Root Directory>\Weird Al Yankovic\Weird Al Yankovic.m3u)
<Album>.m3u Located in each album's directory, these playlists contain entries for all songs in a particular album.
(e.g., <MP3 Root Directory>\Weird Al Yankovic\Permanent Record - Al In The Box - Disc 1\Permanent Record - Al In The Box - Disc 1.m3u)

If the files already exist, their contents are truncated, so each time the program is run, the playlists and the HTML files are all refreshed.

Setting Up Your MP3 Server

Enable IIS

In order to access the Web page created by the MP3 Playlist Generator, you will need to enable IIS. Please refer to your OS's documentation on how to install and enable IIS.

Create a Virtual Directory for your MP3 Root Directory

In the IIS MMC snap-in, create a virtual directory for your MP3 Root Directory. Please refer to your OS's documentation on how to create a virtual directory.

Enable Default Document Support for index.htm files

If not already enabled for your Web server, enable default document support for index.htm files. Please refer to your OS's documentation on how to enable default document support for specific file types.

Running the MP3 Playlist Generator

  • Copy the program to anywhere on your hard drive and launch it.
  • Insert appropriate values for Host Name, Virtual Directory, and MP3 Root Directory.
  • Click the "Generate .m3u Files" button.

That's it! You should now be able to browse to http://<Host Name>/<Virtual Directory>/ and view a list of your MP3 collection!

To-do List

This tool is by no means polished. Here is a short list of enhancements that I need to make:

  • Add stylesheet for generated HTML file (it's on my home computer, which doesn't have an Internet connection at the moment)
  • Persist user's settings in the registry. Currently, they are hard-coded into the app.
  • Insert a browse dialog to allow users to browse for their MP3 Root Directory.
  • Add a "last generated" timestamp to the HTML file.
  • Add statistics to the HTML file (# artists, # albums, # songs).

If you have any features you would like to see, please post them in the forum below.

History

Version Comments
1.0.0
03 Jul 2003
Initial public release.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Jon Sagara
Software Developer (Senior) Sagara Software, Inc.
United States United States
Jon graduated from Cal Poly with a B.S. Computer Engineering. He is currently building a Silverlight-based report scheduling interface for a pharmaceutical reporting company.
 
When he's not fooling around with computers or reading, he's busy spending time with his super wife, Kelly, his two boys, and their rambunctious dog, Homer.
 
Visit my blog
Follow on   Twitter

Comments and Discussions

 
GeneralXSPF and PLS playlist Pinmemberlegenie28-Apr-09 3:43 
GeneralAll m3u files generated.. all right.. but.... [modified] PinmemberKatataniel17-Jul-07 6:25 
GeneralRe: All m3u files generated.. all right.. but.... PinmemberKatataniel17-Jul-07 10:01 
GeneralRoot Directory Problem Pinmemberjstrain@8-Dec-04 10:24 
GeneralWMA support... Pinmemberrcaddyuk10-Oct-04 3:37 
GeneralRe: WMA support... PinmemberJon Sagara10-Oct-04 3:39 
GeneralAnother Novice Question - PHP/MySQL app doing same PinmemberWireless Tech Radio10-Sep-04 7:33 
GeneralRe: Another Novice Question - PHP/MySQL app doing same PinmemberJon Sagara10-Sep-04 7:49 
GeneralQ from a novice Pinmemberjkwipr19-May-04 10:31 
GeneralRe: Q from a novice PinmemberJon Sagara10-Sep-04 8:25 
Questionroot directory? Pinmemberroguedis17-Mar-04 16:56 
AnswerRe: root directory? PinmemberJon Sagara19-Mar-04 13:31 
GeneralRe: root directory? Pinmemberroguedis21-Mar-04 0:37 
GeneralRe: root directory? Pinmemberdiz90007-Sep-04 3:17 
GeneralRe: root directory? PinmemberJon Sagara7-Sep-04 9:21 
GeneralFew more suggestions PinmemberKant4-Jul-03 6:46 
GeneralRe: Few more suggestions PinmemberJon Sagara5-Jul-03 6:33 
GeneralNice! PinmemberRavi Bhavnani4-Jul-03 4:36 
GeneralRe: Nice! PinmemberJon Sagara4-Jul-03 6:29 
GeneralFew suggestions PinmemberSnakebyte3-Jul-03 21:02 
GeneralRe: Few suggestions PinmemberJon Sagara4-Jul-03 6:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141216.1 | Last Updated 3 Jul 2003
Article Copyright 2003 by Jon Sagara
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid