Ejemplo n.º 1
0
 /**
  * Sørg for at vi har hentet ned informasjon om filmen og lagret cache
  */
 public function build_cache($rebuild = false)
 {
     $file_cache = $this->path . "/" . self::FILE_IMDB_CACHE;
     $file_id = $this->path . "/" . self::FILE_IMDB_ID;
     $file_poster_src = $this->path . "/" . self::FILE_IMDB_POSTER_SRC;
     $file_poster = $this->path . "/" . self::FILE_IMDB_POSTER;
     // sjekk om vi har cache i mappen
     if (!$rebuild && file_exists($file_cache) && file_exists($file_id) && file_exists($file_poster)) {
         return null;
     }
     // hent data
     if (!$this->get_imdb_page(!$rebuild, true, true)) {
         return false;
         #throw new \Exception("Kunne ikke hente data for filmen.");
     }
     // behandle html
     $this->load_cache(false);
     $this->build_cache_poster($rebuild);
     // sjekk for metadata
     $this->get_movie_details(false);
     // lagre global cache
     $this->filmdb->cache_set($this);
     return true;
 }