forked from LightsOnHudson/FPP-Plugin-TwilioControl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
writePlaylist.php
executable file
·37 lines (29 loc) · 912 Bytes
/
writePlaylist.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/php
<?php
error_reporting(0);
$pluginName ="SMS";
$DEBUG=false;
$myPid = getmypid();
$skipJSsettings = 1;
include_once("/opt/fpp/www/config.php");
include_once("/opt/fpp/www/common.php");
include_once("functions.inc.php");
$logFile = $settings['logDirectory']."/".$pluginName.".log";
$FPPDStatus = isFPPDRunning();
do{
$cmd = "sudo /opt/fpp/bin/fpp -s > /tmp/FPP.playlist";
exec($cmd,$tmp);
sleep(1);
$playlistName = file_get_contents ("/tmp/FPP.playlist");
logEntry("Playlist name = ".$playlistName);
if($playlistName == "false" && $FPPDStatus == "RUNNING") {
logEntry("looping... playlist name should not be false..is FPPD running?");
}
if($playlistName == "false" && $FPPDStatus != "RUNNING") {
logEntry("FPPD Daemon is not running..exiting");
exit(0);
}
}while($playlistName == "false");
$playlistName = getRunningPlaylist();
logEntry("We got a valid playlist status from fpp -s ");
?>