mirror of
https://github.com/Yetangitu/owncloud-apps.git
synced 2025-10-02 14:49:17 +02:00
- add rudimentary epub parser for metadata extraction
- add cover images - add configurable preview settings (should probably be in core or in a separate app) - add some metadata to feed template (file size, type and filename)
This commit is contained in:
parent
64cfb7925e
commit
007b7c7791
13 changed files with 704 additions and 12 deletions
48
files_opds/templates/admin.php
Normal file
48
files_opds/templates/admin.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - Files_Opds App
|
||||
*
|
||||
* @author Frank de Lange
|
||||
* @copyright 2014 Frank de Lange
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
*/
|
||||
|
||||
function checkBox($format) {
|
||||
foreach($format as $name => $enabled) {
|
||||
echo '<input type="checkbox" id="opds-preview-' . $name . '" name="opds-preview-' . $name . '" ' . ($enabled == 1 ? 'checked >' : '>');
|
||||
echo '<label for="opds-preview-' . $name . '">' . $name . '</label>';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="section" id="opds">
|
||||
<h2><?php p($l->t('OPDS')); ?></h2>
|
||||
<h3>Enable preview for:<span class="msg"></span></h3>
|
||||
<div class="indent">
|
||||
<?php foreach ($_['previewFormats'] as $format): ?>
|
||||
<div>
|
||||
<?php checkBox($format); ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<br>
|
||||
<div>
|
||||
<p>Cover size</p>
|
||||
<label for="opds-cover-x"><?php p($l->t('width')) ?></label>
|
||||
<input type="text" id="opds-cover-x" title="<?php p($l->t("Enter cover image width in pixels")); ?>" value="<?php p($_['cover-x']) ?>" />
|
||||
<label for="opds-cover-y"><?php p($l->t('height')) ?></label>
|
||||
<input type="text" id="opds-cover-y" title="<?php p($l->t("Enter cover image height in pixels")); ?>" value="<?php p($_['cover-y']) ?>" />
|
||||
</div>
|
||||
<div>
|
||||
<p>Cover thumbnail size</p>
|
||||
<label for="opds-thumb-x"><?php p($l->t('width')) ?></label>
|
||||
<input type="text" id="opds-thumb-x" title="<?php p($l->t("Enter thumbnail width in pixels")); ?>" value="<?php p($_['thumb-x']) ?>" />
|
||||
<label for="opds-thumb-y"><?php p($l->t('height')) ?></label>
|
||||
<input type="text" id="opds-thumb-y" title="<?php p($l->t("Enter thumbnail height in pixels")); ?>" value="<?php p($_['thumb-y']) ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -10,11 +10,19 @@
|
|||
* later.
|
||||
*/
|
||||
|
||||
|
||||
function formatMetadata($humansize,$mimetype,$name) {
|
||||
return "Size: " . $humansize . "\n"
|
||||
. "Type: " . $mimetype . "\n"
|
||||
. "Filename: " . $name;
|
||||
}
|
||||
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>';
|
||||
?>
|
||||
|
||||
<feed xmlns="http://www.w3.org/2005/Atom"
|
||||
xmlns:dc="http://purl.org/dc/terms/"
|
||||
xmlns:dcterms="http://purl.org/dc/terms/"
|
||||
xmlns:opds="http://opds-spec.org/2010/catalog">
|
||||
<id>id:<?php p($_['feed_id']); ?></id>
|
||||
<title><?php p($l->t("%s's library", array($_['user']))); ?></title>
|
||||
|
@ -54,19 +62,20 @@ echo '<?xml version="1.0" encoding="UTF-8"?>';
|
|||
<title><?php p($file['name']); ?></title>
|
||||
<updated><?php p(date("Y-m-d\TH:i:sP", $file['mtime'])); ?></updated>
|
||||
<id>id:<?php p($file['id']); ?></id>
|
||||
<dcterms:extent><?php p($file['humansize']); ?></dcterms:extent>
|
||||
<link type="<?php p($file['mimetype']); ?>"
|
||||
rel="alternate"
|
||||
href="?id=<?php p($file['id']); ?>"/>
|
||||
<link type="<?php p($file['mimetype']); ?>"
|
||||
rel="http://opds-spec.org/acquisition/open-access"
|
||||
href="?id=<?php p($file['id']); ?>"/>
|
||||
<link href="<?php p($file['icon']); ?>"
|
||||
<link href="<?php p($file['preview']); ?>"
|
||||
rel="http://opds-spec.org/image"
|
||||
type="image/jpeg" />
|
||||
<link href="<?php p($file['icon']); ?>"
|
||||
<link href="<?php p($file['thumbnail']); ?>"
|
||||
rel="http://opds-spec.org/image/thumbnail"
|
||||
type="image/jpeg" />
|
||||
<content type="text"></content>
|
||||
<content type="text"><?php p(formatMetadata($file['humansize'],$file['mimetype'],$file['name'])); ?></content>
|
||||
</entry>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
|
@ -89,19 +98,20 @@ echo '<?xml version="1.0" encoding="UTF-8"?>';
|
|||
<title><?php p($file['name']); ?></title>
|
||||
<updated><?php p(date("Y-m-d\TH:i:sP", $file['mtime'])); ?></updated>
|
||||
<id>id:<?php p($file['id']); ?></id>
|
||||
<dcterms:extent><?php p($file['humansize']); ?></dcterms:extent>
|
||||
<link type="<?php p($file['mimetype']); ?>"
|
||||
rel="alternate"
|
||||
href="?id=<?php p($file['id']); ?>"/>
|
||||
<link type="<?php p($file['mimetype']); ?>"
|
||||
rel="http://opds-spec.org/acquisition/open-access"
|
||||
href="?id=<?php p($file['id']); ?>"/>
|
||||
<link href="<?php p($file['icon']); ?>"
|
||||
<link href="<?php p($file['preview']); ?>"
|
||||
rel="http://opds-spec.org/image"
|
||||
type="image/jpeg" />
|
||||
<link href="<?php p($file['icon']); ?>"
|
||||
<link href="<?php p($file['thumbnail']); ?>"
|
||||
rel="http://opds-spec.org/image/thumbnail"
|
||||
type="image/jpeg" />
|
||||
<content type="text"></content>
|
||||
<content type="text"><?php p(formatMetadata($file['humansize'],$file['mimetype'],$file['name'])); ?></content>
|
||||
</entry>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
?>
|
||||
|
||||
<div class="section" id="opds-personal">
|
||||
<div class="section" id="opds">
|
||||
<h2><?php p($l->t('OPDS')); ?></h2>
|
||||
<div>
|
||||
<input id="opds-enable" name="opds-enable" value="<?php p($_['opdsEnable-value']) ?>" <?php p($_['opdsEnable-checked']) ?> type="checkbox">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue