1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-16 07:24:40 +02:00

feat(server): refresh face detection (#12335)

* refresh faces

handle non-ml faces

* fix metadata face handling

* updated tests

* added todo comment
This commit is contained in:
Mert
2024-10-03 21:58:28 -04:00
committed by GitHub
parent 9edc9d6151
commit 2c87683fd4
21 changed files with 409 additions and 152 deletions

View File

@ -23,14 +23,16 @@ class AssetJobName {
String toJson() => value;
static const regenerateThumbnail = AssetJobName._(r'regenerate-thumbnail');
static const refreshFaces = AssetJobName._(r'refresh-faces');
static const refreshMetadata = AssetJobName._(r'refresh-metadata');
static const regenerateThumbnail = AssetJobName._(r'regenerate-thumbnail');
static const transcodeVideo = AssetJobName._(r'transcode-video');
/// List of all possible values in this [enum][AssetJobName].
static const values = <AssetJobName>[
regenerateThumbnail,
refreshFaces,
refreshMetadata,
regenerateThumbnail,
transcodeVideo,
];
@ -70,8 +72,9 @@ class AssetJobNameTypeTransformer {
AssetJobName? decode(dynamic data, {bool allowNull = true}) {
if (data != null) {
switch (data) {
case r'regenerate-thumbnail': return AssetJobName.regenerateThumbnail;
case r'refresh-faces': return AssetJobName.refreshFaces;
case r'refresh-metadata': return AssetJobName.refreshMetadata;
case r'regenerate-thumbnail': return AssetJobName.regenerateThumbnail;
case r'transcode-video': return AssetJobName.transcodeVideo;
default:
if (!allowNull) {

View File

@ -14,12 +14,18 @@ class JobCommandDto {
/// Returns a new [JobCommandDto] instance.
JobCommandDto({
required this.command,
required this.force,
this.force,
});
JobCommand command;
bool force;
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
bool? force;
@override
bool operator ==(Object other) => identical(this, other) || other is JobCommandDto &&
@ -30,7 +36,7 @@ class JobCommandDto {
int get hashCode =>
// ignore: unnecessary_parenthesis
(command.hashCode) +
(force.hashCode);
(force == null ? 0 : force!.hashCode);
@override
String toString() => 'JobCommandDto[command=$command, force=$force]';
@ -38,7 +44,11 @@ class JobCommandDto {
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'command'] = this.command;
if (this.force != null) {
json[r'force'] = this.force;
} else {
// json[r'force'] = null;
}
return json;
}
@ -52,7 +62,7 @@ class JobCommandDto {
return JobCommandDto(
command: JobCommand.fromJson(json[r'command'])!,
force: mapValueOfType<bool>(json, r'force')!,
force: mapValueOfType<bool>(json, r'force'),
);
}
return null;
@ -101,7 +111,6 @@ class JobCommandDto {
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'command',
'force',
};
}