--- gnump3d2 2005-11-17 08:46:53.000000000 +0800 +++ gnump3d2.new 2005-12-02 21:52:03.000000000 +0800 @@ -117,6 +117,7 @@ my $jukebox_binary; # The binary to use for playing locally. my $tag_cache; # The file to cache tag information to. my $advanced_playlist; # Should we include extra information in .m3u files? +my $seperate_folders; # Should folders and files be seperated in the playlists? my $host_rewrite; # Allow rewrites of hostname in m3u my $meta_tags; # Optional meta tags to include. @@ -1279,6 +1280,18 @@ $header .= "Content-type: $mime\r\n"; # + # If we're serving a playlist, suggest a filename. + # This fixes issues with XMMS disliking extended playlists + # that are served by plugins - links without .m3u extensions + # + + if ( $mime eq "audio/x-mpegurl" ) + { + $header .= "Content-Disposition: attachment; filename=playlist.m3u;\r\n"; + } + + + # # If we're going to serve a file send the last modified # date + size. # @@ -1405,11 +1418,17 @@ my ( $dir, $recursive, $random ) = ( @_ ); my @files = (); + my @filesonly = (); # # Read in the files for the playlist. # - if ( $recursive ) + if ( ( $recursive ) and ( $seperate_folders ) ) + { + @files = &filesInDirsOnlyRecursively( $dir ); + @filesonly = &filesInDir( $dir ); + } + elsif ( $recursive ) { @files = &filesInDirRecursively( $dir ); } @@ -1454,6 +1473,13 @@ $sorter->setTagCache( $tagCache ); @files = &sortFiles( $sort_order, @files ); + # Put individual files at the bottom of the playlist + if ( ( $seperate_folders ) and ( $recursive ) ) + { + @filesonly = &sortFiles( $sort_order, @filesonly ); + push( @files, @filesonly ); + } + # # Process each file that we will include in the playlist. # @@ -1473,7 +1499,7 @@ if ( $advanced_playlist ) { # Set the song format. - $tagCache->setFormatString( "#EXTINF: \$SECONDS,$song_format" ); + $tagCache->setFormatString( "#EXTINF:\$SECONDS,$song_format" ); $tags = ""; $tags = getSongDisplay( $file ) . "\n"; @@ -3361,6 +3387,7 @@ $hide_song_tags = getConfig( "hide_song_tags", 0 ); $disable_tag_cache = getConfig( "disable_tag_cache", 0 ); $advanced_playlist = getConfig( "advanced_playlists", 1 ); + $seperate_folders = getConfig( "seperate_folders", 0 ); # Tag cache $tag_cache = getConfig( "tag_cache", "" );