function wec_kartinatv_getFavs() { $api = new kartinaAPI(); $api->loadCookie(); // fill in current values ... $favsarr = $api->getFavorites(); $favs = array(); for ($i = 0; $i < count($favsarr); $i++) { $favs[] = (string) $favsarr[$i]['cid']; } return $favs; }
function _pluginCreateFavList() { // Please note that all global variables // are wiped out! Therefore we have to instantiate // a local instance here .... // don't break your head about login / logout at kartina! // we will load the cookie from file so no authentication // is needed here ... we also don't need username and PW ... $tmpKartAPI = new kartinaAPI(); // load cookie ... $tmpKartAPI->loadCookie(); $retMediaItems = array(); $domChanList = new DOMDocument(); if (($channelList = $tmpKartAPI->getChannelListXml()) !== FALSE) { $domChanList->loadXML($channelList); $xpchan = new DOMXpath($domChanList); $favorites = $tmpKartAPI->getFavorites(); $favcount = count($favorites); for ($i = 0; $i < $favcount; $i++) { $cid = $favorites[$i]['cid']; $chanitem = $xpchan->query("/response/groups/item/channels/item[id='" . $cid . "']"); $chan = $chanitem->item(0); // there is only one such item ... $icon = $xpchan->query("icon", $chan)->item(0)->nodeValue; $name = $xpchan->query("name", $chan)->item(0)->nodeValue; $data = array('action' => 'arch_main', 'cid' => $cid); $dataString = http_build_query($data, "", "&"); $retMediaItems[] = array('id' => LOC_KARTINA_UMSP . "/kartina?" . $dataString, 'dc:title' => $name, 'upnp:class' => 'object.container', 'upnp:album_art' => KARTINA_HOST . $icon); } } return $retMediaItems; }