Bugzilla – Bug 5666
Dir with a recognized suffix added with a wrong content type
Last modified: 2009-07-31 10:14:55 UTC
When browsing with "My Music/Music Folder" to a music folder which is like: ~/Music/ +- album.flc/ +- 01.flc +- 02.flc +- 03.flc Where "album.flc" is a simple directory, and 01.flc, 02.flc and 03.flc are valid FLAC files. If you browse the dir ~/Music through "My Music/Music Folder" feature, the "album.flc" is detected as a FLAC file, so it is added in the track list linked to the album "No Album" in the database. And you cannot go into it from the web interface since it is considered as a song. This problem does not show up, whit scanner, but only from the "Music Folder". Since it was my first bug tracking in SlimServer, I need to touch some files before finding it the Slim::Music::Info::typeFromPath method. I know the workaround (renaming the dir) is much more easy, but not as fun :-) I think it is the most useless fix :-) This bug is also present in the 6.5 branch. Please find my fix below for trunk, it is nearly the same for the 6.5 branch: Index: Slim/Music/Info.pm =================================================================== --- Slim/Music/Info.pm (revision 13549) +++ Slim/Music/Info.pm (working copy) @@ -1195,6 +1195,15 @@ # Remove the anchor if we're checking the suffix. my ($type, $anchorlessPath); + my $filepath; + + if (isFileURL($fullpath)) { + $filepath = Slim::Utils::Misc::pathFromFileURL($fullpath); + } else { + $filepath = $fullpath; + } + + if ($fullpath && $fullpath !~ /\x00/) { # Return quickly if we have it in the cache. @@ -1214,6 +1223,11 @@ # Force mp3 for protocol handlers return 'mp3'; } + elsif (-d $filepath) { + # We want to test here if this a dir, before typeFromSuffix thinks + # it is a valid file instead of a dir with a recognized suffix. + $type = 'dir'; + } else { $anchorlessPath = Slim::Utils::Misc::stripAnchorFromURL($fullpath); @@ -1230,14 +1244,6 @@ # We didn't get a type from above - try a little harder. if ((!defined($type) || $type eq 'unk') && $fullpath && $fullpath !~ /\x00/) { - my $filepath; - - if (isFileURL($fullpath)) { - $filepath = Slim::Utils::Misc::pathFromFileURL($fullpath); - } else { - $filepath = $fullpath; - } - if ($filepath) { $anchorlessPath = Slim::Utils::Misc::stripAnchorFromURL($filepath); @@ -1255,10 +1261,6 @@ $type = typeFromSuffix($anchorlessPath, $defaultType); } - } elsif (-d $filepath) { - - $type = 'dir'; - } else { # file doesn't exist, go ahead and do typeFromSuffix
Created attachment 2213 [details] Proposed fix The same as in the report...
This bug appears to already be fixed. Please retest with the latest 7.1 and reopen if you still see it.
This bug has now been fixed in the 7.1 release version of SqueezeCenter! Please download the new version from http://www.slimdevices.com if you haven't already. If you are still experiencing this problem, feel free to reopen the bug with your new comments and we'll have another look.
Reduce number of active targets for SC