From e26c4ccf318d5085aa2498a0e26a551d33848771 Mon Sep 17 00:00:00 2001 From: Mike Phares Date: Sun, 20 Oct 2024 20:12:35 -0700 Subject: [PATCH] Add Person --- Helpers/Exif/HelperExif.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Helpers/Exif/HelperExif.cs b/Helpers/Exif/HelperExif.cs index 671728e..a128666 100644 --- a/Helpers/Exif/HelperExif.cs +++ b/Helpers/Exif/HelperExif.cs @@ -1,3 +1,4 @@ +using File_Folder_Helper.Models; using File_Folder_Helper.Models.Exif; using File_Folder_Helper.Models.Face; using Microsoft.Extensions.Logging; @@ -35,8 +36,13 @@ internal static class HelperExif FileInfo fileInfo = new(argZero); logger.LogInformation("<{argZero}> exists", argZero); ExifDirectory exifDirectory = Exif.GetExifDirectory(fileInfo); + string directory = Path.GetDirectoryName(argZero) ?? throw new Exception(); + string[] files = Directory.GetFiles(directory, "*.json", SearchOption.TopDirectoryOnly); + string? json = files.Length != 1 ? string.Empty : File.ReadAllText(files[0]); ReadOnlyCollection collection = GetCollection(exifDirectory.ExifBaseDirectories); logger.LogInformation("<{collection}> value", collection.Count); + Dictionary? people = string.IsNullOrEmpty(json) ? [] : JsonSerializer.Deserialize(json, PeopleSourceGenerationContext.Default.DictionaryInt64Person) ?? throw new NullReferenceException(); + logger.LogInformation("<{people}> value", people?.Count); foreach (FaceFile faceFile in collection) { if (faceFile.MappingFromPerson is null)