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
|
@ -18,7 +18,7 @@ namespace OCA\Files_Opds;
|
|||
class Files extends \OCA\Files\Helper
|
||||
{
|
||||
/**
|
||||
* Formats the file info to be returned as OPDS to the client.
|
||||
* Formats the file info to be returned as OPDS to the client
|
||||
*
|
||||
* @param \OCP\Files\FileInfo $i
|
||||
* @return array formatted file info
|
||||
|
@ -28,11 +28,16 @@ class Files extends \OCA\Files\Helper
|
|||
|
||||
$entry['id'] = $i['fileid'];
|
||||
$entry['mtime'] = $i['mtime'] * 1000;
|
||||
$entry['icon'] = self::determineIcon($i);
|
||||
$entry['name'] = $i->getName();
|
||||
$entry['mimetype'] = $i['mimetype'];
|
||||
$entry['size'] = $i['size'];
|
||||
$entry['type'] = $i['type'];
|
||||
if ($i['type'] === 'file') {
|
||||
$entry['mimetype'] = $i['mimetype'];
|
||||
$entry['preview'] = self::getPreview($i);
|
||||
$entry['thumbnail'] = self::getThumbnail($i);
|
||||
$entry['humansize'] = \OC_Helper::humanFileSize($i['size']);
|
||||
} else {
|
||||
$entry['icon'] = self::determineIcon($i);
|
||||
}
|
||||
return $entry;
|
||||
}
|
||||
|
||||
|
@ -54,6 +59,33 @@ class Files extends \OCA\Files\Helper
|
|||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get preview for file
|
||||
* @param \OCP\Files\FileInfo $i
|
||||
* @return string preview URL
|
||||
*/
|
||||
public static function getPreview($i) {
|
||||
if (\OC::$server->getPreviewManager()->isMimeSupported($i['mimetype'])) {
|
||||
return \OC_Helper::linkToRoute( 'core_ajax_preview', array('x' => Config::getApp('cover-x', '200'), 'y' => Config::getApp('cover-y', '200'), 'file' => \OC\Files\Filesystem::normalizePath(\OC\Files\Filesystem::getPath($i['fileid']))));
|
||||
} else {
|
||||
return self::determineIcon($i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief get thumbnail for file
|
||||
* @param \OCP\Files\FileInfo $i
|
||||
* @return string preview URL
|
||||
*/
|
||||
public static function getThumbnail($i) {
|
||||
if (\OC::$server->getPreviewManager()->isMimeSupported($i['mimetype'])) {
|
||||
return \OC_Helper::linkToRoute( 'core_ajax_preview', array('x' => Config::getApp('thumb-x', '36'), 'y' => Config::getApp('thumb-y', '36'), 'file' => \OC\Files\Filesystem::normalizePath(\OC\Files\Filesystem::getPath($i['fileid']))));
|
||||
} else {
|
||||
return self::determineIcon($i);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief check if $child is a subdirectory of $parent
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue