Example #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);
 }
Example #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;
 }