On Fri, 2005-12-09 at 01:33 +0000, Steve Kemp wrote:
> On Wed, Dec 07, 2005 at 06:55:07PM +0800, Michael Collard wrote:
>
> > The reason I first sought this was due to XMMS not understanding
> > extended M3U lists without .m3u extensions. This is essentially a bug in
> > XMMS. Info on that can be found here:
> > http://bugs.xmms.org/show_bug.cgi?id=632
> >
> > I am actually leaning towards removing this extra header. The only time
> > this has played a part has been with custom playlist, and I am thinking
> > about doing some nice things with that plugin :)
> >
> > Yup... remove it :)
>
> Removed now, thanks for trying!
I've updated to CVS and made a single patch file for all of the changes
I've made. These include:
* Fixed auth request, no need to proceed and what not.
* Fixed auth failing logic, it should not continue.
* Better '.file' skipping
* Don't display paths in playlists (or elsewhere)
* Proper fix of path related problems with OGG tagging and what not.
I'll be working on a new playlist plugin now (recoding the existing one
since it will perform the same kinda thing).
Also, I'll probably do something with authentication. Its not really
ideal right now, authing for some things and not others. CVS is also
causing a problem with players that don't do HTTP basic auth. I'll nut
something better out.
Cheers
--- bin/gnump3d2 2005-11-17 08:46:53.000000000 +0800
+++ bin/gnump3d2 2005-12-09 09:57:51.000000000 +0800
@@ -1258,6 +1259,7 @@
if ( defined( $filename ) and ( -e $filename ) )
{
$display = &getSongDisplay( $filename, $song_format );
+ $display =~ s/^$ROOT(.*\/)*//g;
}
@@ -1277,6 +1279,7 @@
$header .= "Connection: close\r\n";
$header .= "Server: GNUMP3d $RELEASE\r\n"; # Identify ourself.
$header .= "Content-type: $mime\r\n";
+
#
# If we're going to serve a file send the last modified
@@ -1484,6 +1500,11 @@
$tags = getSongDisplay( $file ) . "\n";
+ #
+ # Remove any leading path
+ #
+ $tags =~ s/^$ROOT(.*\/)*//g;
+
# last resort, just the filename
$tags = "#EXTINF:,$tags" if $tags !~ /^#EXTINF/;
}
@@ -1529,19 +1550,19 @@
my $dir = 0;
my $bitrate = "";
- if ( $uri =~ /(.*)\/all\.m3u$/ )
+ if ( $uri =~ /(.*\/)all\.m3u$/ )
{
$dir = $1;
$random = 0;
$recurse = 0;
}
- if ( $uri =~ /(.*)\/random\.m3u$/ )
+ if ( $uri =~ /(.*\/)random\.m3u$/ )
{
$dir = $1;
$random = 1;
$recurse = 1;
}
- if ( $uri =~ /(.*)\/recurse\.m3u$/ )
+ if ( $uri =~ /(.*\/)recurse\.m3u$/ )
{
$dir = $1;
$recurse = 1;
@@ -2156,7 +2177,7 @@
#
if ( $row =~ /\$SONG_COUNT/ )
{
- my @subfiles = &filesInDir( "$dir/$file" );
+ my @subfiles = &filesInDir( $dir . $file . "/" );
#
# Strip out things like .title files.
@@ -2291,7 +2312,7 @@
next if ( $file =~ /mp3$/i );
}
- push @DISPLAY, $dir . "/" . $file;
+ push @DISPLAY, $file;
$DEBUG && print "Kept $file\n";
}
@@ -2366,17 +2387,20 @@
# Increase count.
$totalPlaylists += 1;
+ # Strip preceeding folders
+ $file =~ s/^$ROOT\/(.*\/)*//;
+
# Get the display text
my $display = $file;
if ( $file =~ /(.+)\.[^\.]+$/ )
{
$display = $1;
}
#
# Build up the text to insert into the file lists.
#
- my $link = &urlEncode( $path . "/" . $file );
+ my $link = &urlEncode( $file );
# URL Encode link to playlist.
$link = &urlEncode( $file );
@@ -2614,6 +2640,14 @@
$output = $file_format2;
}
+ #
+ # Remove the preceeding directories from $display
+ #
+ if ( $display =~ /.*\/(.+)$/ )
+ {
+ $display = $1;
+ }
+
$output =~ s/\$LINK/$link/g;
$output =~ s/\$PLAINLINK/$plink/g;
$output =~ s/\$SONG_FORMAT/$display/g;
@@ -2880,7 +2914,7 @@
{
my ($directory,$data ) = (@_);
- $directory = $ROOT . "/" . $directory;
+ $directory = $ROOT . $directory;
$DEBUG && print "Testing for directory: $directory\n";
@@ -2900,6 +2934,7 @@
"Access has been denied to $connected_address" );
&sendData( $data, $text );
close( $data );
+ exit;
}
else
{
--- lib/gnump3d/readtags.pm 2005-11-17 08:46:53.000000000 +0800
+++ lib/gnump3d/readtags.pm 2005-12-03 13:58:26.000000000 +0800
@@ -209,7 +209,7 @@
# Just store the filename.
if ( $file =~ /(.*\/)?(.*)\.(.*)/ )
{
- $filename = $2;
+ $filename = $1 . $2;
}
# Figure out the mtime if possible.
--- lib/gnump3d/tagcache.pm 2005-11-17 08:46:53.000000000 +0800
+++ lib/gnump3d/tagcache.pm 2005-12-07 17:23:11.000000000 +0800
@@ -258,15 +258,7 @@
if ( $HIDE_TAGS )
{
- # Just store the filename.
- if ( $file =~ /(.*)\/(.*)/ )
- {
- $file = $2;
- }
- if ( $file =~ /(.*)\.(.*)/ )
- {
- $file = $1;
- }
+ # Store filename
$formatted = $file;
}
else
--- lib/gnump3d/ogginfo.pm 2005-11-17 08:46:53.000000000 +0800
+++ lib/gnump3d/ogginfo.pm 2005-12-03 10:36:35.000000000 +0800
@@ -28,7 +28,7 @@
my %data;
# check that the file exists and is readable
- unless ( -e $file && -r _ )
+ unless ( -e $file && -r $file )
{
warn "File does not exist or cannot be read.";
# file does not exist, can't do anything
--- lib/gnump3d/files.pm 2005-11-17 08:46:53.000000000 +0800
+++ lib/gnump3d/files.pm 2005-12-08 13:21:06.000000000 +0800
@@ -125,11 +126,11 @@
foreach my $entry ( @entries )
{
# Skip "dotfiles".
- next if ( ( $entry =~ /^\.$/ ) or ( $entry =~ /^\.\.$/ ) );
+ next if ( $entry =~ /^\./ );
- if ( -f $dir . "/" . $entry )
+ if ( -f $dir . $entry )
{
- push @FOUND, $entry;
+ push @FOUND, $dir . $entry;
}
}
@@ -154,17 +155,45 @@
foreach my $entry ( @entries )
{
# Skip "dotfiles"
- next if ( ( $entry =~ /^\.$/ ) or ( $entry =~ /^\.\.$/ ) );
+ next if ( $entry =~ /^\./ );
- if ( -f $dir . "/" . $entry )
+ if ( -f $dir . $entry )
{
- push @FOUND, $dir . "/" . $entry;
+ push @FOUND, $dir . $entry;
}
- elsif ( -d $dir . "/" . $entry )
+ elsif ( -d $dir . $entry )
{
- push @FOUND, &filesInDirRecursively( $dir . "/" . $entry );
+ push @FOUND, &filesInDirRecursively( $dir . $entry . "/" );
}
}
+ return( sort(@FOUND ) );
+}
+
+
+#
+# Read all non . files within directories in the given directory recursively.
+#
+# The returned list will be sorted.
+#
+sub filesInDirsOnlyRecursively( $ )
+{
+ my ($dir) = (@_);
+ opendir(DIR, $dir) or warn "Cannot open directory : $dir :$!";
+ my @entries = readdir( DIR );
+ closedir(DIR);
+
+ my @FOUND = ();
+
+ foreach my $entry ( @entries )
+ {
+ # Skip "dotfiles"
+ next if ( $entry =~ /^\./ );
+
+ if ( -d $dir . $entry )
+ {
+ push @FOUND, &filesInDirRecursively( $dir . $entry . "/" );
+ }
+ }
return( sort(@FOUND ) );
}
@@ -187,7 +216,7 @@
foreach my $entry ( @entries )
{
# Skip "dotfiles"
- next if ( $entry =~ /^\.(.*)/ );
+ next if ( $entry =~ /^\./ );
# Skip mount points
next if ( $entry =~ /^lost\+found$/ );
--- lib/gnump3d/plugins/random.pm 2005-11-17 08:46:53.000000000 +0800
+++ lib/gnump3d/plugins/random.pm 2005-12-09 10:09:30.000000000 +0800
@@ -164,6 +164,11 @@
#
my $tag = &getSongDisplay( $file, $format );
+ #
+ # Remove path (if there is one)
+ #
+ $tag =~ s/^$ROOT(.*\/)*//;
+
#
# Get the containing directory.
my $dir = $file;
@@ -412,7 +417,7 @@
#
# We only care about the directory name.
#
- if ( $random =~ /(.*)\/(.*)$/ )
+ if ( $random =~ /\/?(.*\/)(.+)$/g )
{
$random = $1;
}
@@ -461,7 +466,7 @@
$random= $1;
}
- &sendData($data, "HTTP/1.0 300 OK\nLocation: /$random\n\n" );
+ &sendData($data, "HTTP/1.0 302 OK\nLocation: /$random\n\n" );
exit;
}
--- lib/gnump3d/plugins/info.pm 2005-11-17 08:46:53.000000000 +0800
+++ lib/gnump3d/plugins/info.pm 2005-12-04 09:32:05.000000000 +0800
@@ -245,6 +245,11 @@
}
else
{
+ #
+ # Trim leading root path
+ #
+ $TAGS{'FILENAME'} =~ s/^$ROOT//;
+
foreach my $key ( sort keys( %TAGS ) )
{
$output .= "<tr><td><b>$key</b></td><td>" . $TAGS{$key} . "</td></tr>\n";
_______________________________________________
Gnump3d-users mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnump3d-users