Exemplo n.º 1
0
 /**
  * Fetches the NFO for the movie id $AllocineId
  *
  * @param string AllocineId
  * @return array(nfo => string))
  */
 public function doSaveNfo($allocineId, $movieFolder)
 {
     $scraper = new MkvManagerScraperAllocine();
     $infos = $scraper->getMovieDetails($allocineId);
     $writer = new \mm\Xbmc\Nfo\Writers\Movie($infos);
     $nfoPath = ezcConfigurationManager::getInstance()->getSetting('movies', 'GeneralSettings', 'SourcePath') . DIRECTORY_SEPARATOR . $movieFolder . DIRECTORY_SEPARATOR . "{$movieFolder}.nfo";
     return array('nfo' => $writer->write($nfoPath));
 }
Exemplo n.º 2
0
    /**
     * Generates the NFO for the movie located in $this->folder ids $this->AllocineId and $this->TBDbId
     *
     * @param $this->folder The movie folder in the movies storage directory
     * @param $this->AllocineId
     * @param $this->TBDbId
     *
     * @return ezcMvcResult
     */
    public function doNfoGenerate()
    {
        $result = new \ezcMvcResult();
        $result->variables['page_title'] = "Generate NFO :: MKV Manager";
        $result->variables['saveUrl'] = "/nfo/movie/save/" . urlencode( $this->folder );
        $result->variables['updateUrl'] = '/nfo/movie/update-info';

        $allocineId = $this->AllocineId;
        $TMDbId = $this->TMDbId;

        $allocineScraper = new \MkvManagerScraperAllocine();
        // $allocineScraper->isCacheEnabled = false;
        $infos = $allocineScraper->getMovieDetails( $allocineId );

        $TMDbScraper = new \MkvManagerScraperTMDB();
        // $TMDbScraper->isCacheEnabled = false;
        $TMDbImages = $TMDbScraper->getImages( $TMDbId );

        foreach( $TMDbImages as $image )
        {
            if ( $image->type == 'poster' )
            {
                $variable = 'posters';
            }
            elseif ( $image->type == 'fanart' )
            {
                $variable = 'fanarts';
            }
            else
            {
                continue;
            }
            array_push( $infos->$variable, $image );
        }
        $result->variables['infos'] = $infos;

        // nfo
        $writer = new \mm\Xbmc\Nfo\Writers\Movie( $infos );
        $result->variables['nfo'] = $writer->get();

        return $result;
    }