Compare commits

...

2 Commits

Author SHA1 Message Date
Christian Seiler faeb89fb42 PHP/schedule.php: additional improvements 4 days ago
Christian Seiler 2417aee259 PHP: fix bug in serialization code 4 days ago
  1. 2
      php/monoformat_structured.php
  2. 29
      php/schedule.php

@ -26,7 +26,7 @@ function serializePixels(array $pixels): string {
function unserializePixels(int $n, string $serialized): array {
$nBytes = intdiv($n + 7, 8);
if (strlen($serialized) != $nBytes) {
$actual = strlen($serializd);
$actual = strlen($serialized);
throw new \ValueError("Could not unserialize a pixel bitmap: the size $actual does not equal the expected $nBytes");
}
$result = array_fill(0, $n, false);

@ -1,5 +1,11 @@
<?php
$roomMapping = [
];
$passThroughMapping = [
];
include_once("monoformat_schema.php");
include_once("monoformat_structured.php");
@ -23,8 +29,27 @@ function replaceTalkInfo($str, $talks) {
}, $str);
}
$roomMapping = [
];
if (isset($_GET["mac"]) and array_key_exists($_GET["mac"], $passThroughMapping)) {
$fn = $passThroughMapping[$_GET["mac"]];
if (is_dir($fn)) {
$d = opendir($fn);
$files = [];
while (($e = readdir($d)) !== false) {
if (str_ends_with($e, ".bin")) {
array_push($files, $fn . "/" . $e);
}
}
sort($files);
if (!count($files)) {
die("No files found");
}
$n = (time() / 60) % count($files);
$fn = $files[$n];
}
Header("Content-Type: application/octet-stream");
readfile($fn);
exit(0);
}
if (!isset($_GET["mac"]) or !array_key_exists($_GET["mac"], $roomMapping)) {
/* We didn't find this device in the mapping, so let's just

Loading…
Cancel
Save