Files
rpigroupplay/config/getStation.inc.php
2026-01-03 11:59:31 +01:00

54 lines
1.5 KiB
PHP

<?php
// Funzione per caricare il file XML delle radio
function loadRadioStations() {
$xml = simplexml_load_file('./data/radio.xml');
if ($xml === false) {
error_log("Errore nel caricamento del file XML: data/radio.xml");
return [];
}
return $xml->station;
}
// Funzione per ottenere una singola stazione radio
function getRadioStation($id) {
$xml = simplexml_load_file('./data/radio.xml');
if ($xml === false) {
error_log("Errore nel caricamento del file XML: data/radio.xml");
return null;
}
foreach ($xml->station as $station) {
if ((int)$station->id === $id) {
return $station;
}
}
return null;
}
// Funzione per caricare il file XML delle TV
function loadTVStations() {
$xml = simplexml_load_file('./data/tv.xml');
if ($xml === false) {
error_log("Errore nel caricamento del file XML: data/tv.xml");
return [];
}
return $xml->station;
}
// Funzione per ottenere una singola stazione TV
function getTVStation($id) {
$xml = simplexml_load_file('./data/tv.xml');
if ($xml === false) {
error_log("Errore nel caricamento del file XML: data/tv.xml");
return null;
}
foreach ($xml->station as $station) {
if ((int)$station->id === $id) {
return $station;
}
}
return null;
}
$changelog = simplexml_load_file("./data/changelog.xml") or die("Errore: Impossibile accedere al file CHANGELOG");
$version_app = $changelog->version->number[0];