XSPF automatic playlist generator

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
elmarko
New Member
New Member
Posts: 5
Joined: Sat Apr 14, 2007 11:35 pm

XSPF automatic playlist generator

Post by elmarko »

Using: CMS Made Simple 1.5.4  Apache 2.2.11 (Unix) PHP version 5.2.9 MySQL version 5.0.67

Installed relevant modules: dewplayer, enhanced xspf, front end file management (uploads)

Url: http://oportobar.co.uk/index.php/music

Hi, I was wondering if anyone could suggest a solution to this issue, I'd like an auto playlist generator, (like the XSPF one on http://sourceforge.net/projects/php-xspf-gen/) so that when files are uploaded to a folder they will automatically be added to the playlist with no further user input. I've found that dewplayer will do this but is limited in functionality whilst enhanced xspf has the functionality but not the auto playlist generator.

I used the hack to stop enhanced xspf logging out.

As an interim solution I've resorted to trying to use the XSPF player and generator from the link above but when I place the generator.php in the uploads folder next to the mp3 folder it seems that there is something happening which means that the files in the uploads folder is returning a error of undefined for the playlist.

When ran from its default settings the XSPF player picks up the playlist, so I'm wondering what it is that I am missing?

Any help/ideas would be fantastic as I've been trying to fix this issue for about 2 weeks now and I know there is just something I am not seeing here.

Cheers
Mark
viebig

Re: XSPF automatic playlist generator

Post by viebig »

Can you post the generator here and if possible provide a link.


Probably that can be achieved using an UDT.


Regards

G
elmarko
New Member
New Member
Posts: 5
Joined: Sat Apr 14, 2007 11:35 pm

Re: XSPF automatic playlist generator

Post by elmarko »

Cool, thanks for your help. This is the playlist generator bundled with the XSPF player on the source forge page, there is a link on the original post:

encoding = 'ISO 8859-1';

$dir = PATH . "/" . MP3_PATH;
// Read directory
if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            $full_name = "$dir/$file";
            if (is_file($full_name)) {
                $files[$full_name] = $file;
            }
            elseif ($file[0] != '.') {
                $dir[$full_name] = $file;
            }
      }
      closedir($dh);
  }
}

// Produce output
if ($files) {

print


   
   

END_HEADER;

if ($_REQUEST['shuffle']=="true") {
shuffle($files);
} else {
    asort($files);
}

$counter = $i = 0;
    foreach ($files as $full_name => $short_name) {

    $getid3->Analyze($dir . "/" . $short_name);
   
        $artist = $title = '';
            if (@$getid3->info['tags']) {
            foreach ($getid3->info['tags'] as $tag => $tag_info) {
                if (@$getid3->info['tags'][$tag]['title']) {
                    $artist = @$getid3->info['tags'][$tag]['artist'][0];
                    $title  = @$getid3->info['tags'][$tag]['title'][0];
                    $album  = @$getid3->info['tags'][$tag]['album'][0];
                    break;
                } else {
$title  = basename($short_name, ".mp3");
}
            }
        } else {
$title = basename($short_name, ".mp3");
}

        $url = ROOT . "/" . MP3_PATH . "/" . $short_name;
       
        if (strpos($url, "http://") === false) {
        $url = "http://" . $url;
        }
       
        $info = ROOT;
       
        if (strpos($info, "http://") === false) {
        $info = "http://" . $info;
        }
       
        print
{$url}


{$artist}


{$album}


{$title}


END_TRACK;
}
print

END_FOOTER;
}
?>
viebig

Re: XSPF automatic playlist generator

Post by viebig »

Not very difficult to implement. In fact.. really easy.

Basically it's all done. Just need to be integrated with cmsms, or used standalone on the server.

Right now, I dont have free time to develop this as a free job. Maybe if you can help me feed my family with a few bucks I can do it for you :>.

Can you post a direct link to the generator.php. Try to access it direct and see the error that is returned.

Regards

G
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm

Re: XSPF automatic playlist generator

Post by Jeff »

You said it worked fine until you moved into you uploads folder. Looking through the code there is a bunch of relative links that once you move the file they nolonger pointed in the correct place.
Post Reply

Return to “Modules/Add-Ons”