Esempio n. 1
0
 /**
  * @param array $options Class instances / Echo to cli?
  */
 public function __construct(array $options = [])
 {
     parent::__construct($options);
     $this->client = new Client(self::TVDB_URL, self::TVDB_API_KEY);
     $this->posterUrl = self::TVDB_URL . DS . 'banners/_cache/posters/%s-1.jpg';
     $this->fanartUrl = self::TVDB_URL . DS . 'banners/_cache/fanart/original/%s-1.jpg';
     $this->imgSavePath = nZEDb_COVERS . 'tvshows' . DS;
     $this->serverTime = $this->client->getServerTime();
     $this->timeZone = new \DateTimeZone('UTC');
     $this->timeFormat = 'Y-m-d H:i:s';
 }
Esempio n. 2
0
 /**
  * @param array $options Class instances / Echo to cli?
  */
 public function __construct(array $options = [])
 {
     parent::__construct($options);
     $this->client = new Client(self::TVDB_URL, self::TVDB_API_KEY);
     $this->posterUrl = self::TVDB_URL . DS . 'banners/_cache/posters/%s-1.jpg';
     $this->fanartUrl = self::TVDB_URL . DS . 'banners/_cache/fanart/original/%s-1.jpg';
     $this->local = false;
     // Check if we can get the time for API status
     // If we can't then we set local to true
     try {
         $this->serverTime = $this->client->getServerTime();
     } catch (CurlException $error) {
         if (strpos($error->getMessage(), 'Cannot fetch') === 0) {
             echo $this->pdo->log->warning('Could not reach TVDB API. Running in local mode only!');
             $this->local = true;
         }
     } catch (XmlException $error) {
         if (strpos($error->getMessage(), 'Error in file') === 0) {
             echo $this->pdo->log->warning('Bad response from TVDB API. Running in local mode only!');
             $this->local = true;
         }
     }
 }