client->searchTVShow((string)$argv[1]); // Use the first show found (highest match) and get the requested season/episode from $argv if ($series) { print_r($series[0]); if ($season > 0 AND $episode > 0) { $episodeObj = $tmdb->client->getEpisode($series[0]->_data['id'], $season, $episode); if ($episodeObj) { print_r($episodeObj); } } else if ($season == 0 && $episode == 0) { $episodeObj = $tmdb->client->getTVShow($series[0]->_data['id']); if (is_array($episodeObj)) { foreach ($episodeObj AS $ep) { print_r($ep); } } } else { exit($c->error("Invalid episode data returned from TVMaze API.")); } } else { exit($c->error("Invalid show data returned from TVMaze API.")); } } else { exit($c->error("Invalid arguments. This script requires a text string (show name) followed by a season and episode number.")); }