コード例 #1
0
 /**
  * Add the link for -manage-streamingonline-
  * @param Zend_Controller_Action $this
  * @return X_Page_ItemList_ManageLink
  */
 public function getIndexManageLinks(Zend_Controller_Action $controller)
 {
     return X_VlcShares_Plugins_Utils::getIndexManageEntryList($this->getId());
 }
コード例 #2
0
 /**
  * Add the link for -manage-upnp-
  * @param Zend_Controller_Action $this
  * @return X_Page_ItemList_ManageLink
  */
 public function getIndexManageLinks(Zend_Controller_Action $controller)
 {
     return X_VlcShares_Plugins_Utils::getIndexManageEntryList($this->getId(), null, null, null, array('controller' => 'upnp', 'action' => 'index'));
 }
コード例 #3
0
 /**
  * Show an error message if one of the plugin dependencies is missing
  * @param Zend_Controller_Action $this
  * @return X_Page_ItemList_Message
  */
 public function getIndexMessages(Zend_Controller_Action $controller)
 {
     $messages = new X_Page_ItemList_Message();
     if (class_exists("X_VlcShares_Plugins_Utils", true)) {
         if (!method_exists('X_VlcShares_Plugins_Utils', 'menuProxy')) {
             // old version of PageParserLib
             $message = new X_Page_Item_Message($this->getId(), "PageParserLib plugin version is old. Please, update it (0.1alpha2 or later required)");
             $message->setType(X_Page_Item_Message::TYPE_FATAL);
             $messages->append($message);
         } else {
             if (!$this->helpers()->rtmpdump()->isEnabled()) {
                 $messages->append(X_VlcShares_Plugins_Utils::getMessageEntry($this->getId(), 'p_own3d_err_rtmpdump_disabled', X_Page_Item_Message::TYPE_WARNING));
             }
         }
     } else {
         $message = new X_Page_Item_Message($this->getId(), "PageParser API is required from Own3d. Please, install PageParserLib plugin (0.1alpha2 or later required)");
         $message->setType(X_Page_Item_Message::TYPE_FATAL);
         $messages->append($message);
     }
     return $messages;
 }
コード例 #4
0
 public function menuShows(X_Page_ItemList_PItem $items, $type, $filter, $pageN = '1')
 {
     if ($type == 'plus') {
         $page = X_PageParser_Page::getPage(sprintf(self::URL_PROVIDER_PLUS, $filter, $pageN, 'tv'), new X_PageParser_Parser_Preg('/<td width="25%".*?<a href="https?:\\/\\/(www|secure).hulu.com\\/(?P<href>.*?)".*?<img alt="(?P<label>.*?)".*?src="(?P<thumbnail>.*?)".*?<div style="margin-top:0;">(?P<description>.*?)<\\/div>/is', X_PageParser_Parser_Preg::PREG_MATCH_ALL, PREG_SET_ORDER));
     } else {
         // hulu free
         $page = X_PageParser_Page::getPage(sprintf(self::URL_PROVIDER_FREE, $filter == '#' ? '%23' : strtoupper($filter), $pageN - 1), new X_PageParser_Parser_HuluFree());
     }
     $this->preparePageLoader($page);
     $parsed = $page->getParsed();
     if ($type == 'plus') {
         $nextResult = $page->getParsed(new X_PageParser_Parser_Preg('/<form.*?current_page="(?P<current>.*?)".*?total_pages="(?P<total>.*?)"/si', X_PageParser_Parser_Preg::PREG_MATCH));
     } else {
         $nextResult = $page->getParsed(new X_PageParser_Parser_Preg('/browse-lazy-load/', X_PageParser_Parser_Preg::PREG_MATCH));
     }
     if ($pageN != '1') {
         $previousPage = $pageN - 1;
         $items->append(X_VlcShares_Plugins_Utils::getPreviousPage("{$type}/{$filter}/{$previousPage}", $previousPage, isset($nextResult['total']) ? $nextResult['total'] : '???'));
     }
     foreach ($parsed as $match) {
         $label = $match['label'];
         $href = $match['href'];
         $thumbnail = $match['thumbnail'];
         $description = str_replace(array("\n", "\r"), '', trim($match['description']));
         $item = new X_Page_Item_PItem($this->getId() . "-{$href}", $label);
         $item->setIcon('/images/icons/folder_32.png')->setThumbnail($thumbnail)->setType(X_Page_Item_PItem::TYPE_CONTAINER)->setCustom(__CLASS__ . ':location', "{$type}/{$filter}/{$pageN}/{$href}")->setDescription(APPLICATION_ENV == 'development' ? "{$type}/{$filter}/{$pageN}/{$href}\t{$description}" : $description)->setLink(array('l' => X_Env::encode("{$type}/{$filter}/{$pageN}/{$href}")), 'default', false);
         $items->append($item);
     }
     if ($type == 'plus' && $nextResult && $nextResult['current'] != $nextResult['total'] || $type == 'free' && count($parsed) && count($nextResult)) {
         $nextPage = $pageN + 1;
         $items->append(X_VlcShares_Plugins_Utils::getNextPage("{$type}/{$filter}/{$nextPage}", $nextPage, isset($nextResult['total']) ? $nextResult['total'] : '???'));
     }
 }
