public function testFindById() { $show = TV_Shows::findById($this->showId); $this->assertTrue($show); $this->assertTrue($show->seriesName == 'Battlestar Galactica (2003)'); $this->assertTrue($show->id == $this->showId); }
public function testGetSeason() { $show = TV_Shows::findById($this->showId); $season = $show->getSeason(2); foreach ($season as $episode) { $this->assertTrue((int) $episode->SeasonNumber == 2); } }
public function testEpisodeNotFound() { $show = TV_Shows::findById($this->showId); $missingEpisode = $show->getEpisode(1, 99); //test for existing season, but not episode $this->assertFalse($missingEpisode, "Error fetching episode that doesn't exist from existing season"); $missingSeason = $show->getEpisode(99, 1); //test for non-existing season and episode $this->assertFalse($missingSeason, "Error fetching episode for season that doesn't exist"); }
function show_info($title) { //Remove soft hyphens $title = str_replace("", "", $title); $episode_data = guess_match($title, true); if ($episode_data === false) { $isShow = false; $name = $title; $data = ''; } else { if (preg_match('/\\d+x\\d+/', $episode_data['episode'])) { $epiInfo = 1; } else { $epiInfo = 0; } $isShow = $episode_data['episode'] == 'noShow' ? false : true; $name = $episode_data['key']; $data = $episode_data['data']; } $episode_num = $episode_data['episode']; $shows = TV_Shows::search($name); if (count($shows) == 1) { episode_info($shows[0], $episode_num, $isShow, $epiInfo); } else { if (count($shows) > 1) { episode_info($shows[0], $episode_num, $isShow, $epiInfo); } else { episode_info($shows[0], $episode_num, 0, 0); } } }
* function for this) that can be accessed by this script. * * Uses the useful TVDB library by Ryan Doherty * * @author Jason Botello <*****@*****.**> **/ // include the TheTVDB API files require 'TVDB.php'; // remember to update this file with your TVDB API key $txt_file = file_get_contents('containingfile.txt'); // set raw video output file from media server $rows = explode('*', $txt_file); $showName = $rows[0]; $fileName = $rows[1]; $playlistPosition = $rows[2]; $shows = TV_Shows::search($showName); $show = $shows[0]; $finalShowName = $show->seriesName; // process IMDB link if ($show->imdbId) { $imdb_link = "» <a href='http://imdb.com/title/{$show->imdbId}' style='font-weight: bold;color: #ffa531;text-decoration: underline;font-size: 10px;' target='_blank'>IMDB</a>"; } else { $imdb_link = null; } // process TVDB link if ($show->id) { $tvdbshow_link1 = "<a href='http://thetvdb.com/?tab=series&id={$show->id}' style='font-weight: bold;color: #ff7800;text-shadow: 1px 1px 0px #000000;' target='_blank'>"; $tvdbshow_link2 = "</a>"; } else { $tvdbshow_link1 = null; $tvdbshow_link2 = null;