/** * Add new scraper to database. * @var Scraper $scraper * @return */ public function addScraper(ScraperBean $scraper) { $query = "INSERT INTO xvod_scraper (name,description,language,image,link,type) VALUES (\n '" . $scraper->getName() . "',\n '" . $scraper->getDescription() . "',\n '" . $scraper->getLanguage() . "',\n '" . $scraper->getImage() . "',\n '" . $scraper->getLink() . "',\n '" . $scraper->getType() . "'\n );"; if (!$this->database->exec($query)) { //echo "<p>Error adding Scraper on query: " . $query . "</p>"; return false; } else { return true; } }
/** * Get scraper rss link. */ private function getLink(ScraperBean $scraper, $itemid) { if (strpos($scraper->getLink(), "?")) { $link = SERVER_HOST_AND_PATH . 'php/scraper' . $scraper->getLink() . URL_AMP . "PHPSESID=" . session_id(); } else { $link = SERVER_HOST_AND_PATH . 'php/scraper' . $scraper->getLink() . "?PHPSESID=" . session_id(); } $icon = XTREAMER_IMAGE_PATH . "img/" . $scraper->getType() . ".png"; $image = $scraper->getImage(); $image = substr($image, 0, strrpos($image, ".")) . "_grey" . substr($image, strrpos($image, ".")); return '<item>' . "\n" . ' <title><![CDATA[' . strtoupper($scraper->getName()) . ']]></title>' . "\n" . ' <subtitle><![CDATA[' . strtoupper($scraper->getName() . ' (' . $scraper->getLanguage() . ')') . ']]></subtitle>' . "\n" . ' <description><![CDATA[' . strtoupper($scraper->getDescription()) . ']]></description>' . "\n" . ' <link>' . $link . '</link>' . "\n" . ' <thumbnailover>' . XTREAMER_IMAGE_PATH . $scraper->getImage() . '</thumbnailover>' . "\n" . ' <thumbnailoff>' . XTREAMER_IMAGE_PATH . $image . '</thumbnailoff>' . "\n" . ' <image>' . $icon . '</image>' . "\n" . ' <itemid>' . $itemid . '</itemid>' . "\n" . ' <scraperid>' . $scraper->getId() . '</scraperid>' . "\n" . ' <scraperlanguage>' . strtoupper($scraper->getLanguage()) . '</scraperlanguage>' . "\n" . '</item>' . "\n"; }