// if the process list ends up returning nothing, Steam isn't currently processing shaders
if (empty($fossilizeList)) {
$output = "Steam is not currently processing shaders in the background.\n";
- exec ("notify-send \"".$output."\"");
- echo $output;
+ if (defined('STDIN')) {
+ exec ("notify-send \"".$output."\"");
+ echo $output;
+ }
}
// get each matching appid from the process list output and put it into a list
$json = json_decode(file_get_contents($url), true);
$gameName = $json[$appList[0]]['data']['name'];
$output = "Steam is processing shaders for app ID ".$appList[0]." (".$gameName.") in the background.\n";
- exec ("notify-send \"".$output."\"");
- echo $output;
+ if (defined('STDIN')) {
+ exec ("notify-send \"".$output."\"");
+ echo $output;
+ }
+}
+
+// if we're not running in the CLI, output HTML
+// to get a web-based version of this script.
+// obviously, the web server needs to run on a machine that has Steam running.
+if (!defined('STDIN')) {
+ echo '<html>';
+ echo '<head>';
+ echo '<meta http-equiv="refresh" content="60">';
+ echo '<title>Steam Shader Stats</title>';
+ echo '</head>';
+ echo '<body>';
+ echo '<h1>Steam Shader Stats</h1>';
+ echo '<p>This page displays the current status of Steam shader processing.';
+ echo '<br>The page will be auto-refreshed every minute.</p>';
+ echo '<h3>'.$output.'</h3>';
+ echo '</body>';
+ echo '</html>';
}
?>