[Slim-Checkins] r12665 - in /trunk/server/Slim: Music/Info.pm Plugin/Pandora/ProtocolHandler.pm
andy at svn.slimdevices.com
andy at svn.slimdevices.com
Wed Aug 22 10:48:26 PDT 2007
Author: andy
Date: Wed Aug 22 10:48:26 2007
New Revision: 12665
URL: http://svn.slimdevices.com?rev=12665&view=rev
Log:
Fix bug in current title code that breaks multiple players playing the same Pandora station. Now allow plugins to control current title
Modified:
trunk/server/Slim/Music/Info.pm
trunk/server/Slim/Plugin/Pandora/ProtocolHandler.pm
Modified: trunk/server/Slim/Music/Info.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Music/Info.pm?rev=12665&r1=12664&r2=12665&view=diff
==============================================================================
--- trunk/server/Slim/Music/Info.pm (original)
+++ trunk/server/Slim/Music/Info.pm Wed Aug 22 10:48:26 2007
@@ -414,6 +414,14 @@
sub getCurrentTitle {
my $client = shift;
my $url = shift || return undef;
+
+ # Let plugins control the current title if they want
+ my $handler = Slim::Player::ProtocolHandlers->handlerForURL($url);
+ if ( $handler && $handler->can('getCurrentTitle') ) {
+ if ( my $title = $handler->getCurrentTitle( $client, $url ) ) {
+ return $title;
+ }
+ }
return $currentTitles{$url} || standardTitle($client, $url);
}
Modified: trunk/server/Slim/Plugin/Pandora/ProtocolHandler.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Plugin/Pandora/ProtocolHandler.pm?rev=12665&r1=12664&r2=12665&view=diff
==============================================================================
--- trunk/server/Slim/Plugin/Pandora/ProtocolHandler.pm (original)
+++ trunk/server/Slim/Plugin/Pandora/ProtocolHandler.pm Wed Aug 22 10:48:26 2007
@@ -138,7 +138,7 @@
# We didn't get the next track to play
my $url = Slim::Player::Playlist::url($client);
- Slim::Music::Info::setCurrentTitle( $url, $client->string('PLUGIN_PANDORA_NO_TRACKS') );
+ setCurrentTitle( $client, $client->string('PLUGIN_PANDORA_NO_TRACKS') );
$client->update();
@@ -348,7 +348,7 @@
. $track->{artistName} . ' ' . $client->string('FROM') . ' '
. $track->{albumName};
- Slim::Music::Info::setCurrentTitle( $url, $title );
+ setCurrentTitle( $client, $title );
# Remove the previous track metadata
$client->pluginData( prevTrack => 0 );
@@ -436,6 +436,8 @@
modeName => 'Pandora Now Playing',
title => Slim::Music::Info::getCurrentTitle( $client, $url ),
url => $trackInfoURL,
+ remember => 0,
+ timeout => 35,
);
Slim::Buttons::Common::pushMode( $client, 'xmlbrowser', \%params );
@@ -443,4 +445,18 @@
$client->modeParam( 'handledTransition', 1 );
}
+sub setCurrentTitle {
+ my ( $client, $title ) = @_;
+
+ # We can't use the normal setCurrentTitle method because it would cause multiple
+ # players playing the same station to get the same titles
+ $client->pluginData( currentTitle => $title );
+}
+
+sub getCurrentTitle {
+ my ( $class, $client, $url ) = @_;
+
+ return $client->pluginData('currentTitle');
+}
+
1;
More information about the checkins
mailing list