. * @author DariusIII * @copyright 2016 newznab-tmux */ namespace Blacklight; use GuzzleHttp\Client; /** * Class CouchPotato. */ class CouchPotato { /** * URL to the CP server. * @var string */ public $cpurl = ''; /** * The CP key. * @var string */ public $cpapi = ''; /** * Imdb ID. * @var string */ public $imdbid = ''; /** * CouchPotato constructor. * * @param \App\Http\Controllers\BasePageController $page */ public function __construct($page) { $this->cpurl = ! empty($page->userdata['cp_url']) ? $page->userdata['cp_url'] : ''; $this->cpapi = ! empty($page->userdata['cp_api']) ? $page->userdata['cp_api'] : ''; } /** * Send a movie to CouchPotato. * * @param string $id * * @return bool|mixed * @throws \RuntimeException */ public function sendToCouchPotato($id) { $this->imdbid = $id; return (new Client(['verify' => false]))->get( $this->cpurl. '/api/'. $this->cpapi. '/movie.add/?identifier=tt'. $this->imdbid )->getBody()->getContents(); } }