Although sometimes a Controller is synonymous with a Speaker, when speakers are grouped together only the coordinator can receive events (play/pause/etc)
Inheritance: extends duncan3dc\Sonos\Speaker
Esempio n. 1
0
 /**
  * Send a soap request to the controller for this queue.
  *
  * @param string $service The service to send the request to
  * @param string $action The action to call
  * @param array $params The parameters to pass
  *
  * @return mixed
  */
 protected function soap($service, $action, $params = [])
 {
     $params["ObjectID"] = $this->id;
     if ($action === "Browse") {
         $params["Filter"] = "";
         $params["SortCriteria"] = "";
     }
     return $this->controller->soap($service, $action, $params);
 }
Esempio n. 2
0
 /**
  * Get the favourite radio shows/stations.
  *
  * @param int $type One of the class constants for either shows or stations
  *
  * @return Stream[]
  */
 protected function getFavourites($type)
 {
     $items = [];
     $result = $this->controller->soap("ContentDirectory", "Browse", ["ObjectID" => "R:0/{$type}", "BrowseFlag" => "BrowseDirectChildren", "Filter" => "*", "StartingIndex" => 0, "RequestedCount" => 100, "SortCriteria" => ""]);
     $parser = new XmlParser($result["Result"]);
     $tagName = $type === self::STATIONS ? "item" : "container";
     foreach ($parser->getTags($tagName) as $tag) {
         $name = $tag->getTag("title")->nodeValue;
         $uri = $tag->getTag("res")->nodeValue;
         $items[] = new Stream($uri, $name);
     }
     return $items;
 }
 /**
  * Get the current tracks in the queue.
  *
  * @param Controller $controller The Controller to grab the state of
  *
  * @return static
  */
 protected function getTracks(Controller $controller)
 {
     $this->tracks = $controller->getQueue()->getTracks();
     if ($controller->isStreaming()) {
         $media = $controller->getMediaInfo();
         $this->stream = new Stream($media["CurrentURI"]);
     }
     return $this;
 }