Ejemplo n.º 1
0
 public static function _videoChilds($prmPath, $prmQuery, $start, $count)
 {
     $mediaItems = array();
     $maxCount = 0;
     $queryData = array();
     parse_str($prmQuery, $queryData);
     $parent = 'amp://video' . $prmPath;
     $pathreq = explode('/', $prmPath);
     if ($pathreq[0] == '' && count($pathreq) > 0) {
         array_shift($pathreq);
     }
     switch ($pathreq[0]) {
         case 'tvshows':
             switch (count($pathreq)) {
                 case 1:
                     // Get tvshow list
                     $tvshows = Catalog::get_tvshows();
                     list($maxCount, $tvshows) = self::_slice($tvshows, $start, $count);
                     foreach ($tvshows as $tvshow) {
                         $tvshow->format();
                         $mediaItems[] = self::_itemTVShow($tvshow, $parent);
                     }
                     break;
                 case 2:
                     // Get season list
                     $tvshow = new TVShow($pathreq[1]);
                     if ($tvshow->id) {
                         $season_ids = $tvshow->get_seasons();
                         list($maxCount, $season_ids) = self::_slice($season_ids, $start, $count);
                         foreach ($season_ids as $season_id) {
                             $season = new TVShow_Season($season_id);
                             $season->format();
                             $mediaItems[] = self::_itemTVShowSeason($season, $parent);
                         }
                     }
                     break;
                 case 3:
                     // Get episode list
                     $season = new TVShow_Season($pathreq[2]);
                     if ($season->id) {
                         $episode_ids = $season->get_episodes();
                         list($maxCount, $episode_ids) = self::_slice($episode_ids, $start, $count);
                         foreach ($episode_ids as $episode_id) {
                             $video = new Video($episode_id);
                             $video->format();
                             $mediaItems[] = self::_itemVideo($video, $parent);
                         }
                     }
                     break;
             }
             break;
         case 'clips':
             switch (count($pathreq)) {
                 case 1:
                     // Get clips list
                     $videos = Catalog::get_videos(null, 'clip');
                     list($maxCount, $videos) = self::_slice($videos, $start, $count);
                     foreach ($videos as $video) {
                         $video->format();
                         $mediaItems[] = self::_itemVideo($video, $parent);
                     }
                     break;
             }
             break;
         case 'movies':
             switch (count($pathreq)) {
                 case 1:
                     // Get clips list
                     $videos = Catalog::get_videos(null, 'movie');
                     list($maxCount, $videos) = self::_slice($videos, $start, $count);
                     foreach ($videos as $video) {
                         $video->format();
                         $mediaItems[] = self::_itemVideo($video, $parent);
                     }
                     break;
             }
             break;
         case 'personal_videos':
             switch (count($pathreq)) {
                 case 1:
                     // Get clips list
                     $videos = Catalog::get_videos(null, 'personal_video');
                     list($maxCount, $videos) = self::_slice($videos, $start, $count);
                     foreach ($videos as $video) {
                         $video->format();
                         $mediaItems[] = self::_itemVideo($video, $parent);
                     }
                     break;
             }
             break;
         default:
             $mediaItems[] = self::_videoMetadata('clips');
             $mediaItems[] = self::_videoMetadata('tvshows');
             $mediaItems[] = self::_videoMetadata('movies');
             $mediaItems[] = self::_videoMetadata('personal_videos');
             break;
     }
     if ($maxCount == 0) {
         $maxCount = count($mediaItems);
     }
     return array($maxCount, $mediaItems);
 }
Ejemplo n.º 2
0
     $tvshow = new TVShow($_REQUEST['tvshow_id']);
     if (!Catalog::can_remove($tvshow)) {
         debug_event('tvshow', 'Unauthorized to remove the tvshow `.' . $tvshow->id . '`.', 1);
         UI::access_denied();
         exit;
     }
     if ($tvshow->remove_from_disk()) {
         show_confirmation(T_('TVShow Deletion'), T_('TVShow has been deleted.'), AmpConfig::get('web_path'));
     } else {
         show_confirmation(T_('TVShow Deletion'), T_('Cannot delete this tvshow.'), AmpConfig::get('web_path'));
     }
     break;
 case 'show':
     $tvshow = new TVShow($_REQUEST['tvshow']);
     $tvshow->format();
     $object_ids = $tvshow->get_seasons();
     $object_type = 'tvshow_season';
     require_once AmpConfig::get('prefix') . '/templates/show_tvshow.inc.php';
     break;
 case 'match':
 case 'Match':
     $match = scrub_in($_REQUEST['match']);
     if ($match == "Browse") {
         $chr = "";
     } else {
         $chr = $match;
     }
     /* Enclose this in the purty box! */
     require AmpConfig::get('prefix') . '/templates/show_box_top.inc.php';
     show_alphabet_list('tvshows', 'tvshows.php', $match);
     show_alphabet_form($chr, T_('Show TV Shows starting with'), "tvshows.php?action=match");