Update test_omdb_API script

This commit is contained in:
DariusIII
2017-05-15 13:14:09 +02:00
parent edc8b2a147
commit 9b7708ae73
+7 -7
View File
@@ -7,23 +7,23 @@ use nntmux\ColorCLI;
$omdb = new OMDbAPI();
if (!empty($argv[1])) {
if (!empty($argv[1]) && !empty($argv[2]) && ($argv[2] !== 'series' || $argv[2] !== 'movie')) {
// Test if your OMDb API key and configuration are working
// If it works you should get a printed array of the show entered
// Search for a show
$series = $omdb->search((string)$argv[1], 'series');
if (is_object($series) && $series->data->Response !== 'False' ) {
print_r($series);
$search = $omdb->search((string)$argv[1], (string)$argv[2]);
if (is_object($search) && $search->data->Response !== 'False' ) {
print_r($search->data->Search[0]->Title. PHP_EOL);
}
// Use the first show found (highest match) and get the requested season/episode from $argv
if (is_object($series) && $series->data->Response !== 'False') {
if (is_object($search) && $search->data->Response !== 'False') {
$series = $omdb->fetch('i', $series->data->Search[0]->imdbID);
$search = $omdb->fetch('i', $search->data->Search[0]->imdbID);
print_r($series);
print_r($search);
} else {