Procházet zdrojové kódy

More complete data for the PLEX status flag

Zachary Kotlarek před 13 roky
rodič
revize
1af8470318
1 změnil soubory, kde provedl 10 přidání a 0 odebrání
  1. 10 0
      dmx/state.pl

+ 10 - 0
dmx/state.pl

@@ -434,6 +434,7 @@ while (1) {
 	$timeSinceUpdate = time() - $updateLast;
 
 	# Calculate the PLEX state
+	$files{'PLEX'}->{'last'} = $files{'PLEX'}->{'value'};
 	$files{'PLEX'}->{'value'} = 0;
 	if (exists($files{'FRONT_APP'})) {
 		if (   $files{'FRONT_APP'}->{'value'} eq 'com.plexapp.plex'
@@ -442,6 +443,9 @@ while (1) {
 			$files{'PLEX'}->{'value'} = 1;
 		}
 	}
+	if ($files{'PLEX'}->{'last'} != $files{'PLEX'}->{'value'}) {
+		$files{'PLEX'}->{'update'} = time();
+	}
 
 	# Determine some intermediate state data
 	my $playing = 0;
@@ -455,6 +459,12 @@ while (1) {
 		$video = 1;
 	}
 
+	# Non-plex apps are always "playing" and "video"
+	if (exists($files{'PLEX'}) && $files{'PLEX'}->{'value'}) {
+		$playing = 1;
+		$video = 1;
+	}
+
 	# Calculate the new state
 	$stateLast = $state;
 	if (!defined($DISPLAY) || !exists($files{$DISPLAY})) {