{MP3} Replacement Tag

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
Post Reply
User avatar
marcus@localhorst
Posts: 815
Joined: Fri 28. May 2004, 11:31
Location: localhorst
Contact:

{MP3} Replacement Tag

Post by marcus@localhorst »

Well, with the very cool MP3 Player made by Nesium.com it's possible to stream external (or internal) mp3 files.
unfortunately, at the moment the player is not for free, but there will come a free player.

for the moment, take a look here:
http://www.fieldmuzick.net/fieldcontent/blogplog.phtml

the custom tag is very simple, every other player, should work with that...

greatings marcus
niels_j
Posts: 8
Joined: Fri 11. Feb 2005, 14:05
Location: Denmark

Post by niels_j »

Is it possible to see the code behind the scenes?

/niels
User avatar
marcus@localhorst
Posts: 815
Joined: Fri 28. May 2004, 11:31
Location: localhorst
Contact:

Post by marcus@localhorst »

ehm, at the moment not really, because the player ist not free :-(

but the PHP code is very simple... you could use every other swf player which stream mp3 from any url.

put the following in a file in the frontend_render folder:
function play_mp3($source='') {

$mp3_playa = '';
$source = preg_replace('/\{MP3:(.*?)\}/e', '"$1"', $source);

$mp3_playa = '<embed write_here_the_code_to_embed_your_swf_mp3_player.swf?var=$source>';
return $mp3_playa;
}


if( ! ( strpos($content["all"],'{MP3:')===false ) ) {
$content["all"] = preg_replace('/\{MP3:(.*?)\}/e','play_mp3("$1");',$content["all"]);
}
write all the code which display the flashplayer in the $mp3_playa var.

in the moment there is a bug but i've got no idea what's happend. i think the regex to catch the url is not fine ;-)

if someone know a free flash mp3 player which loads the mp3 over the url, please tell.

i didn't programm the player, so i can't give it away...
but there will come a free version...

there are a lot free players which uses xml files to load the mp3... :(
niels_j
Posts: 8
Joined: Fri 11. Feb 2005, 14:05
Location: Denmark

Post by niels_j »

I knew the player isn't free. But was hoping to get a hint about howto make my own tag including a .swf file.

I am a little worried about modifying too much of the phpwcms code. especially because a new verrsion is just around the corner.

Another thing is that I haven't studied the phpwcms code in detail so I have no idea about how easy it is to extend with my own code and how easy my modifications is transferred to the next version of the base code.

The test site I'm ttesting phpwcms at this moment has this http://www.1to12.dk/index.php?id=2,0,0,1,0,0 page with a .swf file but it's hardcoded in the page. A tag would be nice :-)

/Niels
Goran
Posts: 81
Joined: Thu 27. Nov 2003, 11:43
Location: Zagreb, Croatia
Contact:

Post by Goran »

Niels, this flash image viewer is very cool...this is your work? If not, can you give me the link where can be downloaded?

thanks
niels_j
Posts: 8
Joined: Fri 11. Feb 2005, 14:05
Location: Denmark

Post by niels_j »

The simple viewer I'm using at the moment is free and can be found at http://www.zoomify.com

If you wan't to modify the source is available for about usd 130

/Niels
Goran
Posts: 81
Joined: Thu 27. Nov 2003, 11:43
Location: Zagreb, Croatia
Contact:

Post by Goran »

Thanks Niels. :)
joransrb
Posts: 53
Joined: Mon 10. Jan 2005, 21:03

Post by joransrb »

Hi...
I would love this function on my site,
how is the development going??

is it possible to see the complete code that you use??
with embeded code and all??
just replace file path with sometinhg...

for me it only returns the "$source" in the var,
like this:

Code: Select all

streammp3.swf?url=$source
instead of:

Code: Select all

streammp3.swf?url=http://domain.com/mp3file.mp3
any suggestions???
User avatar
marcus@localhorst
Posts: 815
Joined: Fri 28. May 2004, 11:31
Location: localhorst
Contact:

Post by marcus@localhorst »

write

Code: Select all

$mp3_playa = '<embed write_here_the_code_to_embed_your_swf_mp3_player.swf?var='.$source.'>'; 
than

Code: Select all

$mp3_playa = '<embed write_here_the_code_to_embed_your_swf_mp3_player.swf?var=$source>'; 


;-) - my mistake
volkman
Posts: 179
Joined: Wed 13. Jul 2005, 12:52
Location: Hamburg, Germany

cool mp3-player

Post by volkman »

the coolest mp3-player is free (gpl), easy to implement, done by marc reichelt.
check a working implementation at http://www.autoteile-discount.de
the player and install instructions can be downloaded at
http://www.marcreichelt.de/spezial/musicplayer/

