mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-23 19:37:23 +08:00
fix cover issue on page torrents.php
This commit is contained in:
@@ -2,8 +2,10 @@
|
||||
|
||||
namespace Nexus\Imdb;
|
||||
|
||||
use App\Models\Setting;
|
||||
use Imdb\Config;
|
||||
use Imdb\Title;
|
||||
use Nexus\Database\NexusDB;
|
||||
use Nexus\PTGen\PTGen;
|
||||
|
||||
class Imdb
|
||||
@@ -300,4 +302,27 @@ class Imdb
|
||||
}
|
||||
return $this->ptGen;
|
||||
}
|
||||
|
||||
public function getMovieCover($imdbId): string
|
||||
{
|
||||
static $enabled;
|
||||
if (is_null($enabled)) {
|
||||
$enabled = Setting::getIsImdbEnabled();
|
||||
}
|
||||
if (!$enabled) {
|
||||
return '';
|
||||
}
|
||||
return NexusDB::remember("imdb:cover:$imdbId", 3600, function() use($imdbId) {
|
||||
if ($this->getCacheStatus($imdbId) != 1) {
|
||||
return '';
|
||||
}
|
||||
try {
|
||||
return $this->getMovie($imdbId)->photo(false);
|
||||
} catch (\Exception $exception) {
|
||||
do_log($exception->getMessage() . $exception->getTraceAsString(), 'error');
|
||||
return '';
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user