fix cover issue on page torrents.php

This commit is contained in:
xiaomlove
2025-09-20 00:45:53 +07:00
parent 41ad91b183
commit ee4739fd8b
5 changed files with 41 additions and 15 deletions
+25
View File
@@ -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 '';
}
});
}
}