Sfoglia il codice sorgente

Detect change more accurately

Zachary Kotlarek 14 anni fa
parent
commit
257649be2c
1 ha cambiato i file con 7 aggiunte e 2 eliminazioni
  1. 7 2
      plexMonitor/plexMonitor.pl

+ 7 - 2
plexMonitor/plexMonitor.pl

@@ -50,16 +50,21 @@ if (!-d $DATA_DIR) {
 }
 }
 
 
 # Loop forever (unless no delay is set)
 # Loop forever (unless no delay is set)
+my $data     = '';
 my $dataLast = '';
 my $dataLast = '';
 do {
 do {
-	my $changed = 0;
 
 
 	# Run the monitor command
 	# Run the monitor command
-	my $data = xbmcHTTP($CMDS{$MODE});
+	my $changed = 0;
+	$dataLast = $data;
+	$data     = xbmcHTTP($CMDS{$MODE});
 
 
 	# Compare this data set to the last
 	# Compare this data set to the last
 	if ($data ne $dataLast) {
 	if ($data ne $dataLast) {
 		$changed = 1;
 		$changed = 1;
+		if ($DEBUG) {
+			print STDERR "Change detected in data:\n" . $data . "\n";
+		}
 	}
 	}
 
 
 	# If anything changed, save the data to disk
 	# If anything changed, save the data to disk