Skip to Content Skip to Menu

XSPF Profile Player

18 years 9 months ago #3991 by alistaircochrane
XSPF Profile Player was created by alistaircochrane
Hello all... I've been trying to build an XSPF (XML Shareable Playlist Format) Player plugin for for the last 2 days without getting anywhere. I though I would ask for advice.

I was tipped off about XSPF player by someone on here called signup.It's a flash music player that reads XSPF files.

You can download it here:
www.thefword.fm/xspf_player-0.2.2.zip

and read about it here:
musicplayer.sourceforge.net/

I then searched around a bit and found a php script that will convert all the mp3 files in a specified folder into an XSPF playlist.

You can download and read about it here:
www.dreden.com/2005/06/01/xspf-playlist-generator/

[code:1]<?php

#####################################################################
#
#
# Automatic XSPF Playlist generator PHP Script v1.2
#
# Script made by dreden (Odd Marthon Lende)
# Downloaded from www.dreden.com
#
# If you want to sort your music by number you need to add the number to the beginning of the filename
#
#
#########################



// options

// Reverse the playlist by default. Set to true if yes.

$reverse = false;

// Shuffle the playlist by default. Set to true if yes.

$shuffle = false;

// use getid3() or use the old method to get artist and titles?

$useid3 = false;
$getid3file = "getid3/getid3.php";

// the directory that contains the music files

$musicdir = "./musikk";

// the url path to the music directory

$path = " www.dreden.com/music/ ";

// want to give listeners the ability to download the songs? set to true if yes or false if no

$download = true;

// what to remove from the title, so it looks nice?
// this is not use if $useid3 = true;

$cleanuptitle = array('/www.dreden.com-/', '/.mp3/');

// if you have $cleanuptitle = array('/string1/', 'string2', 'string3'); above, you need to set this to $cleanup = array('', '', '');
// or anything else you want the strings above to be replaced with.
// This is not use if $useid3 = true;

$cleanup = array('', '');

// self explained

$image = " www.dreden.com/images/about_me.jpg ";
$creator = "Odd Marthon Lende";
$infourl = " www.dreden.com/music/ ";
$annotation = " www.dreden.com/ ";
$title = "Dredens Music on dreden.com";

// end options

### NO NEED TO EDIT BELOW THIS LINE ###

if ($useid3) {
require_once($getid3file);
$getID3 = new getID3;
}

