private function loadSerieFiche() { $oTVDB = new \PHPTVDB\TV_Shows(); $oShow = $oTVDB->findById($this->oRequest->getParam('fiche', 'string')); if ($oShow != false) { $oFicheSerie = new Ficheserie(); $oFicheSerie->loadFromTheTVDB($oShow); $oFicheSerie->storeIfNotExists($this->oRelease->getId()); return $oFicheSerie; } else { throw new Error('Aucune fiche ne correspond à l\'ID', 1163); } }
/** * Essai de scrapper une série TV * @return boolean Vrai si c'est une série */ private function tryTvShow() { if (preg_match('#(\\W|^)(S|Season|Saison)[0-9]+(\\W|$)#i', $this->sReleaseName, $aCode)) { $aElements = preg_split('#(\\W|^)(S|Season|Saison)[0-9]+(\\W|$)#i', $this->sReleaseName); $sShow = strtr($aElements[0], ".", " "); } else { if (preg_match('#(\\W|^)S[0-9]+E[0-9]+(\\W|$)#i', $this->sReleaseName, $aCode)) { $aElements = preg_split('#(\\W|^)S[0-9]+E[0-9]+(\\W|$)#i', $this->sReleaseName); $sShow = strtr($aElements[0], ".", " "); } else { if (preg_match('#(\\W|^)Vol[0-9]+(\\W|$)#i', $this->sReleaseName, $aCode)) { $aElements = preg_split('#(\\W|^)Vol[0-9]+(\\W|$)#i', $this->sReleaseName); $sShow = strtr($aElements[0], ".", " "); } } } if (isset($sShow)) { $oTVDB = new \PHPTVDB\TV_Shows(); $aShows = $oTVDB->search($sShow); if (count($aShows) > 0) { $oShow = $aShows[0]; $oFicheSerie = new Ficheserie(); $oFicheSerie->loadFromTheTVDB($oShow); $oFicheSerie->storeIfNotExists($this->iReleaseId); $this->iCategorieId = 2; $this->sFicheId = $oShow->id; $aDatas = array('id_categorie' => $this->iCategorieId); parent::update('tks_releases', $aDatas, $this->iReleaseId); return true; } else { return false; } } return false; }