PDA

View Full Version : RE: Changes to Info.pm to deal with emptytracknumbe r fields



Reckase, Erik Nathan
2003-12-04, 09:43
Well, my last post seems to be taking an awful long time to arrive - not
sure what's going on with the listserver. Here's an updated set of changes
to Info.pm to deal with defined, but empty, track fields. This should be
sufficient to fix any issues. Essentially, I put a 'defined' check in the
readTags subroutine, and put an additional check in the problem loop around
line 1290 to ensure that $trnum is defined before trying to use it as an
index into the @seen array.

Regards,
Erik

diff -ubr Info.pm.old Info.pm
--- Info.pm.old Tue Dec 2 07:38:50 2003
+++ Info.pm Thu Dec 4 08:33:38 2003
@@ -815,7 +815,7 @@

my $item = cacheItem($file, $tagname);

- # we'll update the cache if we don't have a valid title in the cache
+ # update the cache if the tag is not defined in the cache
if (!defined($item)) {
# defer cover information until needed
if ($tagname =~ /^(COVER|COVERTYPE)$/) {
@@ -826,10 +826,6 @@
updateCoverArt($file,'thumb');
$item = cacheItem($file, $tagname);
# load up item information if we've never seen it or we
haven't loaded the tags
- } elsif ($tagname =~ /^(THUMB|THUMBTYPE)$/) {
- updateCoverArt($file,1);
- $item = cacheItem($file, $tagname);
- # load up item information if we've never seen it or we
haven't loaded the tags
} elsif (!exists($infoCache{$file}) || !cacheItem($file,
'TAG')) {
$::d_info && Slim::Utils::Misc::bt();
$::d_info && Slim::Utils::Misc::msg("cache miss for
$file\n");
@@ -1292,12 +1288,16 @@
my @seen = ();
foreach my $item (@uniq) {
my $trnum = trackNumber($item);
- if ($trnum && $seen[$trnum]) {
+
+ if ($trnum)
+ {
+ if ($seen[$trnum]) {
$duptracknum = 1;
last;
}
$seen[$trnum]++;
}
+ }
if ($duptracknum) {
@uniq = sortByTrack(@uniq);
} else {
@@ -1572,7 +1572,7 @@

$::d_info && !defined($tempCacheEntry) &&
Slim::Utils::Misc::msg("Info: no tags found for $filepath\n");

- if ($tempCacheEntry->{'TRACKNUM'}) {
+ if ( defined $tempCacheEntry->{'TRACKNUM'}) {
$tempCacheEntry->{'TRACKNUM'} =
cleanTrackNumber($tempCacheEntry->{'TRACKNUM'});
}


-> -----Original Message-----
-> From: Robert Moser II [mailto:rlmoser (AT) earthlink (DOT) net]
-> Sent: Wednesday, December 03, 2003 8:36 PM
-> To: SlimDevices Developers
-> Subject: Re: [Developers] Changes to Info.pm to deal with empty
-> tracknumbe r fields
->
->
-> Reckase, Erik Nathan blurted out:
-> > OK, I have 2 files that for some reason are returning
-> non-numeric, but
-> > defined, values of $trnum. Still investigating...
->
-> Are those full album MP3's plus a cuesheet? Tracks defined in that
-> manner might not be having their tracknumbers cleaned before
-> insertion
-> in the info cache.
->
->

dean
2003-12-04, 10:36
Could you send this as an attachment? The lines seem to have been
wrapped.


On Dec 4, 2003, at 8:43 AM, Reckase, Erik Nathan wrote:

> Well, my last post seems to be taking an awful long time to arrive -
> not
> sure what's going on with the listserver. Here's an updated set of
> changes
> to Info.pm to deal with defined, but empty, track fields. This should
> be
> sufficient to fix any issues. Essentially, I put a 'defined' check in
> the
> readTags subroutine, and put an additional check in the problem loop
> around
> line 1290 to ensure that $trnum is defined before trying to use it as
> an
> index into the @seen array.
>
> Regards,
> Erik
>
> diff -ubr Info.pm.old Info.pm
> --- Info.pm.old Tue Dec 2 07:38:50 2003
> +++ Info.pm Thu Dec 4 08:33:38 2003
> @@ -815,7 +815,7 @@
>
> my $item = cacheItem($file, $tagname);
>
> - # we'll update the cache if we don't have a valid title in the
> cache
> + # update the cache if the tag is not defined in the cache
> if (!defined($item)) {
> # defer cover information until needed
> if ($tagname =~ /^(COVER|COVERTYPE)$/) {
> @@ -826,10 +826,6 @@
> updateCoverArt($file,'thumb');
> $item = cacheItem($file, $tagname);
> # load up item information if we've never seen it or we
> haven't loaded the tags
> - } elsif ($tagname =~ /^(THUMB|THUMBTYPE)$/) {
> - updateCoverArt($file,1);
> - $item = cacheItem($file, $tagname);
> - # load up item information if we've never seen it or we
> haven't loaded the tags
> } elsif (!exists($infoCache{$file}) ||
> !cacheItem($file,
> 'TAG')) {
> $::d_info && Slim::Utils::Misc::bt();
> $::d_info && Slim::Utils::Misc::msg("cache
> miss for
> $file\n");
> @@ -1292,12 +1288,16 @@
> my @seen = ();
> foreach my $item (@uniq) {
> my $trnum = trackNumber($item);
> - if ($trnum && $seen[$trnum]) {
> +
> + if ($trnum)
> + {
> + if ($seen[$trnum]) {
> $duptracknum = 1;
> last;
> }
> $seen[$trnum]++;
> }
> + }
> if ($duptracknum) {
> @uniq = sortByTrack(@uniq);
> } else {
> @@ -1572,7 +1572,7 @@
>
> $::d_info && !defined($tempCacheEntry) &&
> Slim::Utils::Misc::msg("Info: no tags found for $filepath\n");
>
> - if ($tempCacheEntry->{'TRACKNUM'}) {
> + if ( defined $tempCacheEntry->{'TRACKNUM'}) {
> $tempCacheEntry->{'TRACKNUM'} =
> cleanTrackNumber($tempCacheEntry->{'TRACKNUM'});
> }
>
>
> -> -----Original Message-----
> -> From: Robert Moser II [mailto:rlmoser (AT) earthlink (DOT) net]
> -> Sent: Wednesday, December 03, 2003 8:36 PM
> -> To: SlimDevices Developers
> -> Subject: Re: [Developers] Changes to Info.pm to deal with empty
> -> tracknumbe r fields
> ->
> ->
> -> Reckase, Erik Nathan blurted out:
> -> > OK, I have 2 files that for some reason are returning
> -> non-numeric, but
> -> > defined, values of $trnum. Still investigating...
> ->
> -> Are those full album MP3's plus a cuesheet? Tracks defined in that
> -> manner might not be having their tracknumbers cleaned before
> -> insertion
> -> in the info cache.
> ->
> ->