mherger wrote: 
> Where would the latter happen?

This happens in Slim::Music::Info::setContType


This means my suggested fix is 
1. Add a new routine into Slim::Schema.pm

Code:
--------------------
    
  
  sub updateContentTypeCache {
        my ($url, $contentType) = @_;
        
        if (defined $contentTypeCache{$url}) {
                $contentTypeCache{$url} = $contentType;
        }
  }
  
--------------------


2.  Add a call (in red) to above routine in Slim::Music::Info.pm to sync
caches


Code:
--------------------
    
  ub setContentType {
        my $url = shift;
        my $type = shift;
  
        if ($type =~ /(.*);(.*)/) {
  
                # content type has ";" followed by encoding
                main::INFOLOG && $log->info("Truncating content type. Was: 
$type, now: $1");
  
                # TODO: remember encoding as it could be useful later
                $type = $1; # truncate at ";"
        }
  
        $type = lc($type);
  
        if ($types{$type}) {
  
                # we got it
  
        } elsif ($mimeTypes{$type}) {
  
                $type = $mimeTypes{$type};
  
        } else {
  
                my $guessedtype = typeFromPath($url);
  
                if ($guessedtype ne 'unk') {
                        $type = $guessedtype;
                }
        }
  
        # Update the cache set by typeFrompath as well.
        %urlToTypeCache = () if scalar keys %urlToTypeCache > URLTYPECACHESIZE;
        $urlToTypeCache{$url} = $type;
        
        Slim::Schema::updateContentTypeCache($url, $type);
        
        main::INFOLOG && $log->info("Content-Type for $url is cached as $type");
  
        # Commit, since we might use it again right away.
        return Slim::Schema->updateOrCreate({
                'url'        => $url,
                'attributes' => { 'CT' => $type },
                'commit'     => 1,
                'readTags'   => isRemoteURL($url) ? 0 : 1,
        });
  }
  
--------------------


------------------------------------------------------------------------
bpa's Profile: http://forums.slimdevices.com/member.php?userid=1806
View this thread: http://forums.slimdevices.com/showthread.php?t=111812

_______________________________________________
Radio mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/radio

Reply via email to