コード例 #5
0
 private function _fetchGroupAnime(X_Page_ItemList_PItem $items, $resourceType, $pageN = 1)
 {
     $page = X_PageParser_Page::getPage(sprintf(self::URL_ANIME_INDEX_AZ, $pageN), X_PageParser_Parser_Preg::factory(self::PATTERN_MOVIESINCATEGORY, X_PageParser_Parser_Preg::PREG_MATCH_ALL, PREG_SET_ORDER));
     $this->preparePageLoader($page);
     $parsed = $page->getParsed();
     if ($pageN > 1) {
         // append "back" as first
         $prevPage = $pageN - 1;
         $items->append(X_VlcShares_Plugins_Utils::getPreviousPage("{$resourceType}/{$prevPage}", $prevPage));
     }
     // $parsed format = array(array('image', 'category', 'id', 'label'),..)
     foreach ($parsed as $pItem) {
         $label = trim($pItem['label']);
         $subtype = $pageN;
         $group = @$pItem['category'] ? "/{$pItem['category']}" : '';
         $id = @$pItem['id'] ? "/{$pItem['id']}" : '';
         X_Debug::i("Parsed items: " . var_export(array($id, $subtype, $group, $label), true));
         $item = new X_Page_Item_PItem($this->getId() . "-{$resourceType}-{$subtype}-{$group}-{$id}", $label);
         $item->setIcon('/images/icons/folder_32.png')->setType(X_Page_Item_PItem::TYPE_CONTAINER)->setCustom(__CLASS__ . ':location', "{$resourceType}/{$group}")->setDescription(APPLICATION_ENV == 'development' ? "{$resourceType}/{$subtype}{$group}{$id}" : null)->setLink(array('l' => X_Env::encode("{$resourceType}/{$subtype}{$group}{$id}")), 'default', false);
         $items->append($item);
     }
     if (count($page->getParsed(X_PageParser_Parser_Preg::factory(self::PATTERN_MOVIESINCATEGORY_NEXTPAGE, X_PageParser_Parser_Preg::PREG_MATCH)))) {
         // append "next" as last
         $nextPage = $pageN + 1;
         $items->append(X_VlcShares_Plugins_Utils::getNextPage("{$resourceType}/{$nextPage}", $nextPage));
     }
 }
コード例 #6
0
 public function menuLinks(X_Page_ItemList_PItem $items, $type, $filter, $title, $season, $episode, $pageN = 1)
 {
     $pageN = X_VlcShares_Plugins_Utils::isset_or($pageN, 1);
     if ($type == 'documentaries') {
         $page = X_PageParser_Page::getPage(sprintf(self::URL_INDEX_LINKS_DOCUMENTARIES, $type, $title, $pageN), new X_PageParser_Parser_TvLinks(X_PageParser_Parser_TvLinks::MODE_LINKS, $type, $filter, $title, $season, $episode, $pageN));
     } else {
         $page = X_PageParser_Page::getPage(sprintf(self::URL_INDEX_LINKS, $type, $title, $season, $episode, $pageN), new X_PageParser_Parser_TvLinks(X_PageParser_Parser_TvLinks::MODE_LINKS, $type, $filter, $title, $season, $episode, $pageN));
     }
     $this->preparePageLoader($page);
     $parsed = $page->getParsed();
     if ($pageN > 1) {
         // add -previous-page-
         $previousPage = $pageN - 1;
         $items->append(X_VlcShares_Plugins_Utils::getPreviousPage("{$type}/{$filter}/{$title}/{$season}/{$episode}/{$previousPage}", $previousPage));
     }
     foreach ($parsed as $match) {
         $id = $match['id'];
         $hoster = $match['hoster'];
         $label = X_Env::_('p_tvlinks_watchon', ucfirst($hoster));
         $thumbnail = array_key_exists('thumbnail', $match) ? $match['thumbnail'] : null;
         $item = new X_Page_Item_PItem($this->getId() . "-{$type}-{$filter}-{$title}-{$season}-{$episode}-{$id}", $label);
         if (file_exists(APPLICATION_PATH . '/../public/images/icons/hosters/' . $hoster . '.png')) {
             $item->setIcon("/images/icons/hosters/{$hoster}.png");
         } else {
             if (X_VlcShares::VERSION == "0.5.4") {
                 $item->setIcon("/images/icons/file_32.png");
             } else {
                 // icons exists only in vlc-shares > 0.5.4
                 $item->setIcon("/images/icons/unknown-hoster.png");
             }
         }
         $item->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setCustom(__CLASS__ . ':location', "{$type}/{$filter}/{$title}/{$season}/{$episode}/{$pageN}/{$id}")->setDescription(APPLICATION_ENV == 'development' ? "{$type}/{$filter}/{$title}/{$season}/{$episode}/{$pageN}/{$id}" : null)->setLink(array('action' => 'mode', 'l' => X_Env::encode("{$type}/{$filter}/{$title}/{$season}/{$episode}/{$pageN}/{$id}")), 'default', false);
         if ($thumbnail) {
             $item->setThumbnail($thumbnail);
         }
         $items->append($item);
     }
     if ($page->getParsed(new X_PageParser_Parser_TvLinks(X_PageParser_Parser_TvLinks::MODE_NEXTPAGE, $type, $filter, $title, $season, $episode, $pageN))) {
         $nextPage = $pageN + 1;
         $items->append(X_VlcShares_Plugins_Utils::getNextPage("{$type}/{$filter}/{$title}/{$season}/{$episode}/{$nextPage}", $nextPage));
     }
 }
コード例 #7
0
 /**
  *	Add button -watch megavideo stream directly-
  * 
  * @param string $provider
  * @param string $location
  * @param Zend_Controller_Action $controller
  */
 public function preGetModeItems($provider, $location, Zend_Controller_Action $controller)
 {
     if ($provider != $this->getId()) {
         return;
     }
     X_Debug::i("Plugin triggered");
     return X_VlcShares_Plugins_Utils::getWatchDirectlyOrFilter($this->getId(), $this, $location);
 }