This repository has been archived on 2024-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
epubreader/lib/Service/MetadataService.php

76 lines
1.5 KiB
PHP
Raw Permalink Normal View History

2020-04-21 20:37:42 +00:00
<?php
/**
* @author Frank de Lange
* @copyright 2017 Frank de Lange
*
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace OCA\Epubreader\Service;
2020-04-21 20:37:42 +00:00
use OCP\App\IAppManager;
class MetadataService {
private $appManager;
/**
* @param IAppManager $appManager
*/
public function __construct(IAppManager $appManager) {
$this->appManager = $appManager;
}
/**
* @brief get metadata item(s)
*
* @param int $fileId
* @param string $name
*
* @return array
*/
public function get($fileId, $name=null) {
if ($this->appManager->isInstalled('files_opds')) {
if ($meta = \OCA\Files_Opds\Meta::get($fileId)) {
if (!empty($name) && array_key_exists($name, $meta)) {
return [$item => $meta[$name]];
} else {
return $meta;
}
}
}
return [];
}
/**
* @brief write metadata to database
*
* @param int $fileId
* @param array $value
*
* @return array
*/
public function setAll($fileId, $value) {
// no-op for now
return [];
}
/**
* @brief write metadata item to database
*
* @param int $fileId
* @param string $name
* @param array $value
*
* @return array
*/
public function set($fileId, $name, $value) {
// no-op for now
return [];
}
}