Continue processing more OPDS entries if one ebook can't be parsed

This commit is contained in:
Alex Cabal 2020-10-13 14:48:57 -05:00
parent 73ba658a05
commit 1d56a06c79

View file

@ -22,7 +22,9 @@ foreach($contentFiles as $path){
if($path == '') if($path == '')
continue; continue;
try{
$ebookWwwFilesystemPath = preg_replace('|/content\.opf|ius', '', $path) ?? ''; $ebookWwwFilesystemPath = preg_replace('|/content\.opf|ius', '', $path) ?? '';
$ebook = new Ebook($ebookWwwFilesystemPath); $ebook = new Ebook($ebookWwwFilesystemPath);
$allEbooks[$ebook->ModifiedTimestamp->format('Y-m-d\TH:i:s\Z') . ' ' . $ebook->Identifier] = $ebook; $allEbooks[$ebook->ModifiedTimestamp->format('Y-m-d\TH:i:s\Z') . ' ' . $ebook->Identifier] = $ebook;
@ -37,6 +39,11 @@ foreach($contentFiles as $path){
// Sort this ebook by subject // Sort this ebook by subject
$ebooksBySubject[$tag->Name][$ebook->Timestamp->format('Y-m-d\TH:i:s\Z') . ' ' . $ebook->Identifier] = $ebook; $ebooksBySubject[$tag->Name][$ebook->Timestamp->format('Y-m-d\TH:i:s\Z') . ' ' . $ebook->Identifier] = $ebook;
} }
}
catch(\Exception $ex){
print('Failed to generate OPDS entry for `' . $ebookWwwFilesystemPath . '`. Exception: ' . $ex->getMessage());
continue;
}
} }
// Create the subjects navigation document // Create the subjects navigation document