feat(server): add transcode presets (#2084)

* feat: add transcode presets

* Add migration

* chore: generate api

* refactor: use enum type instead of string for transcode option

* chore: generate api

* refactor: enhance readability of runVideoEncode method

* refactor: reuse SettingSelect for transcoding presets

* refactor: simplify return statement

* chore: regenerate api

* fix: correct label attribute

* Update import

* fix test

---------

Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
Sergey Kondrikov 2023-03-28 22:03:43 +03:00 committed by GitHub
parent b49f66bbc9
commit 2c67090e3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 216 additions and 45 deletions

View file

@ -3,11 +3,10 @@
notificationController,
NotificationType
} from '$lib/components/shared-components/notification/notification';
import { api, SystemConfigFFmpegDto } from '@api';
import { api, SystemConfigFFmpegDto, SystemConfigFFmpegDtoTranscodeEnum } from '@api';
import SettingButtonsRow from '../setting-buttons-row.svelte';
import SettingInputField, { SettingInputFieldType } from '../setting-input-field.svelte';
import SettingSelect from '../setting-select.svelte';
import SettingSwitch from '../setting-switch.svelte';
import { isEqual } from 'lodash-es';
import { fade } from 'svelte/transition';
@ -105,7 +104,12 @@
<SettingSelect
label="VIDEO CODEC (-vcodec)"
bind:value={ffmpegConfig.targetVideoCodec}
options={['h264', 'hevc', 'vp9']}
options={[
{ value: 'h264', text: 'h264' },
{ value: 'hevc', text: 'hevc' },
{ value: 'vp9', text: 'vp9' }
]}
name="vcodec"
isEdited={!(ffmpegConfig.targetVideoCodec == savedConfig.targetVideoCodec)}
/>
@ -117,11 +121,22 @@
isEdited={!(ffmpegConfig.targetScaling == savedConfig.targetScaling)}
/>
<SettingSwitch
title="TRANSCODE ALL"
subtitle="Transcode all files, even if they already match the specified format?"
bind:checked={ffmpegConfig.transcodeAll}
isEdited={!(ffmpegConfig.transcodeAll == savedConfig.transcodeAll)}
<SettingSelect
label="TRANSCODE"
bind:value={ffmpegConfig.transcode}
name="transcode"
options={[
{ value: SystemConfigFFmpegDtoTranscodeEnum.All, text: 'All videos' },
{
value: SystemConfigFFmpegDtoTranscodeEnum.Optimal,
text: 'Videos higher than 1080p or not in the desired format'
},
{
value: SystemConfigFFmpegDtoTranscodeEnum.Required,
text: 'Only videos not in the desired format'
}
]}
isEdited={!(ffmpegConfig.transcode == savedConfig.transcode)}
/>
</div>