Esempio n. 1
0
 public function SetRadio($radio)
 {
     include __DIR__ . "/sonos.php";
     include __DIR__ . "/radio_stations.php";
     (new PHPSonos($this->ReadPropertyString("IPAddress")))->SetRadio(get_station_url($radio));
     (new PHPSonos($this->ReadPropertyString("IPAddress")))->Play();
 }
Esempio n. 2
0
 public function SetRadio($radio)
 {
     $ip = $this->ReadPropertyString("IPAddress");
     $timeout = $this->ReadPropertyString("TimeOut");
     if ($timeout && Sys_Ping($ip, $timeout) != true) {
         throw new Exception("Sonos Box " . $ip . " is not available");
     }
     if (@GetValue($this->GetIDForIdent("MemberOfGroup"))) {
         $this->SetGroup(0);
     }
     include_once __DIR__ . "/sonosAccess.php";
     include_once __DIR__ . "/radio_stations.php";
     $sonos = new SonosAccess($ip);
     // try to find Radio Station URL
     $uri = get_station_url($radio);
     if ($uri == "") {
         // check in TuneIn Favorites
         foreach ((new SimpleXMLElement($sonos->BrowseContentDirectory('R:0/0')['Result']))->item as $item) {
             if ($item->xpath('dc:title')[0] == $radio) {
                 $uri = (string) $item->res;
                 break;
             }
         }
     }
     if ($uri == "") {
         throw new Exception("Radio station " . $radio . " is unknown");
     }
     $sonos->SetRadio($uri, $radio);
     $sonos->Play();
 }
Esempio n. 3
0
<?php

include "settings.inc.php";
include "station.php";
if (isset($_GET["play"])) {
    echo get_station_name($_GET["play"]);
    file_put_contents($current_station_path, get_station_name($_GET["play"]));
    shell_exec("/home/pi/start_stream.sh " . get_station_url($_GET["play"]) . " > /dev/null 2>/dev/null &");
}
?>