/** * @return Episode[] */ public function getEpisodes() { $episodesJSON = $this->process($this->createRequest('/episodes/')); $episodes = array(); foreach ($episodesJSON as $json) { $episodes[] = Episode::createFromJSON($json); } return $episodes; }
public function loadFromData() { require $GLOBALS['env']['root']->getFile('tests/files/fixtures/EpisodesData.php'); foreach ($episodes as $row) { $row = (object) $row; list($tvShowName, $seasonNum, $seasonLang) = $seasonMappings[$row->season_id]; $episode = new Episode(); $episode->setIdentifier($row->id)->setLanguages($row->languages ? (array) unserialize(stripslashes($row->languages)) : array($seasonLang))->setSeason($season = $this->getSeason($tvShowName, $seasonNum, $seasonLang))->setNum((int) $row->num)->setStatus($row->status)->setInfo($row->info)->setTitle($row->title)->setRelease($row->releasegroup)->setLink($row->link)->setSection($row->section)->setDiscoveredTime(DateTime::createFromMysql($row->discoveredTime)); if ($row->finishedTime) { $episode->setFinishedTime(DateTime::createFromMysql($row->finishedTime)); } if ($row->downloadedTime) { $episode->setDownloadedTime(DateTime::createFromMysql($row->downloadedTime)); } $this->episodes[$tvShowName][$season->getNum()][] = $episode; } }
public function findThread(Episode $episode) { $this->login(); $tvShow = $episode->getTvShow(); $season = $episode->getSeason(); /* Thread Caching (nur im ShortCache nicht persistant) */ $threadKeys = array('threads', $tvShow->getIdentifier(), $season->getNum()); if (($thread = $this->shortCache->get($threadKeys, FALSE, FALSE)) === FALSE) { /* Board Caching ist nicht relevant, da subcentral.php sich schon selbst cached */ $boardId = $this->sc->findBoard($tvShow); $thread = $this->sc->findThread($boardId, $season); $this->cacheInfo->set($threadKeys, $thread); } return $thread; }
/** * @param SerienLoader\Entities\Episode $episode */ public function setEpisode(Episode $episode) { $this->episode = $episode; $episode->addLink($this); return $this; }