/** * Get bookmark rss link. */ private function getPlaylistItem(Playlist $link, $itemid) { $itemLink = SERVER_HOST_AND_PATH . 'php/index.php?action=' . ViewPlaylistPageAction::getActionName() . URL_AMP . 'subaction=' . ViewPlaylistPageAction::SUBACTION_PLAYLIST_OPEN . URL_AMP . 'playlist=' . base64_encode($link->getFilename()) . URL_AMP . 'PHPSESID=' . session_id(); $itemName = $link->getName() != null ? $link->getName() . " (" . $link->getFilename() . ")" : $link->getFilename(); return '<item>' . "\n" . ' <title><![CDATA[' . $itemName . ']]></title>' . "\n" . ' <description><![CDATA[' . $link->getDescription() . ']]></description>' . "\n" . ' <link>' . $itemLink . '</link>' . "\n" . ' <image>' . XTREAMER_IMAGE_PATH . 'playlist/video.png</image>' . "\n" . ' <itemid>' . $itemid . '</itemid>' . "\n" . '</item>' . "\n"; }
public function setPlaylist(Playlist $playlist) { $this->playlist = $playlist; $this->title = $playlist->getName(); $this->description = $playlist->getDescription(); }
/** * Create playlist xml document and save to file. * @param $file Ruta al archivo * @param $playlist Playlist. */ private function savePlaylist($file, Playlist $playlist) { //Save to xml $simpleXml = new SimpleXmlElement('<?xml version="1.0" encoding="UTF-8"?><playlist name="' . utf8_encode($playlist->getName()) . '" description="' . utf8_encode($playlist->getDescription()) . '"></playlist>'); $count = 1; foreach ($playlist->getPlaylistLinks() as $key => $playlistLink) { $element = $simpleXml->addChild("xfile"); $element->addAttribute("key", $playlistLink->getKey()); if ($playlistLink->getType() != null) { $element->addAttribute("type", $playlistLink->getType()); } else { $element->addAttribute("type", $count); ++$count; } if ($playlistLink->getThumbnail() != null) { $element->addAttribute("thumbnail", $playlistLink->getThumbnail()); } if ($playlistLink->getTitle() != null) { $element->addChild("title", "<![CDATA[" . $playlistLink->getTitle() . "]]>"); } if ($playlistLink->getDescription() != null) { $element->addChild("description", "<![CDATA[" . $playlistLink->getDescription() . "]]>"); } if ($playlistLink->getLink() != null) { $element->addChild("link", "<![CDATA[" . $playlistLink->getLink() . "]]>"); } if ($playlistLink->getFormat() != null) { $element->addChild("format", "<![CDATA[" . $playlistLink->getFormat() . "]]>"); } if ($playlistLink->getLanguage() != null) { $element->addChild("language", "<![CDATA[" . $playlistLink->getLanguage() . "]]>"); } if (count($playlistLink->getIds()) > 0) { $elementId = $element->addChild("part"); foreach ($playlistLink->getIds() as $order => $idValue) { $temp = $elementId->addChild("id", $idValue); $temp->addAttribute("order", $order); } } } $fp = fopen($file, 'w'); fwrite($fp, html_entity_decode($this->xmlpp($simpleXml->asXML(), false))); fclose($fp); }