Use Ebook::GetByIdentifier() to read ebooks

This commit is contained in:
Mike Colagrosso 2024-05-29 16:51:10 -06:00 committed by Alex Cabal
parent b176a68d4d
commit 1fd3688621
2 changed files with 4 additions and 8 deletions

View file

@ -27,6 +27,8 @@ const MANUAL_PATH = WEB_ROOT . '/manual';
const EBOOKS_DIST_PATH = WEB_ROOT . '/ebooks/';
const COVER_ART_UPLOAD_PATH = '/images/cover-uploads/';
const EBOOKS_IDENTIFIER_PREFIX = 'url:https://standardebooks.org/ebooks/';
const DATABASE_DEFAULT_DATABASE = 'se';
const DATABASE_DEFAULT_HOST = 'localhost';

View file

@ -39,14 +39,8 @@ try{
}
}
// Do we have the ebook cached?
try{
/** @var Ebook $ebook */
$ebook = apcu_fetch('ebook-' . $wwwFilesystemPath);
}
catch(Safe\Exceptions\ApcuException){
$ebook = Ebook::FromFilesystem($wwwFilesystemPath);
}
$identifier = EBOOKS_IDENTIFIER_PREFIX . $urlPath;
$ebook = Ebook::GetByIdentifier($identifier);
// Divide our sources into transcriptions and scans
foreach($ebook->Sources as $source){