Click here to Skip to main content
6,595,854 members and growing! (21,679 online)
Email Password   helpLost your password?
Web Development » Applications & Tools » Tools with source code     Intermediate License: The Code Project Open License (CPOL)

MP3 Playlist Generator

By Jon Sagara

This is a free tool for enumerating a specifically-structured MP3 collection and creating .m3u playlist files.
VC6Win2K, WinXP, Win2003, Visual Studio, MFC, Dev
Posted:2 Jul 2003
Views:166,912
Bookmarked:24 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
10 votes for this article.
Popularity: 3.78 Rating: 3.78 out of 5
1 vote, 10.0%
1

2
3 votes, 30.0%
3
1 vote, 10.0%
4
5 votes, 50.0%
5

Sample Image - playlistgenerator.gif

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)

About the Author

Jon Sagara


Member
Jon graduated from Cal Poly with a B.S. Computer Engineering. He has worked at a backup software company, a small software company in the medical services industry, a startup, a large chip maker, an online insurance broker, and, most recently, for a vendor of a large Redmond-based software company.

When he's not fooling around with computers or reading, he's busy spending time with his super wife, Kelly, his baby boy, and their rambunctious dog, Homer.

Visit my blog

---

View my old profile pictures
Occupation: Software Developer (Senior)
Location: United States United States

Other popular Applications & Tools articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 21 of 21 (Total in Forum: 21) (Refresh)FirstPrevNext
GeneralXSPF and PLS playlist Pinmemberlegenie3:43 28 Apr '09  
GeneralAll m3u files generated.. all right.. but.... [modified] PinmemberKatataniel6:25 17 Jul '07  
GeneralRe: All m3u files generated.. all right.. but.... PinmemberKatataniel10:01 17 Jul '07  
GeneralRoot Directory Problem Pinmemberjstrain@10:24 8 Dec '04  
GeneralWMA support... Pinmemberrcaddyuk3:37 10 Oct '04  
GeneralRe: WMA support... PinmemberJon Sagara3:39 10 Oct '04  
GeneralAnother Novice Question - PHP/MySQL app doing same PinmemberWireless Tech Radio7:33 10 Sep '04  
GeneralRe: Another Novice Question - PHP/MySQL app doing same PinmemberJon Sagara7:49 10 Sep '04  
GeneralQ from a novice Pinmemberjkwipr10:31 19 May '04  
GeneralRe: Q from a novice PinmemberJon Sagara8:25 10 Sep '04  
Generalroot directory? Pinmemberroguedis16:56 17 Mar '04  
GeneralRe: root directory? PinmemberJon Sagara13:31 19 Mar '04  
GeneralRe: root directory? Pinmemberroguedis0:37 21 Mar '04  
GeneralRe: root directory? Pinmemberdiz90003:17 7 Sep '04  
GeneralRe: root directory? PinmemberJon Sagara9:21 7 Sep '04  
GeneralFew more suggestions PinmemberKant6:46 4 Jul '03  
GeneralRe: Few more suggestions PinmemberJon Sagara6:33 5 Jul '03  
GeneralNice! PinmemberRavi Bhavnani4:36 4 Jul '03  
GeneralRe: Nice! PinmemberJon Sagara6:29 4 Jul '03  
GeneralFew suggestions PinmemberSnakebyte21:02 3 Jul '03  
GeneralRe: Few suggestions PinmemberJon Sagara6:39 4 Jul '03  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 2 Jul 2003
Editor: Nick Parker
Copyright 2003 by Jon Sagara
Everything else Copyright © CodeProject, 1999-2009
Web17 | Advertise on the Code Project