admin: check for preview imagick and ffmpeg

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/783/head
Varun Patil 2023-08-16 20:24:38 -07:00
parent 57a4c81bb5
commit 4e3ed6fc49
4 changed files with 39 additions and 3 deletions

View File

@ -115,6 +115,9 @@ class AdminController extends GenericApiController
// Check supported preview mimes
$status['mimes'] = $index->getPreviewMimes($index->getAllMimes());
// Check for PHP Imagick
$status['imagick'] = class_exists('\Imagick') ? \Imagick::getVersion()['versionString'] : false;
// Check for bad encryption module
$status['bad_encryption'] = \OCA\Memories\Util::isEncryptionEnabled();
@ -128,7 +131,14 @@ class AdminController extends GenericApiController
$status['gis_type'] = $e->getMessage();
}
// Check ffmpeg and ffprobe binaries
// Check for FFmpeg for preview generation
$status['ffmpeg_preview'] = $this->getExecutableStatus(
Util::getSystemConfig('preview_ffmpeg_path', null, true)
?: trim(shell_exec('which ffmpeg') ?: ''),
fn ($p) => BinExt::testFFmpeg($p, 'ffmpeg'),
);
// Check ffmpeg and ffprobe binaries for transcoding
$status['ffmpeg'] = $this->getExecutableStatus(
Util::getSystemConfig('memories.vod.ffmpeg'),
fn ($p) => BinExt::testFFmpeg($p, 'ffmpeg'),

View File

@ -83,8 +83,8 @@ export default defineComponent({
}
},
binaryStatusType(status: IBinaryStatus, critical = true): string {
if (status === 'ok' || status.startsWith('test_ok')) {
binaryStatusType(status: IBinaryStatus, critical = true): 'success' | 'warning' | 'error' {
if (this.binaryStatusOk(status)) {
return 'success';
} else if (status === 'not_found' || status === 'not_executable' || status.startsWith('test_fail')) {
return critical ? 'error' : 'warning';
@ -92,6 +92,10 @@ export default defineComponent({
return 'warning';
}
},
binaryStatusOk(status: IBinaryStatus): boolean {
return status === 'ok' || status.startsWith('test_ok');
},
},
computed: {

View File

@ -43,10 +43,12 @@ export type ISystemStatus = {
bad_encryption: boolean;
indexed_count: number;
mimes: string[];
imagick: string | false;
gis_type: number;
gis_count?: number;
exiftool: IBinaryStatus;
perl: IBinaryStatus;
ffmpeg_preview: IBinaryStatus;
ffmpeg: IBinaryStatus;
ffprobe: IBinaryStatus;
govod: IBinaryStatus;

View File

@ -10,6 +10,26 @@
</a>
<br />
<template v-if="status">
<NcNoteCard v-if="status.imagick" type="success">
{{ t('memories', 'PHP-Imagick is available [{version}].', { version: status.imagick }) }}
</NcNoteCard>
<NcNoteCard v-else type="error">
{{ t('memories', 'PHP-Imagick is not available.') }}
{{ t('memories', 'Image editing will not work correctly.') }}
{{ t('memories', 'Thumbnail generation may not work for some formats (HEIC, TIFF).') }}
</NcNoteCard>
<NcNoteCard :type="binaryStatusType(status.ffmpeg_preview)">
{{ binaryStatus('ffmpeg preview', status.ffmpeg_preview) }}
{{
binaryStatusOk(status.ffmpeg_preview)
? t('memories', 'Thumbnails for videos will be generated with this binary.')
: t('memories', 'Thumbnail generation may not work for videos.')
}}
</NcNoteCard>
</template>
<NcCheckboxRadioSwitch
type="switch"
v-for="(provider, klass) in knownPreviewProviders"