diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..5a56530 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,37 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**NOTE:** IF YOU DO NOT ATTACH YOUR LOG FILES, THEN THERE IS A HIGHER PROBABILITY THE ISSUE WON'T BE RESOLVED. (Steps at end) +# Please answer the following: +**FPP Version and Hardware**: +Example: *FPP 8.x running on BBB* + + +**Describe the bug and Steps to reproduce**: +A clear and concise description of what the bug is and the steps to be taken to reproduce. +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior**: +A clear and concise description of what you expected to happen and why. + +**Additional context**: +Add any other context about the problem here. + +**Additional Attachments** +Please include the log files. To create the file: +1. Open the FPP UI +2. Open the the File Manager (Content Setup->File Manager), +3. Select the "Logs" tab +4. Click "zip" button. +5. Attach to this ticket. + +If applicable, add screenshots to help explain your problem. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0ced907 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.vscode +legacyBigButtonsSampleConfig.json diff --git a/bb-common.php b/bb-common.php new file mode 100755 index 0000000..12c3aeb --- /dev/null +++ b/bb-common.php @@ -0,0 +1,61 @@ + + + +function returnIfExists($json, $setting) { + if ($json == null) { + return ""; + } + if (array_key_exists($setting, $json)) { + return $json[$setting]; + } + return ""; +} + +function convertAndGetSettings() { + global $settings; + + $cfgFile = $settings['configDirectory'] . "/plugin.fpp-BigButtons"; + if (file_exists($cfgFile)) { + $pluginSettings = parse_ini_file($cfgFile); + $json = array(); + for ($x = 1; $x <= 20; $x++) { + $buttonName = "button" . sprintf('%02d', $x); + $color = returnIfExists($pluginSettings, $buttonName . "color"); + $desc = returnIfExists($pluginSettings, $buttonName . "desc"); + $script = returnIfExists($pluginSettings, $buttonName . "script"); + + if ($color != "" || $desc != "" || $script != "") { + $json["buttons"][$x]["description"] = $desc; + $json["buttons"][$x]["color"] = $color; + if ($script != "" && $script != null) { + $json["buttons"][$x]["command"] = "Run Script"; + $json["buttons"][$x]["args"][] = $script; + } else { + $json["buttons"][$x]["command"] = ""; + } + } + } + $fontsize = returnIfExists($pluginSettings, "buttonFontSize"); + if ($fontsize != "" && $fontsize != null) { + $json["fontSize"] = (int)$fontsize; + } + $title = returnIfExists($pluginSettings, "buttonTitle"); + if ($title != "" && $title != null) { + $json["title"] = $title; + } + + file_put_contents($cfgFile . ".json", json_encode($json, JSON_PRETTY_PRINT)); + unlink($cfgFile); + return $json; + } + if (file_exists($cfgFile . ".json")) { + $j = file_get_contents($cfgFile . ".json"); + $json = json_decode($j, true); + return $json; + } + $j = "{\"fontSize\": 12, \"title\": \"\", \"buttons\": {\"1\": {}}}"; + return json_decode($j, true); +} + + +?> diff --git a/bigbuttons.php b/bigbuttons.php old mode 100644 new mode 100755 index 295ff7a..9b9ab1b --- a/bigbuttons.php +++ b/bigbuttons.php @@ -1,58 +1,919 @@ - +
+ require_once("config.php"); require_once("common.php"); -$pluginSettings = array(); +require_once("bb-common.php"); -$pluginConfigFile = $settings['configDirectory'] . "/plugin." . $_GET['plugin']; -if (file_exists($pluginConfigFile)) - $pluginSettings = parse_ini_file($pluginConfigFile); +require_once("fppversion.php"); +include 'common/menuHead.inc'; ?> + -| %s | \n", - $pluginSettings[sprintf("button%02dcolor", $x)], $x, - $pluginSettings["buttonFontSize"], - $pluginSettings[sprintf("button%02ddesc", $x)]); + + + +