[Slim-Checkins] r33855 - /7.7/trunk/server/Slim/Networking/SqueezeNetwork/Players.pm

[email protected] Tue, 21 Feb 2012 14:53:48 -0000
Newsgroups gmane.music.equipment.slimdevices.cvs
Message-ID <[email protected]>
Author: mherger
Date: Tue Feb 21 06:53:47 2012
New Revision: 33855

URL: http://svn.slimdevices.com/slim?rev=33855&view=rev
Log:
Bug: n/a
Description: add code to deal with online services inheriting from another one (actually overriding it).

Modified:
    7.7/trunk/server/Slim/Networking/SqueezeNetwork/Players.pm

Modified: 7.7/trunk/server/Slim/Networking/SqueezeNetwork/Players.pm
URL: http://svn.slimdevices.com/slim/7.7/trunk/server/Slim/Networking/SqueezeNetwork/Players.pm?rev=33855&r1=33854&r2=33855&view=diff
==============================================================================
--- 7.7/trunk/server/Slim/Networking/SqueezeNetwork/Players.pm (original)
+++ 7.7/trunk/server/Slim/Networking/SqueezeNetwork/Players.pm Tue Feb 21 06:53:47 2012
@@ -182,7 +182,7 @@
 			# and just copy it to the my_apps list
 			if ( $info->{plugin} ) {
 				if ( my $plugin = Slim::Utils::PluginManager->isEnabled( $info->{plugin} ) ) {
-					_updateWebLink($plugin->{name}, $app);
+					_updateWebLink($plugin->{name}, $app, $info);
 				}
 			}
 			elsif ( $info->{type} eq 'opml' ) {
@@ -291,12 +291,29 @@
 sub _updateWebLink {
 	my $name = shift;
 	my $id   = shift;
+	my $info = shift;
 	
 	my $disabled = $prefs->get('sn_disabled_plugins');
 	return if $disabled && grep /^$id$/i, @$disabled;
 	
-	my $url = Slim::Web::Pages->getPageLink( 'apps', $name );
-	Slim::Web::Pages->addPageLinks( 'my_apps', { $name => $url } );
+	if ($info && $info->{title} && $name && $info->{title} ne $name) {
+		my $url = Slim::Web::Pages->getPageLink( 'apps', $name );
+		Slim::Web::Pages->addPageLinks( 'my_apps', { $info->{title} => $url } );
+		
+		# use icon as defined by MySB to allow for white-label solutions
+		if ( my $icon = $info->{icon} ) {
+			my $pluginData = Slim::Utils::PluginManager->dataForPlugin($info->{plugin});
+			$icon = Slim::Networking::SqueezeNetwork->url( $icon, 'external' ) unless $icon =~ /^http/;
+			$pluginData->{icon} = $icon;
+			
+			Slim::Web::Pages->addPageLinks("icons", { $name => $icon });
+			Slim::Web::Pages->addPageLinks("icons", { $info->{title} => $icon });
+		}
+	}
+	else {
+		my $url = Slim::Web::Pages->getPageLink( 'apps', $name );
+		Slim::Web::Pages->addPageLinks( 'my_apps', { $name => $url } );
+	}
 }
 
 sub _players_error {