protected function renderControls() { echo $this->form->typeaheadFieldControlGroup($this->model, 'name', CJavaScript::encode($this->getTypeaheadData(VideoLibrary::getTVShows(array('properties' => array()))))); echo $this->form->dropDownListControlGroup($this->model, 'genre', $this->model->getGenres(), array('empty' => ' ')); echo $this->form->dropDownListControlGroup($this->model, 'watchedStatus', VideoFilterForm::getWatchedStatuses(), array('empty' => ' ', 'style' => 'width: 120px;')); echo $this->form->typeaheadFieldControlGroup($this->model, 'actor', $this->getActorNameTypeaheadData(Actor::MEDIA_TYPE_TVSHOW)); }
/** * Populates and returns the list of genres * @return array */ public function getGenres() { if (empty($this->_genres)) { $genres = VideoLibrary::getGenres($this->getGenreType()); foreach ($genres as $genre) { $this->_genres[$genre->label] = $genre->label; } } return $this->_genres; }
/** * @return array list of all movie directors */ public static function getDirectors() { // Fetch the list of all movies $movies = VideoLibrary::getMovies(array('properties' => array('director'))); $directors = array(); foreach ($movies as $movie) { $directors = array_merge($directors, $movie->director); } // We want this to be an array with just values, the keys don't matter return array_values(array_unique($directors)); }
public function getStreamableItems() { $items = array(); $seasons = VideoLibrary::getSeasons($this->tvshowid); // Get all episodes from all the seasons foreach ($seasons as $season) { $episodes = VideoLibrary::getEpisodes($this->tvshowid, $season->season); $items = array_merge($items, $episodes); } return $items; }
/** * Returns a set of links to the media items * @return ItemLink[] the item links */ public function getItemLinks() { $items = array(); // An item may consist of multiple items, a file may consist of multiple // links foreach ($this->getStreamableItems() as $mediaItem) { $name = $mediaItem->getDisplayName(); // Get the links to the media. We have to omit credentials from the // URLs if the user is using Internet Explorer since it won't // follow such links $links = VideoLibrary::getVideoLinks($mediaItem->file, Browser::isInternetExplorer()); $linkCount = count($links); foreach ($links as $k => $link) { $label = $linkCount > 1 ? $name . ' (#' . ++$k . ')' : $name; $items[] = new ItemLink($label, $link, $mediaItem); } } return $items; }
/** * Serves a playlist containing the specified movie's files to the browser * @param int $id the movie ID */ public function actionGetMoviePlaylist($id, $playlistFormat) { $movieDetails = VideoLibrary::getMovieDetails($id, array('file', 'runtime', 'year', 'thumbnail')); $this->log('"%s" streamed "%s"', Yii::app()->user->name, $movieDetails->getDisplayName()); $this->servePlaylist($movieDetails, $playlistFormat); }
public function getStreamableItems() { return VideoLibrary::getEpisodes($this->tvshowid, $this->season); }
/** * Returns the typeahead data for the actor fields. * @param string $mediaType filter by movies or TV shows * @return string the list of movies encoded as JavaScript */ protected function getActorNameTypeaheadData($mediaType) { $cacheId = 'MovieFilterActorNameTypeahead_' . $mediaType; return $this->getTypeaheadSource($cacheId, function () use($mediaType) { return $this->getTypeaheadData(VideoLibrary::getActors($mediaType)); }); }
/** * Returns a data provider containing the episodes for the specified show * and season * @param int $tvshowId the TV show ID * @param int $season the season number * @return \LibraryDataProvider */ public function getEpisodeDataProvider($tvshowId, $season) { $episodes = VideoLibrary::getEpisodes($tvshowId, $season); // We never want pagination here return new LibraryDataProvider($episodes, array('pagination' => false)); }
/** * Returns the typeahead data for the director field */ public function actionGetDirectorNames() { $this->renderJson(json_encode(VideoLibrary::getDirectors())); }