volkman
User avatar
Fulvio Romanin
Posts: 394
Joined: Thu 4. Dec 2003, 11:12
Location: Udine, Italy
Contact:

Post by Fulvio Romanin »

i have already made an mp3 player to be integrated into fcms and whose playlist is made using the "file list" part. WIll release it in the next days, will ya?
Completeness is reached through subtraction, not through addition
User avatar
marcus@localhorst
Posts: 815
Joined: Fri 28. May 2004, 11:31
Location: localhorst
Contact:

Post by marcus@localhorst »

i should test fcms :-)
User avatar
Fulvio Romanin
Posts: 394
Joined: Thu 4. Dec 2003, 11:12
Location: Udine, Italy
Contact:

Post by Fulvio Romanin »

so here's the file you need - name it filelist_xml.php, then it'll be a breeze to use it and tweak it for your mp3 player - i can share mine if you want to, but that's not so important.

-------------------------
usage (the simplest usage you'd need)
-------------------------

define which wcms page will have the mp3 files attached inside of this file. Then, from the file manager, import the mp3 files and insert each one of them as a separate file list content part (might work with all in the same, didn't test them). That's REALLY all.

----------------------------
filelist_xml.php
by Luca Malisan and Fulvio Romanin
-----------------------------

<?php

if (stristr($_SERVER['HTTP_ACCEPT'], "application/xhtml+xml")) {
header("Content-Type: application/xhtml+xml; charset=utf-8");
} else {
header("Content-Type: text/html; charset=utf-8");
}


require_once ("config/phpwcms/conf.inc.php");
require_once ("include/inc_lib/default.inc.php");

$aid = intval($_GET['aid']);
$FILE = array();

$xml = '';


$sql_cnt = "SELECT * FROM ".DB_PREPEND."phpwcms_articlecontent WHERE acontent_aid=".$aid." ".
"AND acontent_visible=1 AND acontent_trash=0 AND acontent_type=7 LIMIT 1";
if($cresult = mysql_query($sql_cnt, $db) or die("error while listing contents for this article")) {
if($crow = mysql_fetch_array($cresult)) {

if($crow["acontent_files"]) {

$file_tmp = '';

$file_id = explode(":", $crow["acontent_files"]);
$file_text = explode("\n", $crow["acontent_text"]);

if(is_array($file_id) && count($file_id)) {
$fx=0; $fxa="";
if(isset($fxb)) {
unset($fxb);
}
foreach($file_id as $key => $value) {
if($fx) {
$fxa .= " OR ";
}
$fxa .= "f_id=".intval($value);
$fxb[$key]["fid"] = intval($value);
$fxc[$key] = '';
$fx++;
}

$file_sql = "SELECT * FROM ".DB_PREPEND."phpwcms_file WHERE f_public=1 AND f_aktiv=1 AND f_kid=1 AND f_trash=0 AND (".$fxa.");";

if($file_result = mysql_query($file_sql, $db) or die ("error while retrieving file list file's info")) {

while($file_row = mysql_fetch_assoc($file_result)) {

$dl_filename = $file_row["f_hash"];
if($file_row["f_ext"]) $dl_filename .= ".".$file_row["f_ext"];
$FILE[] = PHPWCMS_ROOT.$phpwcms["file_path"].$dl_filename;

$xml .= "\t".'<SONG ';
$xml .= "\n\t\t".'info="'.utf8_encode($file_row["f_shortinfo"]).'" ';
$xml .= "\n\t\t".'filename="'.utf8_encode($file_row["f_name"]).'" ';
$xml .= "\n\t\t".'file="'.PHPWCMS_URL.substr($phpwcms["file_path"],1).$dl_filename.'"';
$xml .= "\n\t></SONG>\n";

}
mysql_free_result($file_result);

}
}

}



}
}


echo '<'.'?xml version="1.0" encoding="utf-8"?'.">\n";
echo "<archive>\n";
echo $xml;
echo '</archive>';


?>
Completeness is reached through subtraction, not through addition
User avatar
marcus@localhorst
Posts: 815
Joined: Fri 28. May 2004, 11:31
Location: localhorst
Contact:

Post by marcus@localhorst »

thanks for sharing! :D
User avatar
antonumia
Posts: 77
Joined: Mon 14. Feb 2005, 16:10
Contact:

mp3 player RT

Post by antonumia »

hi,

FYI, I've nearly finished my little mp3 stream RT:

http://www.phpwcms.de/forum/viewtopic.php?t=12125

anton
Post Reply