Add subjects OPDS feeds, and switch to a more object-oriented approach to generating the OPDS feeds

This commit is contained in:
Alex Cabal 2020-06-25 12:56:14 -05:00
parent a42de8ef4d
commit 133f93cdce
11 changed files with 187 additions and 51 deletions

View file

@ -20,22 +20,23 @@ catch(\Exception $ex){
header('Content-type: text/xml');
print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:schema="http://schema.org/" xmlns:fh="http://purl.org/syndication/history/1.0">
<id>https://standardebooks.org/opds/all</id>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:schema="http://schema.org/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
<id>https://standardebooks.org/opds/all?query=<?= urlencode($query) ?></id>
<link href="/opds/all?query=<?= urlencode($query) ?>" rel="self" type="application/atom+xml;profile=opds-catalog"/>
<link href="/ebooks/ebooks?query=doyle" rel="alternate" type="text/html"/>
<link href="https://standardebooks.org/opds" rel="start" type="application/atom+xml;profile=opds-catalog;kind=navigation"/>
<link href="https://standardebooks.org/opds/all" rel="crawlable" type="application/atom+xml;profile=opds-catalog;kind=acquisition"/>
<link href="https://standardebooks.org/ebooks/opensearch" rel="search" type="application/opensearchdescription+xml" />
<link href="/opds" rel="start" type="application/atom+xml;profile=opds-catalog;kind=navigation"/>
<link href="/opds/all" rel="http://opds-spec.org/crawlable" type="application/atom+xml;profile=opds-catalog;kind=acquisition"/>
<link href="/ebooks/opensearch" rel="search" type="application/opensearchdescription+xml" />
<title>Standard Ebooks OPDS Search Results</title>
<subtitle>Free and liberated ebooks, carefully produced for the true book lover.</subtitle>
<icon>https://standardebooks.org/images/logo.png</icon>
<icon>/images/logo.png</icon>
<updated><?= $now->Format('Y-m-d\TH:i:s\Z') ?></updated>
<author>
<name>Standard Ebooks</name>
<uri>https://standardebooks.org</uri>
</author>
<opensearch:totalResults><?= sizeof($ebooks) ?></opensearch:totalResults>
<? foreach($ebooks as $ebook){ ?>
<?= Template::OpdsEntry(['ebook' => $ebook]) ?>
<?= Template::OpdsAcquisitionEntry(['ebook' => $ebook]) ?>
<? } ?>
</feed>