mirror of
https://github.com/Yetangitu/owncloud-apps.git
synced 2025-10-02 14:49:17 +02:00
Option added to use old Mimetypes(ie: application/x-cbr) instead of new (application/comicbook+rar)
This commit is contained in:
parent
d804bbf37d
commit
bfc3ea5743
5 changed files with 28 additions and 6 deletions
|
@ -22,6 +22,7 @@ $rootPath = isset($_POST['rootPath']) ? $_POST['rootPath'] : '/Library';
|
|||
$fileTypes = isset($_POST['fileTypes']) ? $_POST['fileTypes'] : '';
|
||||
$skipList = isset($_POST['skipList']) ? $_POST['skipList'] : 'metadata.opf,cover.jpg';
|
||||
$feedTitle = isset($_POST['feedTitle']) ? $_POST['feedTitle'] : $l->t("%s's Library", \OC_User::getDisplayName());
|
||||
$opdsoldMime = isset($_POST['opdsoldMime']) ? $_POST['opdsoldMime'] : '';
|
||||
|
||||
if (!strlen($rootPath) ||
|
||||
\OC\Files\Filesystem::isValidPath($rootPath) === false ||
|
||||
|
@ -37,6 +38,7 @@ if (!strlen($rootPath) ||
|
|||
Config::set('file_types', $fileTypes);
|
||||
Config::set('skip_list', $skipList);
|
||||
Config::set('feed_title', $feedTitle);
|
||||
Config::set('old_mime', $opdsoldMime);
|
||||
Config::set('id', Util::genUuid());
|
||||
|
||||
\OC_JSON::success(
|
||||
|
|
|
@ -39,8 +39,10 @@ $(document).ready(function(){
|
|||
var opdsSettings = {
|
||||
save : function() {
|
||||
var opdsEnable = document.getElementById('opds-enable').checked ? 'true' : 'false';
|
||||
var opdsoldMime = document.getElementById('opds-oldmime').checked ? 'true' : 'false';
|
||||
var data = {
|
||||
opdsEnable : opdsEnable,
|
||||
opdsoldMime : opdsoldMime,
|
||||
rootPath : $('#opds-root-path').val(),
|
||||
fileTypes : $('#opds-file-types').val(),
|
||||
skipList : $('#opds-skip-list').val(),
|
||||
|
@ -61,5 +63,6 @@ $(document).ready(function(){
|
|||
}
|
||||
});
|
||||
$('#opds-enable').on("change", opdsSettings.save);
|
||||
$('#opds-oldmime').on("change", opdsSettings.save);
|
||||
});
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ $l = \OC::$server->getL10N('files_opds');
|
|||
|
||||
$tmpl = new \OCP\Template('files_opds', 'personal');
|
||||
$opdsEnable = Config::get('enable', false);
|
||||
$opdsoldMime = Config::get('old_mime', false);
|
||||
$tmpl->assign('opdsEnable-checked', ($opdsEnable === 'true') ? 'checked="checked"' : '');
|
||||
$tmpl->assign('opdsEnable-value', ($opdsEnable === 'true') ? '1' : '0');
|
||||
$tmpl->assign('rootPath', Config::get('root_path', '/Library'));
|
||||
|
@ -26,6 +27,8 @@ $tmpl->assign('skipList', Config::get('skip_list', 'metadata.opf,cover.jpg'));
|
|||
$tmpl->assign('feedTitle', Config::get('feed_title', $l->t("%s's Library", \OC_User::getDisplayName())));
|
||||
$tmpl->assign('bookshelf-count', Bookshelf::count());
|
||||
$tmpl->assign('feedUrl', Util::linkToAbsolute('','index.php') . '/apps/files_opds/');
|
||||
$tmpl->assign('opdsoldMime-checked', ($opdsoldMime === 'true') ? 'checked="checked"' : '');
|
||||
$tmpl->assign('opdsoldMime-value', ($opdsoldMime === 'true') ? '1' : '0');
|
||||
|
||||
return $tmpl->fetchPage();
|
||||
|
||||
|
|
|
@ -1,4 +1,13 @@
|
|||
<entry>
|
||||
<?php
|
||||
namespace OCA\Files_Opds;
|
||||
|
||||
if ( Config::get('old_mime', 'false') !== 'false' && strpos($_['file_mimetype'],'comicbook') !== false){
|
||||
$mime = 'application/x-cbr';
|
||||
} else {
|
||||
$mime = $_['file_mimetype'];
|
||||
}
|
||||
?>
|
||||
<entry>
|
||||
<title><?php p($_['file_meta']['title']); ?></title>
|
||||
<updated><?php p(date("Y-m-d\TH:i:sP",strtotime($_['file_meta']['updated']))); ?></updated>
|
||||
<id>id:<?php p($_['file_id']); ?></id>
|
||||
|
@ -18,10 +27,10 @@
|
|||
<dc:language><?php p($_['file_meta']['language']); ?></dc:language>
|
||||
<?php endif; ?>
|
||||
<dc:issued><?php p(date("Y-m-d\TH:i:sP",strtotime($_['file_meta']['date']))); ?></dc:issued>
|
||||
<link type="<?php p($_['file_mimetype']); ?>"
|
||||
<link type="<?php p($mime); ?>"
|
||||
rel="alternate"
|
||||
href="?id=<?php p($_['file_id']); ?>"/>
|
||||
<link type="<?php p($_['file_mimetype']); ?>"
|
||||
<link type="<?php p($mime); ?>"
|
||||
rel="http://opds-spec.org/acquisition/open-access"
|
||||
href="?id=<?php p($_['file_id']); ?>"/>
|
||||
<link href="?pid=<?php p($_['file_id']); ?>"
|
||||
|
@ -31,8 +40,8 @@
|
|||
rel="http://opds-spec.org/image/thumbnail"
|
||||
type="image/jpeg" />
|
||||
<?php if ($_['file_meta']['description']): ?>
|
||||
<content type="text"><?php p($_['file_meta']['description']); p("\n\n"); ?><?php p(formatMetadata($_['file_humansize'],$_['file_mimetype'],$_['file_name'])); ?></content>
|
||||
<content type="text"><?php p($_['file_meta']['description']); p("\n\n"); ?><?php p(formatMetadata($_['file_humansize'],$mime,$_['file_name'])); ?></content>
|
||||
<?php else: ?>
|
||||
<summary type="text"><?php p(formatMetadata($_['file_humansize'],$_['file_mimetype'],$_['file_name'])); ?></summary>
|
||||
<summary type="text"><?php p(formatMetadata($_['file_humansize'],$mime,$_['file_name'])); ?></summary>
|
||||
<?php endif; ?>
|
||||
</entry>
|
||||
|
|
|
@ -23,7 +23,8 @@ style('files_opds', 'settings');
|
|||
</table>
|
||||
<div>
|
||||
<input id="opds-enable" name="opds-enable" value="<?php p($_['opdsEnable-value']) ?>" <?php p($_['opdsEnable-checked']) ?> type="checkbox" class="checkbox">
|
||||
<label for="opds-enable"><?php p($l->t('enable OPDS catalog')) ?></label>
|
||||
<label for="opds-enable"><?php p($l->t('enable OPDS catalog')) ?></label>
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<table>
|
||||
|
@ -43,6 +44,10 @@ style('files_opds', 'settings');
|
|||
<td><label for="opds-skip-list"><?php p($l->t('Skip these filenames:')) ?></label></td>
|
||||
<td><input type="text" id="opds-skip-list" title="<?php p($l->t("Enter list of comma-separated file names which should be skipped. Leave blank to use the default skip list.")); ?>" value="<?php p($_['skipList']) ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="opds-oldmime"><?php p($l->t('Use alternative Mimetypes for Comicbook:')) ?></label></td>
|
||||
<td><input id="opds-oldmime" name="opds-oldmime" value="<?php p($_['opdsoldMime-value']) ?>" <?php p($_['opdsoldMime-checked']) ?> type="checkbox" title="For example use application/x-cbr instead of application/comicbook+rar"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue