/** * Forsøk å finn detaljer om filmfilen i filmmappen */ public function get_movie_details($cache = true, $save = true, $global_cache = true) { if ($this->cache_movie !== null) { return $this->cache_movie; } // forsøk og hent global cache if ($cache && $global_cache) { if ($this->cache_global_load($cache)) { return $this->cache_movie; } } // sjekk for lokal cache $path = $this->path . "/" . self::FILE_MOVIE_METADATA; if ($cache && file_exists($path)) { return unserialize(file_get_contents($path)); } // list opp alle filene i mappen $files = FilmDB::search_folder($this->path, function ($folder, $file) { return is_file($folder . "/" . $file); }); // generer cache $ret = NULL; foreach ($files as $file) { if (preg_match("~(^\\.|\\.(rar|r[0-9]{2}|nfo|sfv|jpg|png|gif|zip)\$)~i", $file)) { continue; } // forsøk å lese med ffmpeg $ffmpeg = $this->filmdb->get_ffmpeg(); if ($ffmpeg && ($data = $ffmpeg->get_moviefile_details($this->path . "/" . $file))) { $ret = $data; break; } } // lagre? if ($save) { file_put_contents($path, serialize($ret)); } return $ret; }