示例#1
0
 /**
  * @param FixtureMovieData $f
  */
 private function writeLookupFailureMovie(FixtureMovieData $f)
 {
     try {
         $fileSize = $f->getFile()->getSizeHuman();
     } catch (\RuntimeException $e) {
         $fileSize = 'UNKNOWN';
     }
     $rows = [['Tvdb Id', ''], ['File Path', $f->getFile()->getPathname()], ['Movie Title', $f->getName()], ['Release Year', $f->getYear()], ['Size', $fileSize], ['API Match', '<fg=red>FAIL</>']];
     $this->ioVerbose(function (StyleInterface $style) use($rows) {
         $style->table($rows, []);
     });
     $rows = [['File Path', $f->getFile()->getPathname()], ['Size', $fileSize], ['API Match', '<fg=red>Failure</>']];
     $this->ioNotVerbose(function (StyleInterface $style) use($rows) {
         $style->table($rows, []);
     });
 }
 /**
  * @param FixtureMovieData $fixture
  * @param string           $baseName
  */
 protected function parseMovieTitle(FixtureMovieData $fixture, &$baseName)
 {
     $name = $baseName[0];
     foreach (['.', '-', '['] as $search) {
         $name = ucwords(trim(str_replace($search, ' ', $name)));
     }
     $fixture->setName($name);
 }
示例#3
0
 /**
  * @param FixtureMovieData  $f
  * @param \Twig_Environment $e
  * @param string            $tplPathName
  * @param string            $tplFileName
  *
  * @return \Twig_Environment[]|mixed[][]
  */
 private function moveMovie(FixtureMovieData $f, \Twig_Environment $e, $tplPathName, $tplFileName)
 {
     $e->setLoader(new \Twig_Loader_Array([$tplPathName => $this->tplPathMovie, $tplFileName => $this->tplFileMovie]));
     $opts = ['name' => $f->getName(), 'ext' => strtolower(pathinfo($f->getFile()->getRelativePathname(), PATHINFO_EXTENSION))];
     if ($f->hasId()) {
         $opts['id'] = $f->getId();
     }
     if ($f->hasYear()) {
         $opts['year'] = $f->getYear();
     }
     return [$e, $opts];
 }