(bool? IsWrongYear, string PersonKey,

TimeSpan? TimeSpan)
This commit is contained in:
2022-08-02 19:41:36 -07:00
parent 62bdc17f7a
commit 2158b4cfc2
7 changed files with 105 additions and 66 deletions

View File

@ -505,22 +505,21 @@ public class D_Face : Shared.Models.Properties.IFace, IFace
SaveFaces(faceCollection, propertyHolder.ResizedFileInfo, imageFiles);
}
internal static List<(PropertyHolder, (string, D_Face?, (string, string, string, string))[])> GetCollection(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, PropertyLogic propertyLogic, Dictionary<string, List<Person>> peopleCollection, string outputResolution, PropertyHolder[] filteredPropertyHolderCollection, List<List<D_Face>> faceCollections)
private static List<(PropertyHolder, (string, D_Face?, (string, string, string, string))[])> GetCollection(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, PropertyLogic propertyLogic, string outputResolution, PropertyHolder[] filteredPropertyHolderCollection, List<List<D_Face>> faceCollections)
{
List<(PropertyHolder, (string, D_Face?, (string, string, string, string))[])> results = new();
string[] keys;
string personKey;
string directory;
string personKey;
bool? isWrongYear;
TimeSpan timeSpan;
string copyFileName;
DateTime? birthDate;
string copyFileName;
string copyDirectory;
string? relativePath;
string isWrongYearFlag;
string shortcutFileName;
string subDirectoryName;
DateTime minimumDateTime;
List<int> indices = new();
List<D_Face> faceCollection;
PropertyHolder propertyHolder;
@ -550,10 +549,9 @@ public class D_Face : Shared.Models.Properties.IFace, IFace
{
faceCollection = faceCollections[i];
keys = propertyLogic.NamedFaceInfoDeterministicHashCodeIndices[propertyHolder.Property.Id.Value];
minimumDateTime = Property.Models.Stateless.A_Property.GetMinimumDateTime(propertyHolder.Property);
(isWrongYear, _) = propertyHolder.Property.IsWrongYear(propertyHolder.ImageFileInfo.FullName, minimumDateTime);
isWrongYearFlag = isWrongYear is null ? "#" : isWrongYear.Value ? "~" : "=";
subDirectoryName = $"{isWrongYearFlag}{minimumDateTime:yyyy}";
(isWrongYear, _) = propertyHolder.Property.IsWrongYear(propertyHolder.ImageFileInfo.FullName, propertyHolder.MinimumDateTime.Value);
isWrongYearFlag = PropertyHolder.GetWrongYearFlag(isWrongYear);
subDirectoryName = $"{isWrongYearFlag}{propertyHolder.MinimumDateTime.Value:yyyy}";
if (!faceCollection.Any())
directory = Path.Combine(dFacesContentDirectory, $"None{relativePath[2..]}", subDirectoryName);
else if (keys.Length != 1)
@ -569,13 +567,11 @@ public class D_Face : Shared.Models.Properties.IFace, IFace
birthDate = Shared.Models.Stateless.Methods.IPersonBirthday.Get(personKey);
if (birthDate.HasValue)
{
if (minimumDateTime < birthDate.Value)
timeSpan = new(propertyHolder.MinimumDateTime.Value.Ticks - birthDate.Value.Ticks);
if (timeSpan.Ticks < 0)
subDirectoryName = "!---";
else
{
timeSpan = new(minimumDateTime.Ticks - birthDate.Value.Ticks);
subDirectoryName = $"^{Math.Floor(timeSpan.TotalDays / 365):000}";
}
}
}
directory = Path.Combine(dFacesContentDirectory, "Shortcuts", personKey, subDirectoryName);
@ -599,13 +595,14 @@ public class D_Face : Shared.Models.Properties.IFace, IFace
return results;
}
internal static void SaveShortcuts(string[] juliePhares, Dictionary<string, List<Person>> peopleCollection, List<(PropertyHolder, (string, D_Face?, (string Directory, string CopyDirectory, string CopyFileName, string ShortcutFileName))[])> collections)
internal static void SaveShortcuts(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, string[] juliePhares, Dictionary<string, List<Person>> peopleCollection, PropertyLogic propertyLogic, string outputResolution, PropertyHolder[] filteredPropertyHolderCollection, List<List<D_Face>> faceCollections)
{
Person person;
string fileName;
string fullName;
WindowsShortcut windowsShortcut;
const string pattern = @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]";
List<(PropertyHolder, (string, D_Face?, (string, string, string, string))[])> collections = GetCollection(configuration, model, predictorModel, propertyLogic, outputResolution, filteredPropertyHolderCollection, faceCollections);
foreach ((PropertyHolder propertyHolder, (string personKey, D_Face? face, (string, string, string, string))[] collection) in collections)
{
if (collection.Length != 1)