public function testGrab()
 {
     $sc = new Subcentral();
     // @TODO solve dependency injection für request (mit requestbundle so wie beim serienjunkies grabber)
     $html = $sc->login('technoplayer', 'logf22x3');
     $tvShow = new TvShow();
     $tvShow->setTitle('How I Met Your Mother');
     $boardId = $sc->findBoard($tvShow);
     $season = new Season();
     $season->setNum(7);
     $season->setTvShow($tvShow);
     list($threadLink, $threadId) = $sc->findThread($boardId, $season);
     $subs = $sc->getSubs($threadLink);
     $dir = PSC::get(PSC::PATH_FILES)->append('subs/' . $tvShow->getTitle() . '/' . $season->getNum() . '/');
     $dir->make(Dir::PARENT | Dir::ASSERT_EXISTS);
     $sc->downloadSubs($subs, $dir);
 }
 public function findBoard(TvShow $tvShow)
 {
     $this->logger->writeln('Suche Board für ' . $tvShow->getTitle());
     $ids = $this->getBoardIds();
     $t = mb_strtolower($tvShow->getTitle());
     if (!array_key_exists($t, $ids)) {
         $e = new SubcentralTvShowNotFoundException('TvShow: "' . $tvShow . '" wurde auf Subcentral nicht gefunden! (boardIDs)');
         $this->logger->writeln($e->getMessage());
         throw $e;
     }
     return $ids[$t];
 }
 /**
  * @return Season
  */
 public static function createFromJSON(stdClass $jsonObject)
 {
     $season = new static(TvShow::createFromJSON($jsonObject->tvShow), $jsonObject->num, $jsonObject->language);
     $season->setIdentifier((int) $jsonObject->id);
     return $season;
 }
 /**
  * @param SerienLoader\Entities\TvShow $tvShow
  */
 public function setTvShow(TvShow $tvShow)
 {
     $this->tvShow = $tvShow;
     $tvShow->addSeason($this);
     return $this;
 }