IEnumerable
Filtered => ValidImage GetMappings => if (face.FaceEncoding is null || face.Location is null || face.OutputResolution is null) PreFilter skip done Removed sort Better names break out RootAmazon FilteredOriginalImage DeleteContinueFiles AppSetting PreVerify Settings Tasks
This commit is contained in:
@ -8,7 +8,7 @@ internal abstract class Container
|
||||
|
||||
private record FilePair(bool IsUnique, List<string> Collection, FilePath FilePath, Models.Item Item) { }
|
||||
|
||||
internal static DateTime[] GetContainerDateTimes(IEnumerable<Models.Item> items)
|
||||
internal static DateTime[] GetContainerDateTimes(ReadOnlyCollection<Models.Item> items)
|
||||
{
|
||||
DateTime[] results;
|
||||
long containerMinimumTicks = (from l in items select l.FilePath.LastWriteTicks).Min();
|
||||
@ -17,16 +17,16 @@ internal abstract class Container
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static Models.Item[] GetFilterItems(Properties.IPropertyConfiguration propertyConfiguration, Models.Container container)
|
||||
internal static ReadOnlyCollection<Models.Item> GetValidImageItems(Properties.IPropertyConfiguration propertyConfiguration, Models.Container container)
|
||||
{
|
||||
List<Models.Item> results = [];
|
||||
foreach (Models.Item item in container.Items)
|
||||
{
|
||||
if (item.IsValidImageFormatExtension
|
||||
&& !propertyConfiguration.IgnoreExtensions.Contains(item.FilePath.ExtensionLowered))
|
||||
results.Add(item);
|
||||
if (!item.IsValidImageFormatExtension || propertyConfiguration.IgnoreExtensions.Contains(item.FilePath.ExtensionLowered))
|
||||
continue;
|
||||
results.Add(item);
|
||||
}
|
||||
return results.ToArray();
|
||||
return container.Items.Count == results.Count ? container.Items : new(results);
|
||||
}
|
||||
|
||||
internal static List<Models.FilePair> GetFilePairs(Properties.IPropertyConfiguration propertyConfiguration, string directorySearchFilter, string extension, string aPropertySingletonDirectory, ReadOnlyCollection<string[]> filesCollection)
|
||||
@ -74,8 +74,8 @@ internal abstract class Container
|
||||
bool abandoned = false;
|
||||
Models.FileHolder sourceDirectoryFileHolder;
|
||||
Models.Property? property = GetProperty(filePair);
|
||||
Models.FileHolder imageFileInfo = IFileHolder.Get(filePair.Path);
|
||||
FilePath filePath = FilePath.Get(propertyConfiguration, imageFileInfo, index: null);
|
||||
Models.FileHolder imageFileHolder = IFileHolder.Get(filePair.Path);
|
||||
FilePath filePath = FilePath.Get(propertyConfiguration, imageFileHolder, index: null);
|
||||
bool? fileSizeChanged = property is not null ? property.FileSize != filePath.Length : null;
|
||||
bool isValidImageFormatExtension = propertyConfiguration.ValidImageFormatExtensions.Contains(filePath.ExtensionLowered);
|
||||
if (property is not null && property.Keywords is not null)
|
||||
@ -85,8 +85,9 @@ internal abstract class Container
|
||||
bool shouldIgnore = propertyConfiguration.IgnoreRulesKeyWords.Any(l => property.Keywords.Contains(l));
|
||||
if (shouldIgnore)
|
||||
{
|
||||
if (shouldIgnore)
|
||||
{ }
|
||||
FileInfo fileInfo = new(filePath.FullName);
|
||||
if (!fileInfo.Attributes.HasFlag(FileAttributes.Hidden))
|
||||
File.SetAttributes(imageFileHolder.FullName, FileAttributes.Hidden);
|
||||
}
|
||||
if (filePath.IsIgnore.Value != shouldIgnore)
|
||||
{
|
||||
@ -169,7 +170,7 @@ internal abstract class Container
|
||||
{
|
||||
if (keyValuePair.Value.Count == 0)
|
||||
continue;
|
||||
container = new(keyValuePair.Key, keyValuePair.Value);
|
||||
container = new(keyValuePair.Key, new(keyValuePair.Value));
|
||||
results.Add(container);
|
||||
}
|
||||
return (filePairs.Count, results.ToArray());
|
||||
@ -199,13 +200,13 @@ internal abstract class Container
|
||||
internal static List<int> GetFilteredDistinctIds(Properties.IPropertyConfiguration propertyConfiguration, ReadOnlyCollection<Models.Container> readOnlyContainers)
|
||||
{
|
||||
List<int> results = [];
|
||||
Models.Item[] filteredItems;
|
||||
ReadOnlyCollection<Models.Item> filteredItems;
|
||||
foreach (Models.Container container in readOnlyContainers)
|
||||
{
|
||||
if (container.Items.Count == 0)
|
||||
continue;
|
||||
filteredItems = GetFilterItems(propertyConfiguration, container);
|
||||
if (filteredItems.Length == 0)
|
||||
filteredItems = GetValidImageItems(propertyConfiguration, container);
|
||||
if (filteredItems.Count == 0)
|
||||
continue;
|
||||
foreach (Models.Item item in filteredItems)
|
||||
{
|
||||
@ -219,11 +220,11 @@ internal abstract class Container
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static ReadOnlyCollection<Models.Item> GetItems(Properties.IPropertyConfiguration propertyConfiguration, ReadOnlyCollection<Models.Container> containers, bool distinctItems, bool filterItems)
|
||||
internal static ReadOnlyCollection<Models.Item> GetValidImageItems(Properties.IPropertyConfiguration propertyConfiguration, ReadOnlyCollection<Models.Container> containers, bool distinctItems, bool filterItems)
|
||||
{
|
||||
List<Models.Item> results = [];
|
||||
List<int> distinct = [];
|
||||
IEnumerable<Models.Item> filteredItems;
|
||||
ReadOnlyCollection<Models.Item> filteredItems;
|
||||
foreach (Models.Container container in containers)
|
||||
{
|
||||
if (container.Items.Count == 0)
|
||||
@ -232,8 +233,8 @@ internal abstract class Container
|
||||
filteredItems = container.Items;
|
||||
else
|
||||
{
|
||||
filteredItems = GetFilterItems(propertyConfiguration, container);
|
||||
if (!filteredItems.Any())
|
||||
filteredItems = GetValidImageItems(propertyConfiguration, container);
|
||||
if (filteredItems.Count == 0)
|
||||
continue;
|
||||
}
|
||||
foreach (Models.Item item in filteredItems)
|
||||
|
@ -5,15 +5,15 @@ namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
public interface IContainer
|
||||
{
|
||||
|
||||
DateTime[] TestStatic_GetContainerDateTimes(IEnumerable<Models.Item> items) =>
|
||||
DateTime[] TestStatic_GetContainerDateTimes(ReadOnlyCollection<Models.Item> items) =>
|
||||
GetContainerDateTimes(items);
|
||||
static DateTime[] GetContainerDateTimes(IEnumerable<Models.Item> items) =>
|
||||
static DateTime[] GetContainerDateTimes(ReadOnlyCollection<Models.Item> items) =>
|
||||
Container.GetContainerDateTimes(items);
|
||||
|
||||
Models.Item[] TestStatic_GetFilterItems(Properties.IPropertyConfiguration propertyConfiguration, Models.Container container) =>
|
||||
GetFilterItems(propertyConfiguration, container);
|
||||
static Models.Item[] GetFilterItems(Properties.IPropertyConfiguration propertyConfiguration, Models.Container container) =>
|
||||
Container.GetFilterItems(propertyConfiguration, container);
|
||||
ReadOnlyCollection<Models.Item> TestStatic_GetValidImageItems(Properties.IPropertyConfiguration propertyConfiguration, Models.Container container) =>
|
||||
GetValidImageItems(propertyConfiguration, container);
|
||||
static ReadOnlyCollection<Models.Item> GetValidImageItems(Properties.IPropertyConfiguration propertyConfiguration, Models.Container container) =>
|
||||
Container.GetValidImageItems(propertyConfiguration, container);
|
||||
|
||||
(int, Models.Container[]) TestStatic_GetContainers(Properties.IPropertyConfiguration propertyConfiguration, string aPropertySingletonDirectory) =>
|
||||
GetContainers(propertyConfiguration, aPropertySingletonDirectory);
|
||||
@ -30,9 +30,9 @@ public interface IContainer
|
||||
static List<int> GetFilteredDistinctIds(Properties.IPropertyConfiguration propertyConfiguration, ReadOnlyCollection<Models.Container> readOnlyContainers) =>
|
||||
Container.GetFilteredDistinctIds(propertyConfiguration, readOnlyContainers);
|
||||
|
||||
ReadOnlyCollection<Models.Item> TestStatic_GetItems(Properties.IPropertyConfiguration propertyConfiguration, ReadOnlyCollection<Models.Container> containers, bool distinctItems, bool filterItems) =>
|
||||
GetItems(propertyConfiguration, containers, distinctItems, filterItems);
|
||||
static ReadOnlyCollection<Models.Item> GetItems(Properties.IPropertyConfiguration propertyConfiguration, ReadOnlyCollection<Models.Container> containers, bool distinctItems, bool filterItems) =>
|
||||
Container.GetItems(propertyConfiguration, containers, distinctItems, filterItems);
|
||||
ReadOnlyCollection<Models.Item> TestStatic_GetValidImageItems(Properties.IPropertyConfiguration propertyConfiguration, ReadOnlyCollection<Models.Container> containers, bool distinctItems, bool filterItems) =>
|
||||
GetValidImageItems(propertyConfiguration, containers, distinctItems, filterItems);
|
||||
static ReadOnlyCollection<Models.Item> GetValidImageItems(Properties.IPropertyConfiguration propertyConfiguration, ReadOnlyCollection<Models.Container> containers, bool distinctItems, bool filterItems) =>
|
||||
Container.GetValidImageItems(propertyConfiguration, containers, distinctItems, filterItems);
|
||||
|
||||
}
|
@ -1,3 +1,5 @@
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
public interface IPersonContainer
|
||||
@ -5,9 +7,9 @@ public interface IPersonContainer
|
||||
|
||||
// ...
|
||||
|
||||
List<long> TestStatic_GetPersonKeys(IEnumerable<Models.PersonContainer> personContainers) =>
|
||||
List<long> TestStatic_GetPersonKeys(ReadOnlyCollection<Models.PersonContainer> personContainers) =>
|
||||
GetPersonKeys(personContainers);
|
||||
static List<long> GetPersonKeys(IEnumerable<Models.PersonContainer> personContainers) =>
|
||||
static List<long> GetPersonKeys(ReadOnlyCollection<Models.PersonContainer> personContainers) =>
|
||||
PersonContainer.GetPersonKeys(personContainers);
|
||||
|
||||
List<Models.PersonContainer> TestStatic_GetPersonContainers(string a2PeopleSingletonDirectory, string personBirthdayFormat, char[] personCharacters, Properties.IPropertyConfiguration propertyConfiguration, string facesFileNameExtension) =>
|
||||
|
@ -43,9 +43,9 @@ public interface IProperty
|
||||
static List<DateTime> GetDateTimes(Models.Property property) =>
|
||||
Property.GetDateTimes(property.CreationTime, property.LastWriteTime, property.DateTime, property.DateTimeDigitized, property.DateTimeFromName, property.DateTimeOriginal, property.GPSDateStamp);
|
||||
|
||||
double TestStatic_GetStandardDeviation(IEnumerable<long> values, double average) =>
|
||||
double TestStatic_GetStandardDeviation(List<long> values, double average) =>
|
||||
GetStandardDeviation(values, average);
|
||||
static double GetStandardDeviation(IEnumerable<long> values, double average) =>
|
||||
static double GetStandardDeviation(List<long> values, double average) =>
|
||||
Property.GetStandardDeviation(values, average);
|
||||
|
||||
TimeSpan TestStatic_GetThreeStandardDeviationHigh(int minimum, Models.Container container) =>
|
||||
|
@ -1,3 +1,5 @@
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
internal abstract class PersonContainer
|
||||
@ -313,7 +315,7 @@ internal abstract class PersonContainer
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static List<long> GetPersonKeys(IEnumerable<Models.PersonContainer> personContainers)
|
||||
internal static List<long> GetPersonKeys(ReadOnlyCollection<Models.PersonContainer> personContainers)
|
||||
{
|
||||
List<long> results = [];
|
||||
long personKey;
|
||||
|
@ -166,13 +166,13 @@ internal abstract class Property
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static double GetStandardDeviation(IEnumerable<long> values, double average)
|
||||
internal static double GetStandardDeviation(List<long> values, double average)
|
||||
{
|
||||
double result = 0;
|
||||
if (!values.Any())
|
||||
if (values.Count == 0)
|
||||
throw new Exception("Collection must have at least one value!");
|
||||
double sum = values.Sum(l => (l - average) * (l - average));
|
||||
result = Math.Sqrt(sum / values.Count());
|
||||
result = Math.Sqrt(sum / values.Count);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user