-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

There's a couple problems with multi-level directories (I have artist/album/files).  
I haven't done extensive testing, but this seems to fix them.  You won't want the
initial base_path change of course.

*** index.epl   Tue Oct 23 17:45:46 2001
- --- index.epl.new       Fri Oct 26 11:28:12 2001
***************
*** 3,9 ****
  use Digest::MD5 qw/md5_hex/;
  
  $mp3host = "http://$ENV{SERVER_NAME}:8000";;
! $base_path = '/mp3';
  $path = $base_path;
  if ( $fdat{path} ) {
    $path .= '/' . $fdat{path};
- --- 3,9 ----
  use Digest::MD5 qw/md5_hex/;
  
  $mp3host = "http://$ENV{SERVER_NAME}:8000";;
! $base_path = '/annex/MP3s';
  $path = $base_path;
  if ( $fdat{path} ) {
    $path .= '/' . $fdat{path};
***************
*** 19,33 ****
  
  @dirs = ();
  @files = ();
! opendir DIR, $path or die $!;
  while ( my $file = readdir DIR ) {
    next if $file =~ /^\.\.?/;
!   if ( -d $file ) {
!     push @dirs, $file;
    }
    else {
      next unless $file =~ /\.(mp3|m3u)$/;
!     push @files, $file;
    }
  }
  closedir DIR;
- --- 19,33 ----
  
  @dirs = ();
  @files = ();
! opendir DIR, $path or die "$path $!";
  while ( my $file = readdir DIR ) {
    next if $file =~ /^\.\.?/;
!   if ( -d "$path/$file" ) {
!     push @dirs, "$fdat{path}/$file";
    }
    else {
      next unless $file =~ /\.(mp3|m3u)$/;
!     push @files, "$fdat{path}/$file";
    }
  }
  closedir DIR;
***************
*** 97,103 ****
  [$ foreach $filename ( sort filesort @files ) $]
    [- 
  #  $tag = get_mp3tag("$path/$filename");
!   $md5filename = md5_hex("$path/$filename");
    -]
    <LI> <a href="[+ $mp3host +]/?op=play&song=[+ $md5filename +]">
          [+ $filename +]</a> [<a href="[+ "$path/$filename" +]">download</a>]
- --- 97,103 ----
  [$ foreach $filename ( sort filesort @files ) $]
    [- 
  #  $tag = get_mp3tag("$path/$filename");
!   $md5filename = md5_hex("$base_path$filename");
    -]
    <LI> <a href="[+ $mp3host +]/?op=play&song=[+ $md5filename +]">
          [+ $filename +]</a> [<a href="[+ "$path/$filename" +]">download</a>]
- -- 

Kee Hinckley - Somewhere.Com, LLC
http://consulting.somewhere.com/
[EMAIL PROTECTED] (or ...!alice!nazgul for time travelers :-)

I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.

-----BEGIN PGP SIGNATURE-----
Version: PGP Personal Security 7.0.3

iQA/AwUBO9mBbCZsPfdw+r2CEQJRYACgjd0yjuqZyoXaiB7cpM917mYpjasAoKFe
8dnTtxwjXPUYilufejW1wGs7
=sfAw
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to