Search the Community
Showing results for tags 'id3'.
-
<?php header("Content_Type: text/xml"); $xmlBody = '<?xml version="1.0" encoding="ISO-8859-1"?>'; $dir = "SOUNDS/"; $xmlBody .= "<XML>"; $dirHandle = opendir($dir); $i = 0; while ($file = readdir($dirHandle)) { if(!is_dir($file) && strpos($file, '.mp3')){ $i++; $myId3 = new ID3($file); $xmlBody .= ' <Song> <songNum>' . $i . '</songNum> <songURL>' . $dir . '' . $file . '</songURL> <songArtist>' . $myId3->getArtist() . '</songArtist> <songTitle>' . $myId3->getTitle() . '</songTitle> </Song>'; } } closedir($dirHandle); $xmlBody .= "</XML>"; echo $xmlBody; ?> Hi there, I have designed a flash mp3 player that reads the id3 tags form the .mp3 file, but wanted to make a XML list generated by PHP & to add the mp3 tags to the XML file so that flash can view all the id3 tag information on the files, and show on the list. I know how to view the XML list in flash I just don't want to type out 500+ tags of XML lol here is something I tried ...
-
Hi I have this code below. I'm using getid3 to get the file name, artist, and title of the songs I have in the $SongsFolder. What I'm trying to do is make the artist and title accessible so I can get this info in my iPhone app for example. I figure I would replace echo with something else but how would I properly do that? I'm really new to PHP and more of an iPhone app developer so a little help would be nice. <?php require_once("getid3/getid3.php"); $getID3 = new getID3; $SongsFolder = "Songs"; $Songs = glob($SongsFolder."/*.mp3"); foreach ($Songs as $Song) { set_time_limit(30); $ThisFileInfo = $getID3->analyze($Song); getid3_lib::CopyTagsToComments($ThisFileInfo); echo 'File name: '.$ThisFileInfo['filenamepath'].'<br>'; echo 'Artist: '.(!empty($ThisFileInfo['comments_html']['artist']) ? implode('<BR>', $ThisFileInfo['comments_html']['artist']) : ' ').'<br>'; echo 'Title: '.(!empty($ThisFileInfo['comments_html']['title']) ? implode('<BR>', $ThisFileInfo['comments_html']['title']) : ' ').'<br>'; } ?>
-
So in my code below I have a script where it shuffles through .mp3 in a folder. How can I make the line below know which song the shuffle() has picked? $ThisFileInfo = $getID3->analyze($Songs[0]); <?php require_once('/home/manveers94/public_html/getID3-1.9.7/getid3/getid3.php'); $getID3 = new getID3; function fooFucker($url) { $a = join('/', array_map('urlencode', explode('/', $url))); return str_replace('+', '%20', $a); } $SongsFolder = "songs"; header("Content-Type: audio/x-mpegurl"); $body = ''; $Songs = glob($SongsFolder."/*.mp3"); shuffle($Songs); $first = 0; foreach($Songs as $Song) { $SongPath = pathinfo($Song); if ($first != 0) { $body .= "\n"; } $first = 1; $body .= "http://".$_SERVER['HTTP_HOST'].fooFucker(dirname($_SERVER['PHP_SELF']))."/".fooFucker($SongsFolder)."/".fooFucker($SongPath['basename']); } set_time_limit(30); $ThisFileInfo = $getID3->analyze($Songs[0]); getid3_lib::CopyTagsToComments($ThisFileInfo); $body .= 'File name: '.$ThisFileInfo['filenamepath'].'<br>'; $body .= 'Artist: '.(!empty($ThisFileInfo['comments_html']['artist']) ? implode('<BR>', $ThisFileInfo['comments_html']['artist']) : ' ').'<br>'; $body .= 'Title: '.(!empty($ThisFileInfo['comments_html']['title']) ? implode('<BR>', $ThisFileInfo['comments_html']['title']) : ' ').'<br>'; $body .= 'Bitrate: '.(!empty($ThisFileInfo['audio']['bitrate']) ? round($ThisFileInfo['audio']['bitrate'] / 1000).' kbps' : ' ').'<br>'; $body .= 'Play time: '.(!empty($ThisFileInfo['playtime_string']) ? $ThisFileInfo['playtime_string'] : ' ').'<br>'; header('Content-Length: ' . strlen($body)); echo $body; ?>
-
Hi I have this code below. What I'm trying to do below is access .mp3 songs that are in my folder called "songs" When I do this code it doesn't show anything for the Artist, Title or anything anymore. Why is that? <?php require_once('/home/manveers94/public_html/getID3-1.9.7/getid3/getid3.php'); $getID3 = new getID3; $SongsFolder = "songs"; $file = glob($SongsFolder."/*.mp3"); // $file = 'Song.mp3' set_time_limit(30); $ThisFileInfo = $getID3->analyze($file); getid3_lib::CopyTagsToComments($ThisFileInfo); echo 'File name: '.$ThisFileInfo['filenamepath'].'<br>'; echo 'Artist: '.(!empty($ThisFileInfo['comments_html']['artist']) ? implode('<BR>', $ThisFileInfo['comments_html']['artist']) : ' ').'<br>'; echo 'Title: '.(!empty($ThisFileInfo['comments_html']['title']) ? implode('<BR>', $ThisFileInfo['comments_html']['title']) : ' ').'<br>'; echo 'Bitrate: '.(!empty($ThisFileInfo['audio']['bitrate']) ? round($ThisFileInfo['audio']['bitrate'] / 1000).' kbps' : ' ').'<br>'; echo 'Play time: '.(!empty($ThisFileInfo['playtime_string']) ? $ThisFileInfo['playtime_string'] : ' ').'<br>'; ?>