From 4653b15288aa72c4daed983c5bf0c9a0fcebd5e8 Mon Sep 17 00:00:00 2001 From: Mike Colagrosso Date: Tue, 11 Jun 2024 14:57:12 -0600 Subject: [PATCH] Get ebook from DB for artworks --- lib/Artwork.php | 6 +++--- lib/Library.php | 19 ------------------- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/lib/Artwork.php b/lib/Artwork.php index cc563983..0e2ac217 100644 --- a/lib/Artwork.php +++ b/lib/Artwork.php @@ -259,7 +259,7 @@ class Artwork{ } /** - * @throws Exceptions\AppException + * @throws Exceptions\EbookNotFoundException */ protected function GetEbook(): ?Ebook{ if($this->_Ebook === null){ @@ -267,8 +267,8 @@ class Artwork{ return null; } - $ebookWwwFilesystemPath = preg_replace('|^https://standardebooks.org/ebooks/|ius', EBOOKS_DIST_PATH, $this->EbookUrl); - $this->_Ebook = Library::GetEbook($ebookWwwFilesystemPath); + $identifier = 'url:' . $this->EbookUrl; + $this->_Ebook = Ebook::GetByIdentifier($identifier); } return $this->_Ebook; diff --git a/lib/Library.php b/lib/Library.php index f8ea47d3..cd947486 100644 --- a/lib/Library.php +++ b/lib/Library.php @@ -654,25 +654,6 @@ class Library{ return $retval; } - /** - * @throws Exceptions\AppException - */ - public static function GetEbook(?string $ebookWwwFilesystemPath): ?Ebook{ - if($ebookWwwFilesystemPath === null){ - return null; - } - - /** @var array $result */ - $result = self::GetFromApcu('ebook-' . $ebookWwwFilesystemPath); - - if(sizeof($result) > 0){ - return $result[0]; - } - else{ - return null; - } - } - /** * @throws Exceptions\AppException */