1
0
Fork 0
mirror of https://github.com/Yetangitu/owncloud-apps.git synced 2025-10-02 14:49:17 +02:00

files_opds: v0.6.8, implement preview provider using IPreview, only works from OC8.1 and onwards!

This commit is contained in:
frankdelange 2015-08-07 01:42:50 +02:00
parent 5734bedf41
commit 301e6507af
4 changed files with 10 additions and 7 deletions

View file

@ -2,10 +2,8 @@
$l = OC_L10N::get('files_opds');
require 'files_opds/lib/epub-preview.php';
\OCP\App::registerPersonal('files_opds', 'personal');
\OCP\App::registerAdmin('files_opds', 'admin');
/* register preview provider */
\OC::$server->getPreviewManager()->registerProvider('OC\Preview\Epub', array('apps' => array('files_opds')));
\OC::$server->getPreviewManager()->registerProvider('/application\/epub\+zip/', function() { return new OCA\Files_Opds\EpubPreview; });

View file

@ -10,9 +10,9 @@
The feed is in compliance with the OPDS 1.1 specification according to the online OPDS validator (http://opds-validator.appspot.com/).
</description>
<licence>AGPL</licence>
<version>0.6.7</version>
<version>0.6.8</version>
<author>Frank de Lange</author>
<requiremin>7.0</requiremin>
<requiremin>8.1</requiremin>
<shipped>true</shipped>
<default_enable/>
<repository type="git">https://github.com/Yetangitu/owncloud-apps</repository>

View file

@ -10,12 +10,14 @@
* later.
*/
namespace OC\Preview;
namespace OCA\Files_Opds;
use OCP\Preview\IProvider;
/**
* Epub preview - returns cover or null
*/
class Epub extends Provider {
class EpubPreview implements IProvider {
public function getMimeType() {
return '/application\/epub\+zip/';
@ -43,5 +45,8 @@ class Epub extends Provider {
return (($cover !== null) && $image->valid()) ? $image : false;
}
public function isAvailable(\OCP\Files\FileInfo $file) {
return $file->getSize() > 0;
}
}