42
songphpdls.php
Normal file
42
songphpdls.php
Normal 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);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user