Menu

undefined

Help
snafu07
2007-03-15
2013-04-17
  • snafu07

    snafu07 - 2007-03-15

    I really really need to sue this.

    Okay. I set up the directory structure just as you asked for.

    Tested my php just to make sure with phpmyadmin. so I know that works.
    The apache2 server on XP windows is working.

    The player shows up but in the title at the top all i see is the word "undefined" and everything else below is blank. I started changing the playlist generator to see if I had the paths right. Seems the mp3 directory is not being read or the file is not being written.

    Could you please give me a specific example of what the defintions should look like.
    Thanks.
    // Definitions
    define("ROOT",                     $_SERVER["HTTP_HOST"]);    
    define("PATH",                    $_SERVER["DOCUMENT_ROOT"]);   
    define("MP3_PATH",                "playlist/mp3s");

     
    • sleen

      sleen - 2007-03-16

      You also can look at the script output by visiting playlist_generator.php in your browser.  See if there are errors, and then view the page source to check on any paths.

      From your code snippet above, I see you have changed the defined mp3 path.  Was there a reason the original "$base_url/mp3" path did not work?  That $base_url function produces the base path of wherever the php script is run, the /mp3 gets you into a subordinate folder.  Maybe try switching back to the original script with the original folder structure - they work together and see if that works at all.

      The package assumes you can place it at the website root...If you are not doing this, then could you give an example or a link to where on the server this script must run?  Ultimately the path to the mp3 files is made from this statement on line 84:

      $url = ROOT . "/" . MP3_PATH . "/" . $short_name;

      SO if you need to substitute something besides $base_url, keep the above operation in mind with the slashes and imagine it making a valid path...

      Hope this helps,

      jonathan

       
    • sleen

      sleen - 2007-03-16

      I should also say that the definitions are made to work with portability in mind.  They should work for most folks without modification.

       
    • snafu07

      snafu07 - 2007-03-17

      Okay what stupid newbie thing am I missing here.

      apache2.2 install on windows xp
      here's the apache root c:\apache2\htdocs
      here's the playlist     c:\apache2\htdocs\playlist
      copied 2 mp3 files into c:\apache2\htdocs\playlist\mp3s

      Browser path          http:\\localhost\playlist

      results UNDEFINED

      I tried it with your suggestion of the "$base_url/mp3" that didn't work.

      I must be missin something? 

       
    • snafu07

      snafu07 - 2007-03-17

      also, whne I browse to http:\\localhost\playlist\playlist_generator.php
      this is what I get

      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] != '.') { $dirs[$full_name] = $file;
      } } closedir($dh);
      } } // Produce output if ($files) { print <<< END_HEADER 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]['artist'] || @$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; } } } $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 <<< END_TRACK {$url} {$artist} {$album} END_TRACK; } print <<< END_FOOTER END_FOOTER; } ?>

       
    • Cetra Free

      Cetra Free - 2007-03-19

      Looks like you've not got PHP to run on your computer there

      http://wix.sourceforge.net/

      Might help you out?

       
    • Cetra Free

      Cetra Free - 2007-03-19

      I mean this:

      http://au3.php.net/manual/en/install.windows.php

      Sorry... wrong link.. :D

       
    • snafu07

      snafu07 - 2007-03-19

      That's what I thought. but when I run a test.php this is what I get.
      It's like I'm missing a path statement or something.
      PHP Version 5.2.1

      System  Windows NT ZAFOD 5.1 build 2600 
      Build Date  Feb 7 2007 23:10:31 
      Configure Command  cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared" 
      Server API  Apache 2.0 Handler 
      Virtual Directory Support  enabled 
      Configuration File (php.ini) Path  C:\data\PHP\php.ini 
      PHP API  20041225 
      PHP Extension  20060613 
      Zend Extension  220060519 
      Debug Build  no 
      Thread Safety  enabled 
      Zend Memory Manager  enabled 
      IPv6 Support  enabled 
      Registered PHP Streams  php, file, data, http, ftp, compress.zlib 
      Registered Stream Socket Transports  tcp, udp 
      Registered Stream Filters  convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, zlib.* 

       
    • snafu07

      snafu07 - 2007-03-21

      Well I finally got it to work using.
      please see index.html and playlist.php
      from LACY MORROW 2007 AT http://blog.geekkid.net

      Index.html

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html>
          <head>
              <title>My MP3 Player</title>
          </head>
          <body>
              <h1>My MP3 Player</h1>
              <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab
              #version=7,0,0,0" width="900" height="900" id="xspf_jukebox" align="middle">
                  <param name="allowScriptAccess" value="sameDomain" />
                  <param name="movie" value="xspf_jukebox.swf?playlist_url=playlist.php
                  &skin_url=skin.xml
                  &autoload=true&autoplay=true" />
                  <param name="quality" value="high" />
                  <param name="bgcolor" value="#e6e6e6" />
                  <embed src="xspf_jukebox.swf?playlist_url=playlist.php&autoload=true&autoplay=true" quality="high" bgcolor="#e6e6e6" width="300" height="170" name="xspf_jukebox" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
              </object>
         
          </body>
      </html>

      PLAYLIST.PHP

      <?php

      #################
      # XSPF JUKEBOX PHP PLAYLIST GENERATOR
      # LACY MORROW 2007
      # FOR USE WITH THE XSPF JUKEBOX AND PLAYER AT
      # http://blog.geekkid.net
      #
      # Adapted from Automatic XSPF Playlist generator PHP Script v2.0
      # dreden http://www.dreden.com
      #################

      //DIRECTORIES

      // use individual track images
      $image = false;

      // use mp3 id3 tags or use the file/folder names to get artist and titles?
      $useid3 = true;
      $getid3file = "id3/getid3.php";
      $id3version = 2; // either 1 or 2

      // the directory that contains the music files
      $musicdir = "mp3s";

      // the url path to the music directory
      $path = "http://localhost/playlister/mp3s/";

      ### 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 = "http://xspf.org/ns/0/">' . "\n");
          print ("<trackList>" . "\n");
          if ($handle = opendir($musicdir)) {
              while (false !== ($file = readdir($handle))) {
                  if ($file == "." || $file == "..") { $file = ""; }
              elseif (is_dir("$musicdir/$file")) {
                  foreach (glob("$musicdir/$file/*.mp3") as $filename) {
                  if (strpos($filename, '.mp3')){
                  $audiofile[$i] = str_replace("$musicdir/", "", $filename);
                  $i++;
      }
                  }
              } else {   
                  if (strpos($file, '.mp3')){       
                  $audiofile[$i] = $file;
                  $i++;
                  }
              }
          }
      closedir($handle);
          }
      sort($audiofile);
      reset($audiofile);

      for($j = 0; $j < count($audiofile); $j++)
          {
              $filename = "$musicdir" . "/" . "$audiofile[$j]";
              $tempname = substr($filename, strrpos($filename, '/')+1);
              if ($image) {
                  foreach (glob(dirname($filename)."/".substr($tempname, 0, strpos($tempname, '.mp3')).".*") as $tempfile) {
      if (strpos($tempfile, '.jpg') || strpos($tempfile, '.bmp') || strpos($tempfile, '.gif') || strpos($tempfile, '.png')) {
                  $audioimage[$j] = $tempfile;
      }
                  }
              }
              if($useid3)
              {
              $fileinfo = $getID3->analyze($filename);
              if (!$fileinfo['tags']['id3v'.$id3version]['title']['0']){
                  $filetitle = substr($tempname, 0, strpos($tempname, '.mp3'));
              } else {
                  $filetitle = $fileinfo['tags']['id3v'.$id3version]['title']['0'];
      }
              }
          print ("<track><location>" . $path . $audiofile[$j] . "</location>");

              if ($useid3)
              {
              print ("<creator>" . $fileinfo['tags']['id3v'.$id3version]['artist']['0'] . "</creator><title>" . $filetitle . "</title>");
      if ($audioimage[$j]){
              print ("<image>" . $audioimage[$j] . "</image>");
      }
      print ("</track>" . "\n");
              } else {
      if (!strrpos(dirname($filename), '/')){       
      $tempcreator = substr(dirname($filename), 0);
      } else {
      $tempcreator = substr(dirname($filename), strrpos(dirname($filename), '/')+1);
      }
              print ("<creator>" . $tempcreator . "</creator><title>" . substr($tempname, 0, strpos($tempname, '.mp3')) . "</title>");
      if ($audioimage[$j]){
              print ("<image>" . $audioimage[$j] . "</image>");
      }
      print ("</track>" . "\n");
      }
          }
      print ("</trackList>" . "\n");
      print ("</playlist>" . "\n");
      }

      else {
      echo "<font color=\&quot;red\&quot;><center><h2>ERROR:<br>\nthe directory $musicdir cannot be found\n<br>please check your configuration</h2></center></font>";
      }
      ?>

       
    • sleen

      sleen - 2007-03-21

      So what do you think that script is doing thats working better for you?

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.