if (is_dir($musicdir)) {
$i = 0;
print ('<?xml version="1.0" encoding="UTF-8" ?>
<playlist version="0" xmlns=" xspf.org/ns/0/ ">
<title>' . $title . '</title>
<annotation>' . $annotation . '</annotation>
<creator>' . $creator . '</creator>
<info>' . $infourl . '</info>
<location>');
print 'http://';
print $_SERVER;
print $_SERVER;

print ('</location>

<trackList>' . "\n" . "\n" . "\n"«»);

if ($handle = opendir($musicdir)) {

while (false !== ($file = readdir($handle)))
{

if ($file == "."«») { $file = ""; } elseif ($file == ".."«») { $file = ""; }

else {

$audiofile[$i] = $file;
$i++;
}
}

closedir($handle);
}
if (isset($_REQUEST)) {
$reverse = $_REQUEST;
}
if (isset($_REQUEST)) {
$shuffle = $_REQUEST;
}
sort($audiofile);
if ($reverse) {
}
else {
rsort($audiofile);
}
if ($shuffle) {
shuffle($audiofile);
}
reset($audiofile);
for($j = 0; $j < count($audiofile); $j++) {

if($useid3) {
$filename = "$musicdir" . "/" . "$audiofile[$j]";
$fileinfo = $getID3->analyze($filename);
}
else {
$songtitle = preg_replace($cleanuptitle, $cleanup, $audiofile[$j]);
$songtitle = eregi_replace("_", " ", $songtitle);
$songtitle = eregi_replace("-", " ", $songtitle);
}

print "<track>" . "\n";
print ("<location>" . $path . $audiofile[$j] . "</location>" . "\n"«»);
if ($download) {
print ("<download>" . $path . $audiofile[$j] . "</download>" . "\n"«»);
}
print ("<image>" . $image . "</image>" . "\n"«»);
if ($useid3) {
print ("<annotation>" . $fileinfo . " - " . $fileinfo . "</annotation>" . "\n"«»);
}
else {
print ("<annotation>Dreden - " . $songtitle . "</annotation>" . "\n"«»);
}
print ("<info> www.dreden.com/music/ " . "\n"«»);
print ("</track>" . "\n" . "\n"«»);
}
print ('
</trackList>
</playlist>');
}
else {
echo "<font color=\"red\"><center><h2>ERROR:<br>\nthe directory $musicdir can not be found\n<br>please check your configuration</h2></center></font>";
}
?> [/code:1]

You embed the flash movie using html and reference the xspf_playlist.php file as in the url as though it was a playlist.

[code:1]<object classid=”clsid:«»D27CDB6E-AE6D-11cf-96B8-444553540000″ codebase=”http://download.macromedia.com/pub/shockwave/
cabs/flash/swflash.cab#version=6,0,29,0″ width=”184″ height=”170″>
<param name=”movie” value=”http://server.com/xspf_player.swf?playlist_url=http://server.com/xspf_playlist.php”>
<param name=”quality” value=”high”><param name=”BGCOLOR” value=”#D5D5D5″>
<embed src=”http://server.com/xspf_player.swf?playlist_url=http://server.com/xspf_playlist.php” width=”184″ height=”170″ quality=”high” pluginspage=”http://www.macromedia.com/go/getflashplayer” type=”application/x-shockwave-flash” bgcolor=”#D5D5D5″>
</embed>
</object>[/code:1]

I'm afraid if you read all this way there is no solution... I've never used php before and I'm new to Joomla as well. This is about as far as I got!


We run an online radio station and plan to allow bands/artists that use our site to have a player on their cb profile page to showcase their own music. Like My Space.

All the songs will be reviewed by site admin so frontend uploading is not required. Admin could FTP the mp3's into a directory which could be named after each user id.

I know everyone is busy but I only got as far as creating a blank tab but couldn't even figure out how to embed the flash movie on the tab... let alone modifying the playlist script to check a folder based on the user id.

Could anyone describe how they would go about integrating this script and the xspf player with community builder to allow members to have a music player on their profile.

Another idea is that the mp3 files could contain the joomla user id... i think the file name is parsed already...

Also.. there needs to be a way so that if no mp3 files are in the users directory then the tab doesn't show on the profile. We only want artists and bands to have a music player.

Any advice that anyone has would be appreciated very very very much.

and of course if anyone wants to just create the plugin that would be great as well!! ;)

Post edited by: alistaircochrane, at: 2006/01/17 00:50

Post edited by: alistaircochrane, at: 2006/01/17 00:52

Post edited by: alistaircochrane, at: 2006/01/17 00:53

Please Log in or Create an account to join the conversation.

18 years 9 months ago #3995 by alistaircochrane
Replied by alistaircochrane on topic Re:XSPF Profile Player
I don't know if it's relevant but i read that Docman....

"Documents can be owned by a specific registered user, a groups os registered users, all registered users or everybody"

I though maybe this would help. But i'm clueless really!!

Please Log in or Create an account to join the conversation.

  • pointri
  • pointri
  • OFFLINE
  • Posts: 118
  • Thanks: 0
  • Karma: 27
18 years 9 months ago #4030 by pointri
Replied by pointri on topic Re:XSPF Profile Player
Hi Alistair,

This code looks similar to what I've seen in Joseph Leblanc's MP3 Player component, but easier to integrate.

To get just what you need, it looks like the flash player just needs to be wrapped into a plugin's display tab, then 'hooks' set up in the playlist-making .php file you posted to read from MP3 directories set up for each of your performers. So, where there are constants at the beginning of the script indicating the directory and whatnot, you'd use user IDs or usernames instead.

I have some time this weekend to tinker with it. I'm not much of a PHP programmer either, but I can clearly see how this could be patched together.

Joomlapolitan zealot and a somewhat stealthy, rather passive CB3PD developer.
www.constructionlounge.com Construction Lounge: Online resource and networking portal for the construction and remodeling industries.

Please Log in or Create an account to join the conversation.

18 years 9 months ago #4050 by alistaircochrane
Replied by alistaircochrane on topic Re:XSPF Profile Player
pointri wrote:

the flash player just needs to be wrapped into a plugin's display tab


How can this be done? This is where I got to then gave up!

Please Log in or Create an account to join the conversation.

  • pointri
  • pointri
  • OFFLINE
  • Posts: 118
  • Thanks: 0
  • Karma: 27
18 years 9 months ago #4070 by pointri
Replied by pointri on topic Re:XSPF Profile Player
Take a look at the bare bones plugin in this thread:

www.joomlapolis.com/component/option,com_joomlaboard/Itemid,/func,view/catid,13/id,3811/#3811

The getdisplayTab() function draws a tab that would show up in a user's profile. It's the place to put that HTML code that embeds the flash player. It'd also need a line including the .php script that generates the playlist.

You don't need to put anything in the getEditTab() function, but this would be the place potentially for an uploader or user-defined parameters for the player (shuffle, ability to download, whatever).

So my understanding is that a plugin would minimally contain a PHP script, setting the functions in CB's API (in the downloads section) that draw the tabs, an XML installer file and a blank index.html file. For this plugin, you'd also need to package the playlist generator script you posted and the player.

Joomlapolitan zealot and a somewhat stealthy, rather passive CB3PD developer.
www.constructionlounge.com Construction Lounge: Online resource and networking portal for the construction and remodeling industries.

Please Log in or Create an account to join the conversation.

18 years 9 months ago #4315 by alistaircochrane
Replied by alistaircochrane on topic Re:XSPF Profile Player
Any luck over the weekend Pointri?

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum