Index: server/CPAN/Audio/FLAC/Header.pm =================================================================== --- server/CPAN/Audio/FLAC/Header.pm (revision 3591) +++ server/CPAN/Audio/FLAC/Header.pm (working copy) @@ -48,6 +48,7 @@ my $class = shift; my $file = shift; my $writeHack = shift; + my $paranoia = shift; my $errflag = 0; my $self = {}; @@ -76,6 +77,8 @@ return $self; }; + $self->setParanoia($paranoia); + # Grab the metadata blocks from the FLAC file $errflag = $self->_getMetadataBlocks(); if ($errflag < 0) { @@ -316,10 +319,17 @@ return 0; } +sub setParanoia { + my $self = shift; + $self->{'paranoia'} = shift; +} + # private methods to this class sub _init { my $self = shift; + my $paranoia = shift || 1; + my $fh = $self->{'fileHandle'}; # check the header to make sure this is actually a FLAC file @@ -332,6 +342,9 @@ $self->{'startMetadataBlocks'} = $byteCount; + # set paranoid checking as passed in, defaulting to true + $self->{'paranoia'} = $paranoia; + return 0; } @@ -563,12 +576,12 @@ # Some sanity checking related to the CD flag if ($isCD && length($catalog) != 13 && length($catalog) != 0) { warn "Invalid Catalog entry\n"; - return -1; + return -1 if $self->{'paranoia'}; } if (!$isCD && $leadin > 0) { warn "Lead-in detected for non-CD cue sheet.\n"; - return -1; + return -1 if $self->{'paranoia'}; } # The next few bits should be zero. @@ -586,7 +599,7 @@ my $numTracks = _bin2dec(unpack('B8',substr($tmpBlock,0,1))); $tmpBlock = substr($tmpBlock,1); - if ($numTracks < 1 || ($isCD && $numTracks > 100)) { + if ($numTracks < 1 || ($isCD && $self->{'paranoia'} && $numTracks > 100)) { warn "Invalid number of tracks $numTracks\n"; return -1; } @@ -604,7 +617,7 @@ if ($isCD && $trackOffset % 588) { warn "Invalid track offset $trackOffset\n"; - return -1; + return -1 if $self->{'paranoia'}; } my $tracknum = _bin2dec(unpack('B8',substr($tmpBlock,8,1))) || do { @@ -615,7 +628,7 @@ if ($isCD && $tracknum > 99 && $tracknum != 170) { warn "Invalid track number for a CD $tracknum\n"; - return -1; + return -1 if $self->{'paranoia'}; } if (defined $seenTracknumber{$tracknum}) { @@ -630,7 +643,7 @@ if ((length($isrc) != 0) && (length($isrc) != 12)) { warn "Invalid ISRC code $isrc\n"; - return -1; + return -1 if $self->{'paranoia'}; } $bits = unpack('B8', substr($tmpBlock, 21, 1)); @@ -657,7 +670,7 @@ if ($isCD && $tracknum != 170) { warn "Incorrect lead-out track number $tracknum for CD\n"; - return -1; + return -1 if $self->{'paranoia'}; } $leadouttracknum = $tracknum; @@ -671,7 +684,7 @@ push (@$cuesheet, " FLAGS PRE\n") if ($preemphasis); push (@$cuesheet, " ISRC " . $isrc . "\n") if ($isrc); - if ($numIndexes < 1 || ($isCD && $numIndexes > 100)) { + if ($numIndexes < 1 || ($isCD && $self->{'paranoia'} && $numIndexes > 100)) { warn "Invalid number of Indexes $numIndexes for track $tracknum\n"; return -1; } @@ -685,7 +698,7 @@ if ($isCD && $indexOffset % 588) { warn "Invalid index offset $indexOffset\n"; - return -1; + return -1 if $self->{'paranoia'}; } my $indexnum = _bin2dec(unpack('B8',substr($tmpBlock,8,1))); Index: server/Slim/Utils/Prefs.pm =================================================================== --- server/Slim/Utils/Prefs.pm (revision 3591) +++ server/Slim/Utils/Prefs.pm (working copy) @@ -129,6 +129,7 @@ 'noGenreFilter' => 0, 'upgrade-6.0b3-script' => 1, 'rank-PLUGIN_PICKS_MODULE_NAME' => 4, + 'parseParanoia' => 1, ); # The following hash contains functions that are executed when the pref corresponding to @@ -245,6 +246,7 @@ Slim::Control::Command::clearExecuteCallback(\&Slim::Player::Playlist::modifyPlaylistCallback); } } + ); } Index: server/Slim/Formats/FLAC.pm =================================================================== --- server/Slim/Formats/FLAC.pm (revision 3591) +++ server/Slim/Formats/FLAC.pm (working copy) @@ -46,11 +46,15 @@ my $file = shift || ""; my $anchor = shift || ""; - my $flac = Audio::FLAC::Header->new($file) || do { + my $paranoia = Slim::Utils::Prefs::get('parseParanoia'); + + my $flac = Audio::FLAC::Header->new($file,0,$paranoia) || do { warn "Couldn't open file: [$file] for reading: $!\n"; return {}; }; +# $flac->setParanoia(0); + my $tags = getStandardTag($file, $flac); my $cuesheet = $flac->cuesheet(); Index: server/Slim/Web/Setup.pm =================================================================== --- server/Slim/Web/Setup.pm (revision 3591) +++ server/Slim/Web/Setup.pm (working copy) @@ -1551,7 +1551,7 @@ 'PrefOrder' => ['displaytexttimeout', 'composerInArtists', 'noGenreFilter', ,'playtrackalbum','searchSubString', 'ignoredarticles','splitList','filesort','browseagelimit' ,'groupdiscs','persistPlaylists','reshuffleOnRepeat','saveShuffled', - ,'commonAlbumTitles' ,'checkVersion'] + ,'commonAlbumTitles' ,'parseParanoia' ,'checkVersion'] } } ,'Prefs' => { @@ -1665,6 +1665,13 @@ $changeref->{'commonAlbumTitles'}{'Processed'} = 1; } } + ,'parseParanoia' => { + 'validate' => \&validateTrueFalse + ,'options' => { + '1' => string('ENABLED') + ,'0' => string('DISABLED') + } + } } } #end of setup{'behavior'} hash ,'formatting' => { @@ -1857,6 +1864,7 @@ ,q(|%Hh%M) => "h'h'mm (24h 03h00 15h00)" } } + } } #end of setup{'formatting'} hash ,'security' => { Index: server/strings.txt =================================================================== --- server/strings.txt (revision 3591) +++ server/strings.txt (working copy) @@ -1,4 +1,4 @@ -# +# # This tab-delimited file contains all the text strings used in SlimServer # The format should be self explanatory. To submit a new language, or a better # translation of an existing string, please email your changes to @@ -3513,6 +3513,28 @@ PT Não gravar historial SE Spara INTE historia +SETUP_PARSEPARANOIA + EN Strict metadata checking +# DK +# ES +# FR +# JP +# NL +# NO +# PT +# SE + +SETUP_PARSEPARANOIA_DESC + EN The server can be strict about the formatting of metadata parsed from music files. There are a few select instances where this can cause problems in parsing your music, so you have the ability to relax some restrictions by changing this preference. +# DK +# ES +# FR +# JP +# NL +# NO +# PT +# SE + SETUP_CHECKVERSION DE Software Aktualisierungen DK Softwareopdateringer