PHP Classes

M3U Playlist Parser: Parse M3U playlist files

Recommend this page to a friend!
  Info   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (3)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 49%Total: 1,260 All time: 3,043 This week: 69Up
Version Licenses PHP version Categories
m3u-class 2.1.5Free for non-comm...5.0.0PHP 5, Files and Folders, Audio, Parsers


This class (rewritten from the old M3U Playlist Parser) now features optimized code and is more user friendly (function-wise) than that of the older M3U Playlist parser. You're now able to search through M3U entry titles and locations using multi-(or single) search and case[in]sensitive searching as well. You're able to pull records out that have a play time (in seconds) that are less than, less than or equal to, greater than, greater than or equal to or in between a $START and $END seconds time.

I've also included a (quite long) function that outputs a "pretty" and human-readable format which includes the song titles, locations and track time. You're able to customize the table output (if you use a table) or you can use plain-text output (which isn't pretty at all, mind you). The output of this also includes some "statistics" about the M3U, such as total tracks and combined playlist playing time (HH:MM:SS).

Hope you enjoy this new release, and as always, please contact me if you have any questions, comments or suggestions - as they might show up in future releases!

Notice: This script is not for any commercial usage without my consent. Thanks!

Warning: I have used this script to parse a playlist file of over 6,000 items without any problems. This script processes M3U files FAST! However, I'm not sure how bad it would be if you were to have anything over 10,000 playlist items - but it depends on the system and its configuration, so use with care.

**Notice** This version is incompatible with any of the lesser versions of 2.1.3. Please be sure to update your functions when calling from an object!

**Updated** 02-14-2010 -- Removed BC Math functions for users without access to the functions themselves.
-- Benchmark results:
- 100,000 Entries parsed in 3.186 seconds (with pretty formatting)
- 100,000 Entries parsed in 1.509 seconds (without any output)
-- Benchmarked system: AMD Athlon X2 4200+ @ 2.45GHz, 2GB RAM

Picture of Robert Widdick
Name: Robert Widdick <contact>
Classes: 3 packages by
Country: United States United States
Age: 36
All time rank: 811111 in United States United States
Week rank: 301 Up34 in United States United States Up

  Files folder image Files  
File Role Description
Plain text file m3u.class.php Class Main Class with examples (Bottom of source) & documentation
Accessible without login Plain text file Skillet.m3u Data Sample m3u file for the band "Skillet"
Accessible without login Image file m3ulogo.png Icon m3u Class Logo
Accessible without login Image file Screenshot.png Output Screenshot

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:3,043
This week:69Up
User Ratings User Comments (2)
 All time
Man oh man, I had been looking for a script just like this on...
14 years ago (deejay solin)
Cool, genial say me.
15 years ago (Isaac Trenado Mx)