Преглед изворни кода

Monitor the status even if the file has not set the update time. It is a bit more disk traffic, but it is not worth the hassle to track the individual update states separately, and we are already stating the file unconditionally.

Zachary Kotlarek пре 14 година
родитељ
комит
34573b3ce1
1 измењених фајлова са 26 додато и 20 уклоњено
  1. 26 20
      dmx/rope.pl

+ 26 - 20
dmx/rope.pl

@@ -65,17 +65,20 @@ while (1) {
 		my $mtime = mtime($DATA_DIR . '/PLAY_STATUS');
 		my $mtime = mtime($DATA_DIR . '/PLAY_STATUS');
 		if ($mtime > $updateLast) {
 		if ($mtime > $updateLast) {
 			$updateLast = $mtime;
 			$updateLast = $mtime;
+		}
 
 
-			# Grab the PLAY_STATUS value
-			$playing = 0;
-			my $fh;
-			open($fh, $DATA_DIR . '/PLAY_STATUS')
-			  or die("Unable to open PLAY_STATUS\n");
-			my $text = <$fh>;
-			close($fh);
-			if ($text =~ /1/) {
-				$playing = 1;
-			}
+		# Grab the PLAY_STATUS value
+		$playing = 0;
+		my $fh;
+		open($fh, $DATA_DIR . '/PLAY_STATUS')
+		  or die("Unable to open PLAY_STATUS\n");
+		my $text = <$fh>;
+		close($fh);
+		if ($text =~ /1/) {
+			$playing = 1;
+		}
+		if ($DEBUG) {
+			print STDERR 'Playing: ' . $playing . "\n";
 		}
 		}
 	}
 	}
 
 
@@ -84,17 +87,20 @@ while (1) {
 		my $mtime = mtime($DATA_DIR . '/PROJECTOR');
 		my $mtime = mtime($DATA_DIR . '/PROJECTOR');
 		if ($mtime > $updateLast) {
 		if ($mtime > $updateLast) {
 			$updateLast = $mtime;
 			$updateLast = $mtime;
+		}
 
 
-			# Grab the PROJECTOR value
-			$projector = 0;
-			my $fh;
-			open($fh, $DATA_DIR . '/PROJECTOR')
-			  or die("Unable to open PROJECTOR\n");
-			my $text = <$fh>;
-			close($fh);
-			if ($text =~ /1/) {
-				$projector = 1;
-			}
+		# Grab the PROJECTOR value
+		$projector = 0;
+		my $fh;
+		open($fh, $DATA_DIR . '/PROJECTOR')
+		  or die("Unable to open PROJECTOR\n");
+		my $text = <$fh>;
+		close($fh);
+		if ($text =~ /1/) {
+			$projector = 1;
+		}
+		if ($DEBUG) {
+			print STDERR 'Projector: ' . $projector . "\n";
 		}
 		}
 	}
 	}