dls 4 audiocompanion

Signed-off-by: kai <kai@bsraudio.ch>
This commit is contained in:
kai
2026-02-11 11:56:17 +01:00
parent cad573d3b6
commit 59fe3efc9a

42
songphpdls.php Normal file
View File

@@ -0,0 +1,42 @@
<?php
// urls needed
$apiurl = "your APi song url";
$encoderurl = "http://ipofaudiocompanion:port/api/setDLS?dls=";
// your DLS
$file = '/export/dls.txt';
while (true) {
$newText = file_get_contents($apiurl);
if ($newText === false) {
sleep(10);
continue;
}
$oldText = file_exists($file) ? file_get_contents($file) : '';
// send on change
if ($newText !== $oldText) {
$tmp = '/export/dls.tmp';
file_put_contents($tmp, $newText, LOCK_EX);
rename($tmp, $file);
$currentData = file_get_contents($file);
$url = $encoderurl . urlencode($currentData);
$response = file_get_contents($url);
// echo $response;
// will be: default coder ok
}
sleep(10);
}
?>