Skip to content

Commit

Permalink
Fix the imdb command. Uses a new API.
Browse files Browse the repository at this point in the history
Signed-off-by: Yoshi2889 <rick.2889@gmail.com>
  • Loading branch information
NanoSector committed Jan 7, 2015
1 parent c424c52 commit a903ff8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Classes/Command/Imdb.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Imdb extends \Library\IRC\Command\Base {
*
* @var string
*/
private $apiUri = 'http://imdbapi.org/?title=%s&type=json&plot=none&episode=0&limit=1&yg=0&mt=none&lang=en-US&offset=&aka=full&release=simple&business=0&tech=0';
private $apiUri = 'http://omdbapi.com/?t=%s&r=json&plot=short';

/**
* The number of arguments the command needs.
Expand Down Expand Up @@ -61,9 +61,10 @@ public function command()

$json = json_decode($getJson, true);

$title = $json[0]['title'];
$rating = $json[0]['rating'];
$imdbUrl = $json[0]['imdb_url'];
$title = $json['Title'];
$rating = $json['imdbRating'];
$shortPlot = $json['Plot'];
$link = 'http://www.imdb.com/title/' . $json['imdbID'];

/*
* Check if response is given
Expand All @@ -73,6 +74,7 @@ public function command()
return;
}

$this->say(sprintf('Title: %s | Rating: %s | %s', $title, $rating, $imdbUrl));
$this->say(sprintf('Title: %s | Rating: %s | %s | %s', $title, $rating, $shortPlot, $link));
}
}

0 comments on commit a903ff8

Please sign in to comment.