Get ebook from DB for artworks

This commit is contained in:
Mike Colagrosso 2024-06-11 14:57:12 -06:00 committed by Alex Cabal
parent c85db527cf
commit 4653b15288
2 changed files with 3 additions and 22 deletions

View file

@ -259,7 +259,7 @@ class Artwork{
} }
/** /**
* @throws Exceptions\AppException * @throws Exceptions\EbookNotFoundException
*/ */
protected function GetEbook(): ?Ebook{ protected function GetEbook(): ?Ebook{
if($this->_Ebook === null){ if($this->_Ebook === null){
@ -267,8 +267,8 @@ class Artwork{
return null; return null;
} }
$ebookWwwFilesystemPath = preg_replace('|^https://standardebooks.org/ebooks/|ius', EBOOKS_DIST_PATH, $this->EbookUrl); $identifier = 'url:' . $this->EbookUrl;
$this->_Ebook = Library::GetEbook($ebookWwwFilesystemPath); $this->_Ebook = Ebook::GetByIdentifier($identifier);
} }
return $this->_Ebook; return $this->_Ebook;

View file

@ -654,25 +654,6 @@ class Library{
return $retval; return $retval;
} }
/**
* @throws Exceptions\AppException
*/
public static function GetEbook(?string $ebookWwwFilesystemPath): ?Ebook{
if($ebookWwwFilesystemPath === null){
return null;
}
/** @var array<Ebook> $result */
$result = self::GetFromApcu('ebook-' . $ebookWwwFilesystemPath);
if(sizeof($result) > 0){
return $result[0];
}
else{
return null;
}
}
/** /**
* @throws Exceptions\AppException * @throws Exceptions\AppException
*/ */