[Slim-Checkins] r9764 - /branches/6.5/server/Slim/Player/Transporter.pm

adrian at svn.slimdevices.com adrian at svn.slimdevices.com
Fri Sep 15 15:21:45 PDT 2006


Author: adrian
Date: Fri Sep 15 15:21:43 2006
New Revision: 9764

URL: http://svn.slimdevices.com?rev=9764&view=rev
Log:
Bug: N/A
Description: merge -r 9761:9762 from trunk

Modified:
    branches/6.5/server/Slim/Player/Transporter.pm

Modified: branches/6.5/server/Slim/Player/Transporter.pm
URL: http://svn.slimdevices.com/branches/6.5/server/Slim/Player/Transporter.pm?rev=9764&r1=9763&r2=9764&view=diff
==============================================================================
--- branches/6.5/server/Slim/Player/Transporter.pm (original)
+++ branches/6.5/server/Slim/Player/Transporter.pm Fri Sep 15 15:21:43 2006
@@ -79,20 +79,23 @@
 	# value for those. If the user then goes and pressed play on a
 	# standard file:// or http:// URL, we need to set the value back to 0,
 	# IE: input from the network.
-	if ($params->{'url'}) {
-
-		if ($params->{'url'} =~ /^source:/) {
-
-			$::d_source && msg("Transporter::play - Got source: url [$params->{'url'}]\n");
+	
+	my $url = $params->{'url'};
+	if ($url) {
+
+		if (Slim::Music::Info::isDigitalInput($url)) {
+
+			$::d_source && msg("Transporter::play - Got source: url [$url]\n");
 
 			if ($INC{'Plugins/DigitalInput/Plugin.pm'}) {
 
-				my $value = Plugins::DigitalInput::Plugin::valueForSourceName($params->{'url'});
+				my $value = Plugins::DigitalInput::Plugin::valueForSourceName($url);
 
 				$::d_source && msg("Transporter::play - Setting DigitalInput to $value\n");
 
 				$client->prefSet('digitalInput', $value);
 				$client->sendFrame('audp', \pack('C', $value));
+				$client->directURL($url);
 				Slim::Player::Source::trackStartEvent($client);
 			}
 
@@ -100,7 +103,7 @@
 
 		} else {
 
-			$::d_source && msg("Transporter::play - setting DigitalInput to 0 for [$params->{'url'}]\n");
+			$::d_source && msg("Transporter::play - setting DigitalInput to 0 for [$url]\n");
 
 			$client->prefSet('digitalInput', 0);
 			$client->sendFrame('audp', \pack('C', 0));
@@ -108,6 +111,31 @@
 	}
 
 	return $client->SUPER::play($params);
+}
+
+sub power {
+	my ($client, $on) = @_;
+
+	# can't use the result below because power is sometimes called recursively through other display functions
+	my $was = $client->prefGet('power');
+	
+	my $result = $client->SUPER::power($on);
+
+	if (defined($on) && $was != $on) {
+		print " was: $was now: $on\n";
+	
+		# if we're turning off, then disable the digital input.
+		if ($on) {
+			# if we're turning on and the current song is a digital input, then start playing.
+			if (Slim::Music::Info::isDigitalInput(Slim::Player::Playlist::url($client))) {
+				$client->execute(["play"]);
+			}
+		} else {
+			$client->prefSet('digitalInput', 0);
+			$client->sendFrame('audp', \pack('C', 0));
+		}
+	}
+	return $result;	
 }
 
 sub updateClockSource {



More information about the checkins mailing list