Tested first run
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using View_by_Distance.Shared.Models;
|
||||
using View_by_Distance.Shared.Models.Stateless;
|
||||
|
||||
namespace View_by_Distance.Map.Models.Stateless;
|
||||
|
||||
@ -90,4 +91,44 @@ internal abstract class MapLogic
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static void SetSingleImage(string[] ignoreRelativePaths, string argZero, Container[] containers)
|
||||
{
|
||||
Mapping mapping;
|
||||
string personKey;
|
||||
int? approximateYears = null;
|
||||
PersonBirthday? personBirthday = null;
|
||||
const string displayDirectoryName = Property.Models.Stateless.IResult.AllInOne;
|
||||
foreach (Container container in containers)
|
||||
{
|
||||
if (!container.Items.Any())
|
||||
continue;
|
||||
if (!container.SourceDirectory.StartsWith(argZero))
|
||||
continue;
|
||||
if (ignoreRelativePaths.Contains(Path.GetFileName(container.SourceDirectory)))
|
||||
continue;
|
||||
foreach (Item item in container.Items)
|
||||
{
|
||||
if (item.ImageFileHolder is null || item.Property?.Id is null)
|
||||
continue;
|
||||
foreach (Face face in item.Faces)
|
||||
{
|
||||
if (face.FaceEncoding is null || face.Location?.NormalizedPixelPercentage is null)
|
||||
continue;
|
||||
personKey = DateTime.MinValue.AddYears(IPersonBirthday.FirstYear).ToString(IPersonBirthday.Format);
|
||||
personBirthday = Shared.Models.Stateless.Methods.IPersonBirthday.GetPersonBirthday(personKey);
|
||||
if (personBirthday is null)
|
||||
continue;
|
||||
mapping = new(approximateYears, displayDirectoryName, face.Location.NormalizedPixelPercentage, personBirthday, personKey);
|
||||
item.Mapping.Add(mapping);
|
||||
if (personBirthday is not null)
|
||||
break;
|
||||
}
|
||||
if (personBirthday is not null)
|
||||
break;
|
||||
}
|
||||
if (personBirthday is not null)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user