[Slim-Checkins] r11707 - in /branches/6.5/server/Slim: Networking/Slimproto.pm Player/Client.pm Player/Protocols/HTTP.pm Player/Source.pm

andy at svn.slimdevices.com andy at svn.slimdevices.com
Sun Apr 1 13:12:04 PDT 2007


Author: andy
Date: Sun Apr  1 13:12:04 2007
New Revision: 11707

URL: http://svn.slimdevices.com?rev=11707&view=rev
Log:
Bugfix for metadata delay.  Stations that bounce between titles frequently (i.e. Lounging Sound) were not being set properly if the delay was greater than the station's change interval

Modified:
    branches/6.5/server/Slim/Networking/Slimproto.pm
    branches/6.5/server/Slim/Player/Client.pm
    branches/6.5/server/Slim/Player/Protocols/HTTP.pm
    branches/6.5/server/Slim/Player/Source.pm

Modified: branches/6.5/server/Slim/Networking/Slimproto.pm
URL: http://svn.slimdevices.com/branches/6.5/server/Slim/Networking/Slimproto.pm?rev=11707&r1=11706&r2=11707&view=diff
==============================================================================
--- branches/6.5/server/Slim/Networking/Slimproto.pm (original)
+++ branches/6.5/server/Slim/Networking/Slimproto.pm Sun Apr  1 13:12:04 2007
@@ -685,7 +685,8 @@
 	my $client = shift;
 	my $data_ref = shift;
 
-	$::d_directstream && msg("metadata (len: ". length($$data_ref) .")\n");
+	$::d_directstream && msg("metadata (len: ". length($$data_ref) .") $$data_ref\n");
+
 	if ($client->can('directMetadata')) {
 		$client->directMetadata($$data_ref);
 	}

Modified: branches/6.5/server/Slim/Player/Client.pm
URL: http://svn.slimdevices.com/branches/6.5/server/Slim/Player/Client.pm?rev=11707&r1=11706&r2=11707&view=diff
==============================================================================
--- branches/6.5/server/Slim/Player/Client.pm (original)
+++ branches/6.5/server/Slim/Player/Client.pm Sun Apr  1 13:12:04 2007
@@ -176,6 +176,7 @@
 	$client->[112] = 0; # knobSync
 	$client->[113] = {}; # pendingPrefChanges
 	$client->[114] = 0; # bufferStarted, tracks when players begin buffering/rebuffering
+	$client->[117] = undef; # metaTitle, current remote stream metadata title
 
 	$clientHash{$id} = $client;
 
@@ -1692,4 +1693,9 @@
 	@_ ? ($r->[114] = shift) : $r->[114];
 }
 
+sub metaTitle {
+	my $r = shift;
+	@_ ? ($r->[117] = shift) : $r->[117];
+}
+
 1;

Modified: branches/6.5/server/Slim/Player/Protocols/HTTP.pm
URL: http://svn.slimdevices.com/branches/6.5/server/Slim/Player/Protocols/HTTP.pm?rev=11707&r1=11706&r2=11707&view=diff
==============================================================================
--- branches/6.5/server/Slim/Player/Protocols/HTTP.pm (original)
+++ branches/6.5/server/Slim/Player/Protocols/HTTP.pm Sun Apr  1 13:12:04 2007
@@ -131,9 +131,10 @@
 
 		my $newTitle = Slim::Utils::Unicode::utf8decode_guess($1, 'iso-8859-1');
 
-		my $oldTitle = Slim::Music::Info::getCurrentTitle($client, $url) || '';
+		my $metaTitle = $client->metaTitle || '';
 
 		# capitalize titles that are all lowercase
+		# XXX: Why do we do this?  Shouldn't we let metadata display as-is?
 		if (lc($newTitle) eq $newTitle) {
 			$newTitle =~ s/ (
 					  (^\w)    #at the beginning of the line
@@ -145,7 +146,7 @@
 				/\U$1/xg;
 		}
 
-		if ($newTitle && ($oldTitle ne $newTitle)) {
+		if ($newTitle && ($metaTitle ne $newTitle)) {
 			
 			# Some mp3 stations can have 10-15 seconds in the buffer.
 			# This will delay metadata updates according to how much is in
@@ -160,14 +161,16 @@
 				$delay = $decodeBuffer + $outputBuffer;
 			}
 			
-			# No delay on the initial metadata (when old title is the station's title)
-			if ( $oldTitle eq Slim::Music::Info::title($url) ) {
+			# No delay on the initial metadata
+			if ( !$metaTitle ) {
 				$delay = 0;
 			}
 			
 			if ( $::d_remotestream || $::d_directstream ) {
 				msg("Delaying metadata title set by $delay secs\n");
 			}
+			
+			$client->metaTitle( $newTitle );
 			
 			Slim::Utils::Timers::setTimer(
 				$client,
@@ -178,7 +181,7 @@
 			);
 		}
 
-		return $newTitle;
+		return $metaTitle;
 	}
 
 	return undef;

Modified: branches/6.5/server/Slim/Player/Source.pm
URL: http://svn.slimdevices.com/branches/6.5/server/Slim/Player/Source.pm?rev=11707&r1=11706&r2=11707&view=diff
==============================================================================
--- branches/6.5/server/Slim/Player/Source.pm (original)
+++ branches/6.5/server/Slim/Player/Source.pm Sun Apr  1 13:12:04 2007
@@ -370,6 +370,9 @@
 
 	# if we're playing, then open the new song the master.		
 	if ($newmode eq "play") {
+		
+		# Clear previous metadata title when starting a new track
+		$client->metaTitle( undef );
 
 		# if the player is off, we automatically power on when we start to play
 		if (!$client->power()) {



More information about the checkins mailing list