Go Back   Winamp & SHOUTcast Forums > Developer Center > Winamp Development

Reply
Thread Tools Search this Thread Display Modes
Old 18th November 2005, 02:08   #1
funkywizard
Junior Member
 
Join Date: Nov 2005
Posts: 2
php script to create a pls file for winamp from the ogg's in a directory

hey guys, does anyone know what it would take, or better yet, have a script for me, whereby there is a folder of .ogg's on a web server, and it makes a .pls file out of those files, complete with the proper song times and titles taken from the id tags in the oggs?

i need to get this going for a website service im launching, and i just have no idea how to start.
funkywizard is offline   Reply With Quote
Old 18th November 2005, 11:17   #2
CraigF
Passionately Apathetic
Administrator
 
CraigF's Avatar
 
Join Date: May 2000
Location: Hell
Posts: 5,435
using this: http://www.getid3.org/

PHP Code:
<?php
header
('Content-type: audio/x-scpls');
require_once(
'getid3.php');
$getID3 = new getID3;
$count 1;


//pls header
echo "[playlist]\n";


if (
$dh opendir(".")) {
    while ((
$file readdir($dh)) !== false) {
        if ((
$file!=".") && ($file!="..") && is_file($file)) {
            if ((
substr(strrchr($file"."), 1)==".ogg") {
                
$fileinfo $getID3->analyze($file);
                
//file entry
                
echo "File".$count."=http://www.mysite.com/".$file."\n";
                echo 
"Title".$count."=".$fileinfo['tags']['title'][0]."\n";
                echo 
"Length".$count."=".intval($fileinfo['playtime_seconds']=>double())."\n";
                
$count++;
            }
        }
}

//pls footer
echo "NumberOfEntries=".($count-1)."\n";
echo 
"Version=2\n";
?>
not tried it at all since i dont have the required library, or any ogg files for that matter. but it should give you a clue. You'll need to make some edits depending on where you store your files.

Also, its likely that the title string wont work. since i dont have any example files to play with and im just going by what the documentation for getid3 seems to say. its quite likely that array location wont include the data you're after. I'd do a print_r on the $fileinfo at that stage and see where the title gets placed and format my title string appropriatly.

CraigF is offline   Reply With Quote
Old 19th November 2005, 03:50   #3
funkywizard
Junior Member
 
Join Date: Nov 2005
Posts: 2
ah i found a tool like that, netjuke-toolkit has getid3 in it, only problem now is i need to install the vorbis tools on my server before i get any farther.
funkywizard is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > Winamp Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump