mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
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:
@@ -1,4 +1,5 @@
|
||||
import { IsBoolean, IsString } from 'class-validator';
|
||||
import { IsEnum, IsString } from 'class-validator';
|
||||
import { TranscodePreset } from '@app/infra/db/entities';
|
||||
|
||||
export class SystemConfigFFmpegDto {
|
||||
@IsString()
|
||||
@@ -16,6 +17,6 @@ export class SystemConfigFFmpegDto {
|
||||
@IsString()
|
||||
targetScaling!: string;
|
||||
|
||||
@IsBoolean()
|
||||
transcodeAll!: boolean;
|
||||
@IsEnum(TranscodePreset)
|
||||
transcode!: TranscodePreset;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { SystemConfig, SystemConfigEntity, SystemConfigKey } from '@app/infra/db/entities';
|
||||
import { SystemConfig, SystemConfigEntity, SystemConfigKey, TranscodePreset } from '@app/infra/db/entities';
|
||||
import { BadRequestException, Injectable, Logger } from '@nestjs/common';
|
||||
import * as _ from 'lodash';
|
||||
import { Subject } from 'rxjs';
|
||||
@@ -14,7 +14,7 @@ const defaults: SystemConfig = Object.freeze({
|
||||
targetVideoCodec: 'h264',
|
||||
targetAudioCodec: 'aac',
|
||||
targetScaling: '1280:-2',
|
||||
transcodeAll: false,
|
||||
transcode: TranscodePreset.REQUIRED,
|
||||
},
|
||||
oauth: {
|
||||
enabled: false,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { SystemConfigEntity, SystemConfigKey } from '@app/infra/db/entities';
|
||||
import { SystemConfigEntity, SystemConfigKey, TranscodePreset } from '@app/infra/db/entities';
|
||||
import { BadRequestException } from '@nestjs/common';
|
||||
import { newJobRepositoryMock, newSystemConfigRepositoryMock, systemConfigStub } from '../../test';
|
||||
import { IJobRepository, JobName } from '../job';
|
||||
@@ -18,7 +18,7 @@ const updatedConfig = Object.freeze({
|
||||
targetAudioCodec: 'aac',
|
||||
targetScaling: '1280:-2',
|
||||
targetVideoCodec: 'h264',
|
||||
transcodeAll: false,
|
||||
transcode: TranscodePreset.REQUIRED,
|
||||
},
|
||||
oauth: {
|
||||
autoLaunch: true,
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
SharedLinkEntity,
|
||||
SharedLinkType,
|
||||
SystemConfig,
|
||||
TranscodePreset,
|
||||
UserEntity,
|
||||
UserTokenEntity,
|
||||
} from '@app/infra/db/entities';
|
||||
@@ -401,7 +402,7 @@ export const systemConfigStub = {
|
||||
targetAudioCodec: 'aac',
|
||||
targetScaling: '1280:-2',
|
||||
targetVideoCodec: 'h264',
|
||||
transcodeAll: false,
|
||||
transcode: TranscodePreset.REQUIRED,
|
||||
},
|
||||
oauth: {
|
||||
autoLaunch: false,
|
||||
|
||||
Reference in New Issue
Block a user