(bool? IsWrongYear, string PersonKey,
TimeSpan? TimeSpan)
This commit is contained in:
parent
62bdc17f7a
commit
2158b4cfc2
@ -677,21 +677,11 @@ public class DlibDotNet
|
|||||||
{
|
{
|
||||||
if (outputResolution == _Configuration.OutputResolutions[0] || _Configuration.SaveShortcutsForOutputResolutions.Contains(outputResolution))
|
if (outputResolution == _Configuration.OutputResolutions[0] || _Configuration.SaveShortcutsForOutputResolutions.Contains(outputResolution))
|
||||||
{
|
{
|
||||||
List<(PropertyHolder, (string, D_Face?, (string, string, string, string))[])> collections = D_Face.GetCollection(configuration, model, predictorModel, propertyLogic, peopleCollection, outputResolution, filteredPropertyHolderCollection, faceCollections);
|
PropertyHolder.AddToNamed(propertyLogic, filteredPropertyHolderCollection);
|
||||||
if (outputResolution == _Configuration.OutputResolutions[0])
|
for (int i = 0; i < faceCollections.Count; i++)
|
||||||
{
|
PropertyHolder.AddToFaces(filteredPropertyHolderCollection, (from l in faceCollections[i] select (object)l).ToArray());
|
||||||
foreach ((PropertyHolder propertyHolder, (string, D_Face?, (string, string, string, string))[] collection) in collections)
|
|
||||||
{
|
|
||||||
foreach ((string personKey, D_Face? face, (string directory, string copyDirectory, string copyFileName, string shortcutFileName)) in collection)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(personKey) || face is null || string.IsNullOrEmpty(directory))
|
|
||||||
continue;
|
|
||||||
propertyHolder.AddNamed(directory, personKey, face);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (_Configuration.SaveShortcutsForOutputResolutions.Contains(outputResolution))
|
if (_Configuration.SaveShortcutsForOutputResolutions.Contains(outputResolution))
|
||||||
D_Face.SaveShortcuts(_Configuration.JuliePhares, peopleCollection, collections);
|
D_Face.SaveShortcuts(configuration, model, predictorModel, _Configuration.JuliePhares, peopleCollection, propertyLogic, outputResolution, filteredPropertyHolderCollection, faceCollections);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (exceptionCount == 0 && _Configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions.Contains(outputResolution))
|
if (exceptionCount == 0 && _Configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions.Contains(outputResolution))
|
||||||
|
@ -505,22 +505,21 @@ public class D_Face : Shared.Models.Properties.IFace, IFace
|
|||||||
SaveFaces(faceCollection, propertyHolder.ResizedFileInfo, imageFiles);
|
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();
|
List<(PropertyHolder, (string, D_Face?, (string, string, string, string))[])> results = new();
|
||||||
string[] keys;
|
string[] keys;
|
||||||
string personKey;
|
|
||||||
string directory;
|
string directory;
|
||||||
|
string personKey;
|
||||||
bool? isWrongYear;
|
bool? isWrongYear;
|
||||||
TimeSpan timeSpan;
|
TimeSpan timeSpan;
|
||||||
string copyFileName;
|
|
||||||
DateTime? birthDate;
|
DateTime? birthDate;
|
||||||
|
string copyFileName;
|
||||||
string copyDirectory;
|
string copyDirectory;
|
||||||
string? relativePath;
|
string? relativePath;
|
||||||
string isWrongYearFlag;
|
string isWrongYearFlag;
|
||||||
string shortcutFileName;
|
string shortcutFileName;
|
||||||
string subDirectoryName;
|
string subDirectoryName;
|
||||||
DateTime minimumDateTime;
|
|
||||||
List<int> indices = new();
|
List<int> indices = new();
|
||||||
List<D_Face> faceCollection;
|
List<D_Face> faceCollection;
|
||||||
PropertyHolder propertyHolder;
|
PropertyHolder propertyHolder;
|
||||||
@ -550,10 +549,9 @@ public class D_Face : Shared.Models.Properties.IFace, IFace
|
|||||||
{
|
{
|
||||||
faceCollection = faceCollections[i];
|
faceCollection = faceCollections[i];
|
||||||
keys = propertyLogic.NamedFaceInfoDeterministicHashCodeIndices[propertyHolder.Property.Id.Value];
|
keys = propertyLogic.NamedFaceInfoDeterministicHashCodeIndices[propertyHolder.Property.Id.Value];
|
||||||
minimumDateTime = Property.Models.Stateless.A_Property.GetMinimumDateTime(propertyHolder.Property);
|
(isWrongYear, _) = propertyHolder.Property.IsWrongYear(propertyHolder.ImageFileInfo.FullName, propertyHolder.MinimumDateTime.Value);
|
||||||
(isWrongYear, _) = propertyHolder.Property.IsWrongYear(propertyHolder.ImageFileInfo.FullName, minimumDateTime);
|
isWrongYearFlag = PropertyHolder.GetWrongYearFlag(isWrongYear);
|
||||||
isWrongYearFlag = isWrongYear is null ? "#" : isWrongYear.Value ? "~" : "=";
|
subDirectoryName = $"{isWrongYearFlag}{propertyHolder.MinimumDateTime.Value:yyyy}";
|
||||||
subDirectoryName = $"{isWrongYearFlag}{minimumDateTime:yyyy}";
|
|
||||||
if (!faceCollection.Any())
|
if (!faceCollection.Any())
|
||||||
directory = Path.Combine(dFacesContentDirectory, $"None{relativePath[2..]}", subDirectoryName);
|
directory = Path.Combine(dFacesContentDirectory, $"None{relativePath[2..]}", subDirectoryName);
|
||||||
else if (keys.Length != 1)
|
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);
|
birthDate = Shared.Models.Stateless.Methods.IPersonBirthday.Get(personKey);
|
||||||
if (birthDate.HasValue)
|
if (birthDate.HasValue)
|
||||||
{
|
{
|
||||||
if (minimumDateTime < birthDate.Value)
|
timeSpan = new(propertyHolder.MinimumDateTime.Value.Ticks - birthDate.Value.Ticks);
|
||||||
|
if (timeSpan.Ticks < 0)
|
||||||
subDirectoryName = "!---";
|
subDirectoryName = "!---";
|
||||||
else
|
else
|
||||||
{
|
|
||||||
timeSpan = new(minimumDateTime.Ticks - birthDate.Value.Ticks);
|
|
||||||
subDirectoryName = $"^{Math.Floor(timeSpan.TotalDays / 365):000}";
|
subDirectoryName = $"^{Math.Floor(timeSpan.TotalDays / 365):000}";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
directory = Path.Combine(dFacesContentDirectory, "Shortcuts", personKey, subDirectoryName);
|
directory = Path.Combine(dFacesContentDirectory, "Shortcuts", personKey, subDirectoryName);
|
||||||
@ -599,13 +595,14 @@ public class D_Face : Shared.Models.Properties.IFace, IFace
|
|||||||
return results;
|
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;
|
Person person;
|
||||||
string fileName;
|
string fileName;
|
||||||
string fullName;
|
string fullName;
|
||||||
WindowsShortcut windowsShortcut;
|
WindowsShortcut windowsShortcut;
|
||||||
const string pattern = @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]";
|
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)
|
foreach ((PropertyHolder propertyHolder, (string personKey, D_Face? face, (string, string, string, string))[] collection) in collections)
|
||||||
{
|
{
|
||||||
if (collection.Length != 1)
|
if (collection.Length != 1)
|
||||||
|
@ -401,10 +401,14 @@ internal class E_Distance
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Dictionary<string, List<(string directory, string personKey, D_Face face)>> Convert(string argZero, List<PropertyHolder[]> propertyHolderCollections)
|
private static Dictionary<string, List<(string personKey, D_Face face)>> Convert(string argZero, List<PropertyHolder[]> propertyHolderCollections)
|
||||||
{
|
{
|
||||||
Dictionary<string, List<(string directory, string personKey, D_Face face)>> results = new();
|
Dictionary<string, List<(string personKey, D_Face face)>> results = new();
|
||||||
string key;
|
string key;
|
||||||
|
string personKey;
|
||||||
|
bool? isWrongYear;
|
||||||
|
TimeSpan? timeSpan;
|
||||||
|
string isWrongYearFlag;
|
||||||
foreach (PropertyHolder[] propertyHolderCollection in propertyHolderCollections)
|
foreach (PropertyHolder[] propertyHolderCollection in propertyHolderCollections)
|
||||||
{
|
{
|
||||||
if (!propertyHolderCollection.Any())
|
if (!propertyHolderCollection.Any())
|
||||||
@ -415,16 +419,27 @@ internal class E_Distance
|
|||||||
{
|
{
|
||||||
if (propertyHolder.ImageFileInfo is null || propertyHolder.Property is null || !propertyHolder.Named.Any())
|
if (propertyHolder.ImageFileInfo is null || propertyHolder.Property is null || !propertyHolder.Named.Any())
|
||||||
continue;
|
continue;
|
||||||
foreach ((string directory, string personKey, object @object) in propertyHolder.Named)
|
if (propertyHolder.Named.Count != 1 || propertyHolder.Faces.Count != 1)
|
||||||
|
continue;
|
||||||
|
for (int i = 0; i < propertyHolder.Named.Count; i++)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(directory) || string.IsNullOrEmpty(personKey) || !directory.Contains(personKey))
|
if (propertyHolder.MinimumDateTime is null)
|
||||||
continue;
|
continue;
|
||||||
if (@object is not D_Face face || face.FaceEncoding is null)
|
if (propertyHolder.Faces[i] is not D_Face face)
|
||||||
continue;
|
continue;
|
||||||
key = directory.Split(personKey)[1];
|
timeSpan = propertyHolder.Named[i].TimeSpan;
|
||||||
|
personKey = propertyHolder.Named[i].PersonKey;
|
||||||
|
isWrongYear = propertyHolder.Named[i].IsWrongYear;
|
||||||
|
isWrongYearFlag = PropertyHolder.GetWrongYearFlag(isWrongYear);
|
||||||
|
if (timeSpan is null)
|
||||||
|
key = $"{personKey}\t{isWrongYearFlag}{propertyHolder.MinimumDateTime.Value:yyyy}";
|
||||||
|
else if (timeSpan.Value.Ticks < 0)
|
||||||
|
key = $"{personKey}\t{isWrongYearFlag}!---";
|
||||||
|
else
|
||||||
|
key = $"{personKey}\t^{Math.Floor(timeSpan.Value.TotalDays / 365):000}";
|
||||||
if (!results.ContainsKey(key))
|
if (!results.ContainsKey(key))
|
||||||
results.Add(key, new());
|
results.Add(key, new());
|
||||||
results[key].Add(new(directory, personKey, face));
|
results[key].Add(new(personKey, face));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -440,14 +455,14 @@ internal class E_Distance
|
|||||||
List<string> checkDirectories = new();
|
List<string> checkDirectories = new();
|
||||||
List<Shared.Models.Properties.IFace> collection;
|
List<Shared.Models.Properties.IFace> collection;
|
||||||
const string pattern = @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]";
|
const string pattern = @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]";
|
||||||
|
Dictionary<string, List<(string personKey, D_Face face)>> keyValuePairs = Convert(argZero, propertyHolderCollections);
|
||||||
string eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[_]");
|
string eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, model, predictorModel, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[_]");
|
||||||
Dictionary<string, List<(string directory, string personKey, D_Face face)>> keyValuePairs = Convert(argZero, propertyHolderCollections);
|
foreach (KeyValuePair<string, List<(string personKey, D_Face face)>> keyValuePair in keyValuePairs)
|
||||||
foreach (KeyValuePair<string, List<(string directory, string personKey, D_Face face)>> keyValuePair in keyValuePairs)
|
|
||||||
{
|
{
|
||||||
collection = new();
|
collection = new();
|
||||||
checkDirectories.Clear();
|
checkDirectories.Clear();
|
||||||
checkFile = string.Empty;
|
checkFile = string.Empty;
|
||||||
foreach ((string _, string personKey, D_Face face) in keyValuePair.Value)
|
foreach ((string personKey, D_Face face) in keyValuePair.Value)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(personKey) || !peopleCollection.ContainsKey(personKey))
|
if (string.IsNullOrEmpty(personKey) || !peopleCollection.ContainsKey(personKey))
|
||||||
continue;
|
continue;
|
||||||
|
@ -7,12 +7,13 @@ public class PropertyHolder
|
|||||||
|
|
||||||
protected readonly bool? _Abandoned;
|
protected readonly bool? _Abandoned;
|
||||||
protected readonly bool? _Changed;
|
protected readonly bool? _Changed;
|
||||||
|
protected List<object> _Faces;
|
||||||
protected readonly FileInfo? _ImageFileInfo;
|
protected readonly FileInfo? _ImageFileInfo;
|
||||||
protected readonly string _ImageFileNameWithoutExtension;
|
protected readonly string _ImageFileNameWithoutExtension;
|
||||||
protected readonly int _G;
|
protected readonly int _G;
|
||||||
protected DateTime? _MinimumDateTime;
|
protected DateTime? _MinimumDateTime;
|
||||||
protected bool? _Moved;
|
protected bool? _Moved;
|
||||||
protected List<(string Directory, string PersonKey, object Object)> _Named;
|
protected List<(bool?, string, TimeSpan?)> _Named;
|
||||||
protected readonly bool? _NoJson;
|
protected readonly bool? _NoJson;
|
||||||
protected A_Property? _Property;
|
protected A_Property? _Property;
|
||||||
protected readonly int _R;
|
protected readonly int _R;
|
||||||
@ -21,16 +22,16 @@ public class PropertyHolder
|
|||||||
protected readonly string _SourceDirectory;
|
protected readonly string _SourceDirectory;
|
||||||
protected readonly string _SourceDirectoryFile;
|
protected readonly string _SourceDirectoryFile;
|
||||||
protected bool? _ValidImageFormatExtension;
|
protected bool? _ValidImageFormatExtension;
|
||||||
protected bool? _WrongYear;
|
|
||||||
public bool? Abandoned => _Abandoned;
|
public bool? Abandoned => _Abandoned;
|
||||||
public bool? Changed => _Changed;
|
public bool? Changed => _Changed;
|
||||||
|
public List<object> Faces => _Faces;
|
||||||
public FileInfo? ImageFileInfo => _ImageFileInfo;
|
public FileInfo? ImageFileInfo => _ImageFileInfo;
|
||||||
public string ImageFileNameWithoutExtension => _ImageFileNameWithoutExtension;
|
public string ImageFileNameWithoutExtension => _ImageFileNameWithoutExtension;
|
||||||
public int G => _G;
|
public int G => _G;
|
||||||
public DateTime? MinimumDateTime => _MinimumDateTime;
|
public DateTime? MinimumDateTime => _MinimumDateTime;
|
||||||
public bool? Moved => _Moved;
|
public bool? Moved => _Moved;
|
||||||
public bool? NoJson => _NoJson;
|
public bool? NoJson => _NoJson;
|
||||||
public List<(string Directory, string PersonKey, object Object)> Named => _Named;
|
public List<(bool? IsWrongYear, string PersonKey, TimeSpan? TimeSpan)> Named => _Named;
|
||||||
public A_Property? Property => _Property;
|
public A_Property? Property => _Property;
|
||||||
public int R => _R;
|
public int R => _R;
|
||||||
public string RelativePath => _RelativePath;
|
public string RelativePath => _RelativePath;
|
||||||
@ -38,36 +39,36 @@ public class PropertyHolder
|
|||||||
public string SourceDirectory => _SourceDirectory;
|
public string SourceDirectory => _SourceDirectory;
|
||||||
public string SourceDirectoryFile => _SourceDirectoryFile;
|
public string SourceDirectoryFile => _SourceDirectoryFile;
|
||||||
public bool? ValidImageFormatExtension => _ValidImageFormatExtension;
|
public bool? ValidImageFormatExtension => _ValidImageFormatExtension;
|
||||||
public bool? WrongYear => _WrongYear;
|
|
||||||
|
|
||||||
public PropertyHolder()
|
public PropertyHolder()
|
||||||
{
|
{
|
||||||
_G = -1;
|
_G = -1;
|
||||||
|
_R = -1;
|
||||||
|
_Faces = new();
|
||||||
_Named = new();
|
_Named = new();
|
||||||
_RelativePath = string.Empty;
|
_RelativePath = string.Empty;
|
||||||
_SourceDirectory = string.Empty;
|
_SourceDirectory = string.Empty;
|
||||||
_SourceDirectoryFile = string.Empty;
|
_SourceDirectoryFile = string.Empty;
|
||||||
_ImageFileNameWithoutExtension = string.Empty;
|
_ImageFileNameWithoutExtension = string.Empty;
|
||||||
_R = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public PropertyHolder(int g, string sourceDirectory, string sourceDirectoryFile, string relativePath, int r, FileInfo? imageFileInfo, A_Property? property, bool? abandoned, bool? changed, bool? moved, bool? validImageFormatExtension, bool? wrongYear)
|
public PropertyHolder(int g, string sourceDirectory, string sourceDirectoryFile, string relativePath, int r, FileInfo? imageFileInfo, A_Property? property, bool? abandoned, bool? changed, bool? moved, bool? validImageFormatExtension)
|
||||||
{
|
{
|
||||||
_Abandoned = abandoned;
|
|
||||||
_Changed = changed;
|
|
||||||
_ImageFileInfo = imageFileInfo;
|
|
||||||
_G = g;
|
_G = g;
|
||||||
_Moved = moved;
|
|
||||||
_NoJson = abandoned is null;
|
|
||||||
_Named = new();
|
|
||||||
_Property = property;
|
|
||||||
_R = r;
|
_R = r;
|
||||||
|
_Faces = new();
|
||||||
|
_Moved = moved;
|
||||||
|
_Named = new();
|
||||||
|
_Changed = changed;
|
||||||
|
_Property = property;
|
||||||
|
_Abandoned = abandoned;
|
||||||
|
_NoJson = abandoned is null;
|
||||||
_RelativePath = relativePath;
|
_RelativePath = relativePath;
|
||||||
|
_ImageFileInfo = imageFileInfo;
|
||||||
_SourceDirectory = sourceDirectory;
|
_SourceDirectory = sourceDirectory;
|
||||||
_SourceDirectoryFile = sourceDirectoryFile;
|
_SourceDirectoryFile = sourceDirectoryFile;
|
||||||
_ValidImageFormatExtension = validImageFormatExtension;
|
_ValidImageFormatExtension = validImageFormatExtension;
|
||||||
_WrongYear = wrongYear;
|
|
||||||
_MinimumDateTime = Stateless.A_Property.GetMinimumDateTime(property);
|
_MinimumDateTime = Stateless.A_Property.GetMinimumDateTime(property);
|
||||||
if (imageFileInfo is null)
|
if (imageFileInfo is null)
|
||||||
_ImageFileNameWithoutExtension = string.Empty;
|
_ImageFileNameWithoutExtension = string.Empty;
|
||||||
@ -81,20 +82,61 @@ public class PropertyHolder
|
|||||||
|
|
||||||
internal void SetValidImageFormatExtension(bool isValidImageFormatExtension) => _ValidImageFormatExtension = isValidImageFormatExtension;
|
internal void SetValidImageFormatExtension(bool isValidImageFormatExtension) => _ValidImageFormatExtension = isValidImageFormatExtension;
|
||||||
|
|
||||||
internal void SetWrongYear(bool wrongYear) => _WrongYear = wrongYear;
|
|
||||||
|
|
||||||
internal void SetMoved(bool moved) => _Moved = moved;
|
internal void SetMoved(bool moved) => _Moved = moved;
|
||||||
|
|
||||||
|
public static string GetWrongYearFlag(bool? isWrongYear) => isWrongYear is null ? "#" : isWrongYear.Value ? "~" : "=";
|
||||||
|
|
||||||
public void SetResizedFileInfo(FileInfo fileInfo) => _ResizedFileInfo = fileInfo;
|
public void SetResizedFileInfo(FileInfo fileInfo) => _ResizedFileInfo = fileInfo;
|
||||||
|
|
||||||
public bool Any() => (_Abandoned.HasValue && _Abandoned.Value) || (_Changed.HasValue && _Changed.Value) || (_Moved.HasValue && _Moved.Value) || (_NoJson.HasValue && _NoJson.Value);
|
public bool Any() => (_Abandoned.HasValue && _Abandoned.Value) || (_Changed.HasValue && _Changed.Value) || (_Moved.HasValue && _Moved.Value) || (_NoJson.HasValue && _NoJson.Value);
|
||||||
|
|
||||||
public void AddNamed(string directory, string personKey, object face) => _Named.Add(new(directory, personKey, face));
|
|
||||||
|
|
||||||
public void Update(A_Property property)
|
public void Update(A_Property property)
|
||||||
{
|
{
|
||||||
_Property = property;
|
_Property = property;
|
||||||
_MinimumDateTime = Stateless.A_Property.GetMinimumDateTime(property);
|
_MinimumDateTime = Stateless.A_Property.GetMinimumDateTime(property);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void AddToFaces(PropertyHolder[] filteredPropertyHolderCollection, object[] faces)
|
||||||
|
{
|
||||||
|
foreach (PropertyHolder propertyHolder in filteredPropertyHolderCollection)
|
||||||
|
propertyHolder.Faces.AddRange(faces);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AddToNamed(PropertyLogic propertyLogic, PropertyHolder[] filteredPropertyHolderCollection)
|
||||||
|
{
|
||||||
|
bool? isWrongYear;
|
||||||
|
TimeSpan? timeSpan;
|
||||||
|
DateTime? birthDate;
|
||||||
|
string[] personKeys;
|
||||||
|
DateTime minimumDateTime;
|
||||||
|
PropertyHolder propertyHolder;
|
||||||
|
for (int i = 0; i < filteredPropertyHolderCollection.Length; i++)
|
||||||
|
{
|
||||||
|
propertyHolder = filteredPropertyHolderCollection[i];
|
||||||
|
if (propertyHolder.ImageFileInfo is null)
|
||||||
|
continue;
|
||||||
|
if (propertyHolder.Property?.Id is null || propertyHolder.MinimumDateTime is null || propertyHolder.ResizedFileInfo is null)
|
||||||
|
continue;
|
||||||
|
if (!propertyLogic.NamedFaceInfoDeterministicHashCodeIndices.ContainsKey(propertyHolder.Property.Id.Value))
|
||||||
|
continue;
|
||||||
|
minimumDateTime = Stateless.A_Property.GetMinimumDateTime(propertyHolder.Property);
|
||||||
|
personKeys = propertyLogic.NamedFaceInfoDeterministicHashCodeIndices[propertyHolder.Property.Id.Value];
|
||||||
|
(isWrongYear, _) = propertyHolder.Property.IsWrongYear(propertyHolder.ImageFileInfo.FullName, minimumDateTime);
|
||||||
|
foreach (string personKey in personKeys)
|
||||||
|
{
|
||||||
|
if (isWrongYear is null || isWrongYear.Value || personKey[..2] is not "19" and not "20")
|
||||||
|
timeSpan = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
birthDate = Shared.Models.Stateless.Methods.IPersonBirthday.Get(personKey);
|
||||||
|
if (birthDate is null)
|
||||||
|
timeSpan = null;
|
||||||
|
else
|
||||||
|
timeSpan = new(minimumDateTime.Ticks - birthDate.Value.Ticks);
|
||||||
|
}
|
||||||
|
propertyHolder.Named.Add(new(isWrongYear, personKey, timeSpan));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -523,11 +523,6 @@ public class PropertyLogic
|
|||||||
dateTime = minimumDateTime;
|
dateTime = minimumDateTime;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (isWrongYear.HasValue && isWrongYear.Value)
|
|
||||||
{
|
|
||||||
lock (propertyHolder)
|
|
||||||
propertyHolder.SetWrongYear(true);
|
|
||||||
}
|
|
||||||
if (!matches.Any())
|
if (!matches.Any())
|
||||||
continue;
|
continue;
|
||||||
if (!DateTime.TryParseExact(matches[0], "yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime))
|
if (!DateTime.TryParseExact(matches[0], "yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime))
|
||||||
|
@ -173,7 +173,7 @@ public static class A_Property
|
|||||||
if (keyFileInfo.Extension is ".json")
|
if (keyFileInfo.Extension is ".json")
|
||||||
continue;
|
continue;
|
||||||
keySourceDirectory = string.Concat(keyFileInfo.DirectoryName);
|
keySourceDirectory = string.Concat(keyFileInfo.DirectoryName);
|
||||||
propertyHolderCollection.Add(new(g, keySourceDirectory, sourceDirectoryFile, relativePath, r, keyFileInfo, property, true, null, null, null, null));
|
propertyHolderCollection.Add(new(g, keySourceDirectory, sourceDirectoryFile, relativePath, r, keyFileInfo, property, true, null, null, null));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -184,11 +184,11 @@ public static class A_Property
|
|||||||
if (keyFileInfo.Extension is ".json")
|
if (keyFileInfo.Extension is ".json")
|
||||||
continue;
|
continue;
|
||||||
if (property?.Id is null || property?.Width is null || property?.Height is null)
|
if (property?.Id is null || property?.Width is null || property?.Height is null)
|
||||||
propertyHolderCollection.Add(new(g, keySourceDirectory, sourceDirectoryFile, relativePath, r, keyFileInfo, property, false, null, null, null, null));
|
propertyHolderCollection.Add(new(g, keySourceDirectory, sourceDirectoryFile, relativePath, r, keyFileInfo, property, false, null, null, null));
|
||||||
else if (configuration.PropertiesChangedForProperty.Value || property.LastWriteTime != keyFileInfo.LastWriteTime || property.FileSize != keyFileInfo.Length)
|
else if (configuration.PropertiesChangedForProperty.Value || property.LastWriteTime != keyFileInfo.LastWriteTime || property.FileSize != keyFileInfo.Length)
|
||||||
propertyHolderCollection.Add(new(g, keySourceDirectory, sourceDirectoryFile, relativePath, r, keyFileInfo, property, false, true, null, null, null));
|
propertyHolderCollection.Add(new(g, keySourceDirectory, sourceDirectoryFile, relativePath, r, keyFileInfo, property, false, true, null, null));
|
||||||
else
|
else
|
||||||
propertyHolderCollection.Add(new(g, keySourceDirectory, sourceDirectoryFile, relativePath, r, keyFileInfo, property, false, false, null, null, null));
|
propertyHolderCollection.Add(new(g, keySourceDirectory, sourceDirectoryFile, relativePath, r, keyFileInfo, property, false, false, null, null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (propertyHolderCollection.Any())
|
if (propertyHolderCollection.Any())
|
||||||
@ -207,7 +207,7 @@ public static class A_Property
|
|||||||
throw new Exception();
|
throw new Exception();
|
||||||
if (sourceDirectoryFileInfo.Extension is ".json")
|
if (sourceDirectoryFileInfo.Extension is ".json")
|
||||||
continue;
|
continue;
|
||||||
propertyHolderCollection.Add(new(g, sourceDirectory, relativePath, sourceDirectoryFileInfo.FullName, r, sourceDirectoryFileInfo, null, null, null, null, null, null));
|
propertyHolderCollection.Add(new(g, sourceDirectory, relativePath, sourceDirectoryFileInfo.FullName, r, sourceDirectoryFileInfo, null, null, null, null, null));
|
||||||
}
|
}
|
||||||
if (propertyHolderCollection.Any())
|
if (propertyHolderCollection.Any())
|
||||||
results.Add(propertyHolderCollection.ToArray());
|
results.Add(propertyHolderCollection.ToArray());
|
||||||
|
@ -161,7 +161,7 @@ public class UnitTestResize
|
|||||||
FileInfo fileInfo = new(Path.Combine(sourceDirectory, sourceFileName));
|
FileInfo fileInfo = new(Path.Combine(sourceDirectory, sourceFileName));
|
||||||
string relativePath = Property.Models.Stateless.IPath.GetRelativePath(fileInfo.FullName, length);
|
string relativePath = Property.Models.Stateless.IPath.GetRelativePath(fileInfo.FullName, length);
|
||||||
sourceDirectory = Path.Combine(aPropertySingletonDirectory, sourceDirectoryName);
|
sourceDirectory = Path.Combine(aPropertySingletonDirectory, sourceDirectoryName);
|
||||||
propertyHolder = new(g, sourceDirectory, sourceDirectoryFile, relativePath, r, fileInfo, property, false, false, null, null, null);
|
propertyHolder = new(g, sourceDirectory, sourceDirectoryFile, relativePath, r, fileInfo, property, false, false, null, null);
|
||||||
Assert.IsNotNull(propertyHolder.ImageFileInfo);
|
Assert.IsNotNull(propertyHolder.ImageFileInfo);
|
||||||
property = propertyLogic.GetProperty(propertyLogic.AngleBracketCollection[0], propertyHolder, subFileTuples, parseExceptions);
|
property = propertyLogic.GetProperty(propertyLogic.AngleBracketCollection[0], propertyHolder, subFileTuples, parseExceptions);
|
||||||
(int _, metadataCollection) = metadata.GetMetadataCollection(subFileTuples, parseExceptions, propertyHolder);
|
(int _, metadataCollection) = metadata.GetMetadataCollection(subFileTuples, parseExceptions, propertyHolder);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user