Exemplo n.º 1
0
 /**
  * Gets the specific episode info for the parsed release after match
  * Returns a formatted array of episode data or false if no match
  *
  * @param integer $tvdbid
  * @param integer $season
  * @param integer $episode
  * @param string  $airdate
  * @param integer $videoId
  *
  * @return array|false
  */
 protected function getEpisodeInfo($tvdbid, $season, $episode, $airdate = '', $videoId = 0)
 {
     $return = $response = false;
     if ($airdate !== '') {
         try {
             $response = $this->client->getEpisodeByAirDate($tvdbid, $airdate);
         } catch (CurlException $error) {
             if (strpos($error->getMessage(), 'Cannot fetch') === 0) {
                 return false;
             }
         } catch (XmlException $error) {
             if (strpos($error->getMessage(), 'Error in file') === 0) {
                 return false;
             }
         }
     } else {
         if ($videoId > 0) {
             try {
                 $response = $this->client->getSerieEpisodes($tvdbid, 'en');
             } catch (CurlException $error) {
                 if (strpos($error->getMessage(), 'Cannot fetch') === 0) {
                     return false;
                 }
             } catch (XmlException $error) {
                 if (strpos($error->getMessage(), 'Error in file') === 0) {
                     return false;
                 }
             }
         } else {
             try {
                 $response = $this->client->getEpisode($tvdbid, $season, $episode);
             } catch (CurlException $error) {
                 if (strpos($error->getMessage(), 'Cannot fetch') === 0) {
                     return false;
                 }
             } catch (XmlException $error) {
                 if (strpos($error->getMessage(), 'Error in file') === 0) {
                     return false;
                 }
             }
         }
     }
     sleep(1);
     if (is_object($response)) {
         if ($this->checkRequiredAttr($response, 'tvdbE')) {
             $return = $this->formatEpisodeInfo($response);
         }
     } else {
         if (is_array($response) && isset($response['episodes']) && $videoId > 0) {
             foreach ($response['episodes'] as $singleEpisode) {
                 if ($this->checkRequiredAttr($singleEpisode, 'tvdbE')) {
                     $this->addEpisode($videoId, $this->formatEpisodeInfo($singleEpisode));
                 }
             }
         }
     }
     return $return;
 }
Exemplo n.º 2
0
 /**
  * Gets the specific episode info for the parsed release after match
  * Returns a formatted array of episode data or false if no match
  *
  * @param integer	$tvdbid
  * @param integer	$season
  * @param integer	$episode
  * @param string	$airdate
  * @param integer	$videoId
  *
  * @return array|bool
  */
 protected function getEpisodeInfo($tvdbid, $season, $episode, $airdate = '', $videoId = 0)
 {
     $return = $response = false;
     if ($airdate !== '') {
         try {
             $response = $this->client->getEpisodeByAirDate($tvdbid, $airdate);
         } catch (\Exception $error) {
         }
     } else {
         if ($videoId > 0) {
             try {
                 $response = $this->client->getSerieEpisodes($tvdbid, 'en');
             } catch (\Exception $error) {
             }
         } else {
             try {
                 $response = $this->client->getEpisode($tvdbid, $season, $episode);
             } catch (\Exception $error) {
             }
         }
     }
     sleep(1);
     if (is_object($response)) {
         if ($this->checkRequired($response, 2)) {
             $return = $this->formatEpisodeArr($response);
         }
     } else {
         if (is_array($response) && isset($response['episodes']) && $videoId > 0) {
             foreach ($response['episodes'] as $singleEpisode) {
                 if ($this->checkRequired($singleEpisode, 2)) {
                     $this->addEpisode($videoId, $this->formatEpisodeArr($singleEpisode));
                 }
             }
         }
     }
     return $return;
 }