[Slim-Checkins] r33941 - /7.7/trunk/server/Slim/Plugin/RadioTime/Metadata.pm

[email protected] Thu, 19 Apr 2012 12:10:10 -0000
Newsgroups gmane.music.equipment.slimdevices.cvs
Message-ID <[email protected]>
Author: mherger
Date: Thu Apr 19 05:10:10 2012
New Revision: 33941

URL: http://svn.slimdevices.com/slim?rev=33941&view=rev
Log:
Bug: n/a
Description: station logo needs to be stored in the song object, not the player, or it would survive station changes.

Modified:
    7.7/trunk/server/Slim/Plugin/RadioTime/Metadata.pm

Modified: 7.7/trunk/server/Slim/Plugin/RadioTime/Metadata.pm
URL: http://svn.slimdevices.com/slim/7.7/trunk/server/Slim/Plugin/RadioTime/Metadata.pm?rev=33941&r1=33940&r2=33941&view=diff
==============================================================================
--- 7.7/trunk/server/Slim/Plugin/RadioTime/Metadata.pm (original)
+++ 7.7/trunk/server/Slim/Plugin/RadioTime/Metadata.pm Thu Apr 19 05:10:10 2012
@@ -345,15 +345,17 @@
 		main::DEBUGLOG && $log->debug( 'Getting TuneIn artwork based on metadata:', Data::Dump::dump($track) );
 		
 		# keep track of the station logo in case we don't get track artwork
-		#                                                                                    [ps] => podcast or station
-		#                                                                                            t => Thumbnail
-		#                                                                                             q => sQuare
-		#                                                                                              g => Giant
-		#                                                                                               d => meDium
-		if ( !$client->pluginData('stationLogo') && $track->{cover} && $track->{cover} =~ m{/[ps]\d+[tqgd]\.(?:jpg|jpeg|png|gif)$}i ) {
-			main::DEBUGLOG && $log->debug( 'Storing default station artwork: ' . $track->{cover} );
-			
-			$client->pluginData( stationLogo => $track->{cover} );
+		if ( my $song = $client->playingSong() ) {
+			#                                                                                    [ps] => podcast or station
+			#                                                                                            t => Thumbnail
+			#                                                                                             q => sQuare
+			#                                                                                              g => Giant
+			#                                                                                               d => meDium
+			if ( !$song->pluginData('stationLogo') && $track->{cover} && $track->{cover} =~ m{/[ps]\d+[tqgd]\.(?:jpg|jpeg|png|gif)$}i ) {
+				main::DEBUGLOG && $log->debug( 'Storing default station artwork: ' . $track->{cover} );
+				
+				$song->pluginData( stationLogo => $track->{cover} );
+			}
 		}
 		
 		if ( $track && $track->{title} && $track->{artist} ) {
@@ -397,7 +399,7 @@
 
 	my $feed = eval { Slim::Formats::XML::parseXMLIntoFeed( $http->contentRef ) };
 	
-	if ( $@ ) {
+	if ( $@ || !$feed ) {
 		main::DEBUGLOG && $log->debug( "Error fetching TuneIn artwork: $@" );
 	}
 	else  {
@@ -406,6 +408,7 @@
 	
 	if ( $feed && $feed->{items} && $feed->{items}->[0] && (my $key = $feed->{items}->[0]->{album_art} || $feed->{items}->[0]->{artist_art}) ) {
 		my $config = $client->pluginData('artworkConfig');
+		# grab "g"iant artwork
 		my $artworkUrl = $config->{albumarturl} . $key . 'g.jpg';
 		
 		setArtwork($client, $url, $artworkUrl);