admin: add preview types

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/672/head
Varun Patil 2023-05-22 21:57:53 -07:00
parent 98b60f44ca
commit 8b37c33154
6 changed files with 89 additions and 16 deletions

View File

@ -11,7 +11,6 @@ Memories supports the file types supported by the Nextcloud previews app. If you
```
PNG (image/png)
JPEG (image/jpeg)
PNG (image/png)
GIF (image/gif)
BMP (image/bmp)
```
@ -47,9 +46,6 @@ You need to install `ffmpeg` and add the video config to `config.php`
'enabledPreviewProviders' =>
array (
'OC\\Preview\\Movie',
'OC\\Preview\\MKV',
'OC\\Preview\\MP4',
'OC\\Preview\\AVI',
),
```

View File

@ -61,4 +61,8 @@ return [
// -2 => Direct (disable transcoding)
// 1080 => 1080p (and so on)
'memories.video_default_quality' => '0',
// Preview providers for Nextcloud
// Memories only provides an admin interface for these
'enabledPreviewProviders' => [],
];

View File

@ -17,6 +17,7 @@ import * as utils from '../../services/Utils';
import Exif from './sections/Exif.vue';
import Indexing from './sections/Indexing.vue';
import FileSupport from './sections/FileSupport.vue';
import Performance from './sections/Performance.vue';
import Places from './sections/Places.vue';
import Video from './sections/Video.vue';
@ -35,7 +36,7 @@ export default defineComponent({
status: null as ISystemStatus | null,
config: null as ISystemConfig | null,
components: [Exif, Indexing, Performance, Places, Video, VideoTranscoder, VideoAccel],
components: [Exif, Indexing, FileSupport, Performance, Places, Video, VideoTranscoder, VideoAccel],
}),
mounted() {

View File

@ -22,6 +22,8 @@ export type ISystemConfig = {
'memories.vod.nvenc': boolean;
'memories.vod.nvenc.temporal_aq': boolean;
'memories.vod.nvenc.scale': string;
enabledPreviewProviders: string[];
};
export type IBinaryStatus = 'ok' | 'not_found' | 'not_executable' | 'test_ok' | string;

View File

@ -0,0 +1,81 @@
<template>
<div class="admin-section">
<h2>{{ t('memories', 'File Support') }}</h2>
{{ t('memories', 'You can configure the enabled Nextcloud preview providers below.') }}
{{ t('memories', 'If you are using Imaginary for preview generation, you can ignore this section.') }}
{{ t('memories', 'To enable RAW support, install the Camera RAW Previews app.') }}
<a href="https://memories.gallery/file-types/" target="_blank">
{{ t('memories', 'Documentation.') }}
</a>
<br />
<NcCheckboxRadioSwitch
type="switch"
v-for="(provider, klass) in knownPreviewProviders"
:key="klass"
:checked="hasProvider(klass)"
@update:checked="updateProvider(klass, $event)"
>{{ provider.name }}
</NcCheckboxRadioSwitch>
{{ t('memories', 'The following MIME types are configured for preview generation.') }}
<br />
<code v-if="status"
><template v-for="mime in status.mimes">{{ mime }}<br :key="mime" /></template
></code>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { translate as t } from '@nextcloud/l10n';
import AdminMixin from '../AdminMixin';
export default defineComponent({
name: 'FileSupport',
mixins: [AdminMixin],
data: () => ({
knownPreviewProviders: {
'OC\\Preview\\Image': {
name: t('memories', 'Images (JPEG, PNG, GIF, BMP)'),
},
'OC\\Preview\\HEIC': {
name: t('memories', 'HEIC (Imagick)'),
},
'OC\\Preview\\TIFF': {
name: t('memories', 'TIFF (Imagick)'),
},
'OC\\Preview\\Movie': {
name: t('memories', 'Videos (ffmpeg)'),
},
},
}),
methods: {
providers() {
return this.config['enabledPreviewProviders'];
},
hasProvider(klass: string): boolean {
return this.providers().includes(klass);
},
updateProvider(klass: string, enabled: boolean) {
if (enabled === this.hasProvider(klass)) return;
if (enabled) {
this.providers().push(klass);
} else {
this.config['enabledPreviewProviders'] = this.providers().filter((k) => k !== klass);
}
this.update('enabledPreviewProviders');
},
},
});
</script>

View File

@ -110,17 +110,6 @@
{{ t('memories', 'Clear all existing index tables:') }}
<br />
<code>occ memories:index --clear</code>
<br />
<br />
{{ t('memories', 'The following MIME types are configured for preview generation correctly. More documentation:') }}
<a href="https://memories.gallery/file-types/" target="_blank">
{{ t('memories', 'External Link') }}
</a>
<br />
<code v-if="status"
><template v-for="mime in status.mimes">{{ mime }}<br :key="mime" /></template
></code>
</div>
</template>