mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
feat(server): dynamic job concurrency (#2622)
* feat(server): dynamic job concurrency * styling and add setting info to top of the job list * regenerate api * remove DETECT_OBJECT job --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
parent
656dc08406
commit
2493dfaba3
48 changed files with 1454 additions and 490 deletions
|
|
@ -13,80 +13,80 @@ part of openapi.api;
|
|||
class AllJobStatusResponseDto {
|
||||
/// Returns a new [AllJobStatusResponseDto] instance.
|
||||
AllJobStatusResponseDto({
|
||||
required this.thumbnailGenerationQueue,
|
||||
required this.metadataExtractionQueue,
|
||||
required this.videoConversionQueue,
|
||||
required this.objectTaggingQueue,
|
||||
required this.clipEncodingQueue,
|
||||
required this.storageTemplateMigrationQueue,
|
||||
required this.backgroundTaskQueue,
|
||||
required this.searchQueue,
|
||||
required this.recognizeFacesQueue,
|
||||
required this.sidecarQueue,
|
||||
required this.thumbnailGeneration,
|
||||
required this.metadataExtraction,
|
||||
required this.videoConversion,
|
||||
required this.objectTagging,
|
||||
required this.clipEncoding,
|
||||
required this.storageTemplateMigration,
|
||||
required this.backgroundTask,
|
||||
required this.search,
|
||||
required this.recognizeFaces,
|
||||
required this.sidecar,
|
||||
});
|
||||
|
||||
JobStatusDto thumbnailGenerationQueue;
|
||||
JobStatusDto thumbnailGeneration;
|
||||
|
||||
JobStatusDto metadataExtractionQueue;
|
||||
JobStatusDto metadataExtraction;
|
||||
|
||||
JobStatusDto videoConversionQueue;
|
||||
JobStatusDto videoConversion;
|
||||
|
||||
JobStatusDto objectTaggingQueue;
|
||||
JobStatusDto objectTagging;
|
||||
|
||||
JobStatusDto clipEncodingQueue;
|
||||
JobStatusDto clipEncoding;
|
||||
|
||||
JobStatusDto storageTemplateMigrationQueue;
|
||||
JobStatusDto storageTemplateMigration;
|
||||
|
||||
JobStatusDto backgroundTaskQueue;
|
||||
JobStatusDto backgroundTask;
|
||||
|
||||
JobStatusDto searchQueue;
|
||||
JobStatusDto search;
|
||||
|
||||
JobStatusDto recognizeFacesQueue;
|
||||
JobStatusDto recognizeFaces;
|
||||
|
||||
JobStatusDto sidecarQueue;
|
||||
JobStatusDto sidecar;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is AllJobStatusResponseDto &&
|
||||
other.thumbnailGenerationQueue == thumbnailGenerationQueue &&
|
||||
other.metadataExtractionQueue == metadataExtractionQueue &&
|
||||
other.videoConversionQueue == videoConversionQueue &&
|
||||
other.objectTaggingQueue == objectTaggingQueue &&
|
||||
other.clipEncodingQueue == clipEncodingQueue &&
|
||||
other.storageTemplateMigrationQueue == storageTemplateMigrationQueue &&
|
||||
other.backgroundTaskQueue == backgroundTaskQueue &&
|
||||
other.searchQueue == searchQueue &&
|
||||
other.recognizeFacesQueue == recognizeFacesQueue &&
|
||||
other.sidecarQueue == sidecarQueue;
|
||||
other.thumbnailGeneration == thumbnailGeneration &&
|
||||
other.metadataExtraction == metadataExtraction &&
|
||||
other.videoConversion == videoConversion &&
|
||||
other.objectTagging == objectTagging &&
|
||||
other.clipEncoding == clipEncoding &&
|
||||
other.storageTemplateMigration == storageTemplateMigration &&
|
||||
other.backgroundTask == backgroundTask &&
|
||||
other.search == search &&
|
||||
other.recognizeFaces == recognizeFaces &&
|
||||
other.sidecar == sidecar;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(thumbnailGenerationQueue.hashCode) +
|
||||
(metadataExtractionQueue.hashCode) +
|
||||
(videoConversionQueue.hashCode) +
|
||||
(objectTaggingQueue.hashCode) +
|
||||
(clipEncodingQueue.hashCode) +
|
||||
(storageTemplateMigrationQueue.hashCode) +
|
||||
(backgroundTaskQueue.hashCode) +
|
||||
(searchQueue.hashCode) +
|
||||
(recognizeFacesQueue.hashCode) +
|
||||
(sidecarQueue.hashCode);
|
||||
(thumbnailGeneration.hashCode) +
|
||||
(metadataExtraction.hashCode) +
|
||||
(videoConversion.hashCode) +
|
||||
(objectTagging.hashCode) +
|
||||
(clipEncoding.hashCode) +
|
||||
(storageTemplateMigration.hashCode) +
|
||||
(backgroundTask.hashCode) +
|
||||
(search.hashCode) +
|
||||
(recognizeFaces.hashCode) +
|
||||
(sidecar.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'AllJobStatusResponseDto[thumbnailGenerationQueue=$thumbnailGenerationQueue, metadataExtractionQueue=$metadataExtractionQueue, videoConversionQueue=$videoConversionQueue, objectTaggingQueue=$objectTaggingQueue, clipEncodingQueue=$clipEncodingQueue, storageTemplateMigrationQueue=$storageTemplateMigrationQueue, backgroundTaskQueue=$backgroundTaskQueue, searchQueue=$searchQueue, recognizeFacesQueue=$recognizeFacesQueue, sidecarQueue=$sidecarQueue]';
|
||||
String toString() => 'AllJobStatusResponseDto[thumbnailGeneration=$thumbnailGeneration, metadataExtraction=$metadataExtraction, videoConversion=$videoConversion, objectTagging=$objectTagging, clipEncoding=$clipEncoding, storageTemplateMigration=$storageTemplateMigration, backgroundTask=$backgroundTask, search=$search, recognizeFaces=$recognizeFaces, sidecar=$sidecar]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'thumbnail-generation-queue'] = this.thumbnailGenerationQueue;
|
||||
json[r'metadata-extraction-queue'] = this.metadataExtractionQueue;
|
||||
json[r'video-conversion-queue'] = this.videoConversionQueue;
|
||||
json[r'object-tagging-queue'] = this.objectTaggingQueue;
|
||||
json[r'clip-encoding-queue'] = this.clipEncodingQueue;
|
||||
json[r'storage-template-migration-queue'] = this.storageTemplateMigrationQueue;
|
||||
json[r'background-task-queue'] = this.backgroundTaskQueue;
|
||||
json[r'search-queue'] = this.searchQueue;
|
||||
json[r'recognize-faces-queue'] = this.recognizeFacesQueue;
|
||||
json[r'sidecar-queue'] = this.sidecarQueue;
|
||||
json[r'thumbnailGeneration'] = this.thumbnailGeneration;
|
||||
json[r'metadataExtraction'] = this.metadataExtraction;
|
||||
json[r'videoConversion'] = this.videoConversion;
|
||||
json[r'objectTagging'] = this.objectTagging;
|
||||
json[r'clipEncoding'] = this.clipEncoding;
|
||||
json[r'storageTemplateMigration'] = this.storageTemplateMigration;
|
||||
json[r'backgroundTask'] = this.backgroundTask;
|
||||
json[r'search'] = this.search;
|
||||
json[r'recognizeFaces'] = this.recognizeFaces;
|
||||
json[r'sidecar'] = this.sidecar;
|
||||
return json;
|
||||
}
|
||||
|
||||
|
|
@ -109,16 +109,16 @@ class AllJobStatusResponseDto {
|
|||
}());
|
||||
|
||||
return AllJobStatusResponseDto(
|
||||
thumbnailGenerationQueue: JobStatusDto.fromJson(json[r'thumbnail-generation-queue'])!,
|
||||
metadataExtractionQueue: JobStatusDto.fromJson(json[r'metadata-extraction-queue'])!,
|
||||
videoConversionQueue: JobStatusDto.fromJson(json[r'video-conversion-queue'])!,
|
||||
objectTaggingQueue: JobStatusDto.fromJson(json[r'object-tagging-queue'])!,
|
||||
clipEncodingQueue: JobStatusDto.fromJson(json[r'clip-encoding-queue'])!,
|
||||
storageTemplateMigrationQueue: JobStatusDto.fromJson(json[r'storage-template-migration-queue'])!,
|
||||
backgroundTaskQueue: JobStatusDto.fromJson(json[r'background-task-queue'])!,
|
||||
searchQueue: JobStatusDto.fromJson(json[r'search-queue'])!,
|
||||
recognizeFacesQueue: JobStatusDto.fromJson(json[r'recognize-faces-queue'])!,
|
||||
sidecarQueue: JobStatusDto.fromJson(json[r'sidecar-queue'])!,
|
||||
thumbnailGeneration: JobStatusDto.fromJson(json[r'thumbnailGeneration'])!,
|
||||
metadataExtraction: JobStatusDto.fromJson(json[r'metadataExtraction'])!,
|
||||
videoConversion: JobStatusDto.fromJson(json[r'videoConversion'])!,
|
||||
objectTagging: JobStatusDto.fromJson(json[r'objectTagging'])!,
|
||||
clipEncoding: JobStatusDto.fromJson(json[r'clipEncoding'])!,
|
||||
storageTemplateMigration: JobStatusDto.fromJson(json[r'storageTemplateMigration'])!,
|
||||
backgroundTask: JobStatusDto.fromJson(json[r'backgroundTask'])!,
|
||||
search: JobStatusDto.fromJson(json[r'search'])!,
|
||||
recognizeFaces: JobStatusDto.fromJson(json[r'recognizeFaces'])!,
|
||||
sidecar: JobStatusDto.fromJson(json[r'sidecar'])!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
|
|
@ -166,16 +166,16 @@ class AllJobStatusResponseDto {
|
|||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'thumbnail-generation-queue',
|
||||
'metadata-extraction-queue',
|
||||
'video-conversion-queue',
|
||||
'object-tagging-queue',
|
||||
'clip-encoding-queue',
|
||||
'storage-template-migration-queue',
|
||||
'background-task-queue',
|
||||
'search-queue',
|
||||
'recognize-faces-queue',
|
||||
'sidecar-queue',
|
||||
'thumbnailGeneration',
|
||||
'metadataExtraction',
|
||||
'videoConversion',
|
||||
'objectTagging',
|
||||
'clipEncoding',
|
||||
'storageTemplateMigration',
|
||||
'backgroundTask',
|
||||
'search',
|
||||
'recognizeFaces',
|
||||
'sidecar',
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
60
mobile/openapi/lib/model/job_name.dart
generated
60
mobile/openapi/lib/model/job_name.dart
generated
|
|
@ -23,29 +23,29 @@ class JobName {
|
|||
|
||||
String toJson() => value;
|
||||
|
||||
static const thumbnailGenerationQueue = JobName._(r'thumbnail-generation-queue');
|
||||
static const metadataExtractionQueue = JobName._(r'metadata-extraction-queue');
|
||||
static const videoConversionQueue = JobName._(r'video-conversion-queue');
|
||||
static const objectTaggingQueue = JobName._(r'object-tagging-queue');
|
||||
static const recognizeFacesQueue = JobName._(r'recognize-faces-queue');
|
||||
static const clipEncodingQueue = JobName._(r'clip-encoding-queue');
|
||||
static const backgroundTaskQueue = JobName._(r'background-task-queue');
|
||||
static const storageTemplateMigrationQueue = JobName._(r'storage-template-migration-queue');
|
||||
static const searchQueue = JobName._(r'search-queue');
|
||||
static const sidecarQueue = JobName._(r'sidecar-queue');
|
||||
static const thumbnailGeneration = JobName._(r'thumbnailGeneration');
|
||||
static const metadataExtraction = JobName._(r'metadataExtraction');
|
||||
static const videoConversion = JobName._(r'videoConversion');
|
||||
static const objectTagging = JobName._(r'objectTagging');
|
||||
static const recognizeFaces = JobName._(r'recognizeFaces');
|
||||
static const clipEncoding = JobName._(r'clipEncoding');
|
||||
static const backgroundTask = JobName._(r'backgroundTask');
|
||||
static const storageTemplateMigration = JobName._(r'storageTemplateMigration');
|
||||
static const search = JobName._(r'search');
|
||||
static const sidecar = JobName._(r'sidecar');
|
||||
|
||||
/// List of all possible values in this [enum][JobName].
|
||||
static const values = <JobName>[
|
||||
thumbnailGenerationQueue,
|
||||
metadataExtractionQueue,
|
||||
videoConversionQueue,
|
||||
objectTaggingQueue,
|
||||
recognizeFacesQueue,
|
||||
clipEncodingQueue,
|
||||
backgroundTaskQueue,
|
||||
storageTemplateMigrationQueue,
|
||||
searchQueue,
|
||||
sidecarQueue,
|
||||
thumbnailGeneration,
|
||||
metadataExtraction,
|
||||
videoConversion,
|
||||
objectTagging,
|
||||
recognizeFaces,
|
||||
clipEncoding,
|
||||
backgroundTask,
|
||||
storageTemplateMigration,
|
||||
search,
|
||||
sidecar,
|
||||
];
|
||||
|
||||
static JobName? fromJson(dynamic value) => JobNameTypeTransformer().decode(value);
|
||||
|
|
@ -84,16 +84,16 @@ class JobNameTypeTransformer {
|
|||
JobName? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case r'thumbnail-generation-queue': return JobName.thumbnailGenerationQueue;
|
||||
case r'metadata-extraction-queue': return JobName.metadataExtractionQueue;
|
||||
case r'video-conversion-queue': return JobName.videoConversionQueue;
|
||||
case r'object-tagging-queue': return JobName.objectTaggingQueue;
|
||||
case r'recognize-faces-queue': return JobName.recognizeFacesQueue;
|
||||
case r'clip-encoding-queue': return JobName.clipEncodingQueue;
|
||||
case r'background-task-queue': return JobName.backgroundTaskQueue;
|
||||
case r'storage-template-migration-queue': return JobName.storageTemplateMigrationQueue;
|
||||
case r'search-queue': return JobName.searchQueue;
|
||||
case r'sidecar-queue': return JobName.sidecarQueue;
|
||||
case r'thumbnailGeneration': return JobName.thumbnailGeneration;
|
||||
case r'metadataExtraction': return JobName.metadataExtraction;
|
||||
case r'videoConversion': return JobName.videoConversion;
|
||||
case r'objectTagging': return JobName.objectTagging;
|
||||
case r'recognizeFaces': return JobName.recognizeFaces;
|
||||
case r'clipEncoding': return JobName.clipEncoding;
|
||||
case r'backgroundTask': return JobName.backgroundTask;
|
||||
case r'storageTemplateMigration': return JobName.storageTemplateMigration;
|
||||
case r'search': return JobName.search;
|
||||
case r'sidecar': return JobName.sidecar;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
|
|
|
|||
109
mobile/openapi/lib/model/job_settings_dto.dart
generated
Normal file
109
mobile/openapi/lib/model/job_settings_dto.dart
generated
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
class JobSettingsDto {
|
||||
/// Returns a new [JobSettingsDto] instance.
|
||||
JobSettingsDto({
|
||||
required this.concurrency,
|
||||
});
|
||||
|
||||
int concurrency;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is JobSettingsDto &&
|
||||
other.concurrency == concurrency;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(concurrency.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'JobSettingsDto[concurrency=$concurrency]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'concurrency'] = this.concurrency;
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [JobSettingsDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static JobSettingsDto? fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
// Ensure that the map contains the required keys.
|
||||
// Note 1: the values aren't checked for validity beyond being non-null.
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "JobSettingsDto[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "JobSettingsDto[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return JobSettingsDto(
|
||||
concurrency: mapValueOfType<int>(json, r'concurrency')!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<JobSettingsDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <JobSettingsDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = JobSettingsDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, JobSettingsDto> mapFromJson(dynamic json) {
|
||||
final map = <String, JobSettingsDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = JobSettingsDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of JobSettingsDto-objects as value to a dart map
|
||||
static Map<String, List<JobSettingsDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<JobSettingsDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = JobSettingsDto.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'concurrency',
|
||||
};
|
||||
}
|
||||
|
||||
14
mobile/openapi/lib/model/system_config_dto.dart
generated
14
mobile/openapi/lib/model/system_config_dto.dart
generated
|
|
@ -17,6 +17,7 @@ class SystemConfigDto {
|
|||
required this.oauth,
|
||||
required this.passwordLogin,
|
||||
required this.storageTemplate,
|
||||
required this.job,
|
||||
});
|
||||
|
||||
SystemConfigFFmpegDto ffmpeg;
|
||||
|
|
@ -27,12 +28,15 @@ class SystemConfigDto {
|
|||
|
||||
SystemConfigStorageTemplateDto storageTemplate;
|
||||
|
||||
SystemConfigJobDto job;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is SystemConfigDto &&
|
||||
other.ffmpeg == ffmpeg &&
|
||||
other.oauth == oauth &&
|
||||
other.passwordLogin == passwordLogin &&
|
||||
other.storageTemplate == storageTemplate;
|
||||
other.storageTemplate == storageTemplate &&
|
||||
other.job == job;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
|
|
@ -40,10 +44,11 @@ class SystemConfigDto {
|
|||
(ffmpeg.hashCode) +
|
||||
(oauth.hashCode) +
|
||||
(passwordLogin.hashCode) +
|
||||
(storageTemplate.hashCode);
|
||||
(storageTemplate.hashCode) +
|
||||
(job.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'SystemConfigDto[ffmpeg=$ffmpeg, oauth=$oauth, passwordLogin=$passwordLogin, storageTemplate=$storageTemplate]';
|
||||
String toString() => 'SystemConfigDto[ffmpeg=$ffmpeg, oauth=$oauth, passwordLogin=$passwordLogin, storageTemplate=$storageTemplate, job=$job]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
|
|
@ -51,6 +56,7 @@ class SystemConfigDto {
|
|||
json[r'oauth'] = this.oauth;
|
||||
json[r'passwordLogin'] = this.passwordLogin;
|
||||
json[r'storageTemplate'] = this.storageTemplate;
|
||||
json[r'job'] = this.job;
|
||||
return json;
|
||||
}
|
||||
|
||||
|
|
@ -77,6 +83,7 @@ class SystemConfigDto {
|
|||
oauth: SystemConfigOAuthDto.fromJson(json[r'oauth'])!,
|
||||
passwordLogin: SystemConfigPasswordLoginDto.fromJson(json[r'passwordLogin'])!,
|
||||
storageTemplate: SystemConfigStorageTemplateDto.fromJson(json[r'storageTemplate'])!,
|
||||
job: SystemConfigJobDto.fromJson(json[r'job'])!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
|
|
@ -128,6 +135,7 @@ class SystemConfigDto {
|
|||
'oauth',
|
||||
'passwordLogin',
|
||||
'storageTemplate',
|
||||
'job',
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
181
mobile/openapi/lib/model/system_config_job_dto.dart
generated
Normal file
181
mobile/openapi/lib/model/system_config_job_dto.dart
generated
Normal file
|
|
@ -0,0 +1,181 @@
|
|||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
class SystemConfigJobDto {
|
||||
/// Returns a new [SystemConfigJobDto] instance.
|
||||
SystemConfigJobDto({
|
||||
required this.thumbnailGeneration,
|
||||
required this.metadataExtraction,
|
||||
required this.videoConversion,
|
||||
required this.objectTagging,
|
||||
required this.clipEncoding,
|
||||
required this.storageTemplateMigration,
|
||||
required this.backgroundTask,
|
||||
required this.search,
|
||||
required this.recognizeFaces,
|
||||
required this.sidecar,
|
||||
});
|
||||
|
||||
JobSettingsDto thumbnailGeneration;
|
||||
|
||||
JobSettingsDto metadataExtraction;
|
||||
|
||||
JobSettingsDto videoConversion;
|
||||
|
||||
JobSettingsDto objectTagging;
|
||||
|
||||
JobSettingsDto clipEncoding;
|
||||
|
||||
JobSettingsDto storageTemplateMigration;
|
||||
|
||||
JobSettingsDto backgroundTask;
|
||||
|
||||
JobSettingsDto search;
|
||||
|
||||
JobSettingsDto recognizeFaces;
|
||||
|
||||
JobSettingsDto sidecar;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is SystemConfigJobDto &&
|
||||
other.thumbnailGeneration == thumbnailGeneration &&
|
||||
other.metadataExtraction == metadataExtraction &&
|
||||
other.videoConversion == videoConversion &&
|
||||
other.objectTagging == objectTagging &&
|
||||
other.clipEncoding == clipEncoding &&
|
||||
other.storageTemplateMigration == storageTemplateMigration &&
|
||||
other.backgroundTask == backgroundTask &&
|
||||
other.search == search &&
|
||||
other.recognizeFaces == recognizeFaces &&
|
||||
other.sidecar == sidecar;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(thumbnailGeneration.hashCode) +
|
||||
(metadataExtraction.hashCode) +
|
||||
(videoConversion.hashCode) +
|
||||
(objectTagging.hashCode) +
|
||||
(clipEncoding.hashCode) +
|
||||
(storageTemplateMigration.hashCode) +
|
||||
(backgroundTask.hashCode) +
|
||||
(search.hashCode) +
|
||||
(recognizeFaces.hashCode) +
|
||||
(sidecar.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'SystemConfigJobDto[thumbnailGeneration=$thumbnailGeneration, metadataExtraction=$metadataExtraction, videoConversion=$videoConversion, objectTagging=$objectTagging, clipEncoding=$clipEncoding, storageTemplateMigration=$storageTemplateMigration, backgroundTask=$backgroundTask, search=$search, recognizeFaces=$recognizeFaces, sidecar=$sidecar]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'thumbnailGeneration'] = this.thumbnailGeneration;
|
||||
json[r'metadataExtraction'] = this.metadataExtraction;
|
||||
json[r'videoConversion'] = this.videoConversion;
|
||||
json[r'objectTagging'] = this.objectTagging;
|
||||
json[r'clipEncoding'] = this.clipEncoding;
|
||||
json[r'storageTemplateMigration'] = this.storageTemplateMigration;
|
||||
json[r'backgroundTask'] = this.backgroundTask;
|
||||
json[r'search'] = this.search;
|
||||
json[r'recognizeFaces'] = this.recognizeFaces;
|
||||
json[r'sidecar'] = this.sidecar;
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [SystemConfigJobDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static SystemConfigJobDto? fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
// Ensure that the map contains the required keys.
|
||||
// Note 1: the values aren't checked for validity beyond being non-null.
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "SystemConfigJobDto[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "SystemConfigJobDto[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return SystemConfigJobDto(
|
||||
thumbnailGeneration: JobSettingsDto.fromJson(json[r'thumbnailGeneration'])!,
|
||||
metadataExtraction: JobSettingsDto.fromJson(json[r'metadataExtraction'])!,
|
||||
videoConversion: JobSettingsDto.fromJson(json[r'videoConversion'])!,
|
||||
objectTagging: JobSettingsDto.fromJson(json[r'objectTagging'])!,
|
||||
clipEncoding: JobSettingsDto.fromJson(json[r'clipEncoding'])!,
|
||||
storageTemplateMigration: JobSettingsDto.fromJson(json[r'storageTemplateMigration'])!,
|
||||
backgroundTask: JobSettingsDto.fromJson(json[r'backgroundTask'])!,
|
||||
search: JobSettingsDto.fromJson(json[r'search'])!,
|
||||
recognizeFaces: JobSettingsDto.fromJson(json[r'recognizeFaces'])!,
|
||||
sidecar: JobSettingsDto.fromJson(json[r'sidecar'])!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<SystemConfigJobDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <SystemConfigJobDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = SystemConfigJobDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, SystemConfigJobDto> mapFromJson(dynamic json) {
|
||||
final map = <String, SystemConfigJobDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = SystemConfigJobDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of SystemConfigJobDto-objects as value to a dart map
|
||||
static Map<String, List<SystemConfigJobDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<SystemConfigJobDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = SystemConfigJobDto.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'thumbnailGeneration',
|
||||
'metadataExtraction',
|
||||
'videoConversion',
|
||||
'objectTagging',
|
||||
'clipEncoding',
|
||||
'storageTemplateMigration',
|
||||
'backgroundTask',
|
||||
'search',
|
||||
'recognizeFaces',
|
||||
'sidecar',
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue