Alignment with AA
This commit is contained in:
@ -64,21 +64,22 @@ internal abstract class FaceFileLogic
|
||||
exifDirectory = Metadata.Models.Stateless.Methods.IMetadata.GetExifDirectory(mappedFile.FilePath);
|
||||
RectangleF? rectangle = ILocation.GetPercentagesRectangle(configuration.LocationDigits, wholePercentages.Value);
|
||||
personDisplayDirectoryName = mappedFile.PersonDisplayDirectoryName is null ? configuration.MappingDefaultName : mappedFile.PersonDisplayDirectoryName;
|
||||
LocationContainer locationContainer = new(dateOnly,
|
||||
exifDirectory,
|
||||
mappedFile.DirectoryNumber,
|
||||
personDisplayDirectoryName,
|
||||
null,
|
||||
null,
|
||||
mappedFile.FilePath,
|
||||
fromDistanceContent,
|
||||
id.Value,
|
||||
null,
|
||||
null,
|
||||
mappedFile.PersonKey,
|
||||
rectangle,
|
||||
wholePercentages.Value);
|
||||
lock (locationContainers)
|
||||
locationContainers.Add(new(dateOnly,
|
||||
exifDirectory,
|
||||
mappedFile.DirectoryNumber,
|
||||
personDisplayDirectoryName,
|
||||
null,
|
||||
null,
|
||||
mappedFile.FilePath,
|
||||
fromDistanceContent,
|
||||
id.Value,
|
||||
null,
|
||||
null,
|
||||
mappedFile.PersonKey,
|
||||
rectangle,
|
||||
wholePercentages.Value));
|
||||
locationContainers.Add(locationContainer);
|
||||
}
|
||||
|
||||
private static ReadOnlyDictionary<int, ReadOnlyDictionary<int, LocationContainer>> GetReadOnly(Dictionary<int, Dictionary<int, LocationContainer>> keyValuePairs)
|
||||
@ -93,33 +94,26 @@ internal abstract class FaceFileLogic
|
||||
{
|
||||
Dictionary<int, Dictionary<int, LocationContainer>> results = [];
|
||||
List<LocationContainer> locationContainers = [];
|
||||
List<string> personKeyFormattedCollection = [];
|
||||
Dictionary<int, LocationContainer>? keyValuePairs;
|
||||
Dictionary<int, List<(string, int)>> skipCollection = [];
|
||||
Dictionary<int, List<(string, int)>> skipNotSkipCollection = [];
|
||||
ReadOnlyCollection<string> readOnlyPersonKeyFormattedCollection;
|
||||
ReadOnlyDictionary<string, string> readOnlyPersonKeyFormattedToNewestPersonKeyFormatted;
|
||||
Dictionary<string, string> personKeyFormattedToNewestPersonKeyFormatted = [];
|
||||
SetSkipCollections(configuration, personContainers, a2PeopleSingletonDirectory, skipCollection, skipNotSkipCollection);
|
||||
{
|
||||
List<string> personKeyFormattedCollection = [];
|
||||
Dictionary<string, string> personKeyFormattedToNewestPersonKeyFormatted = [];
|
||||
SetPersonCollections(configuration, personContainers, personKeyFormattedToNewestPersonKeyFormatted, personKeyFormattedCollection);
|
||||
readOnlyPersonKeyFormattedCollection = new(personKeyFormattedCollection);
|
||||
readOnlyPersonKeyFormattedToNewestPersonKeyFormatted = new(personKeyFormattedToNewestPersonKeyFormatted);
|
||||
}
|
||||
List<Record> records = DistanceLogic.DeleteEmptyDirectoriesAndGetCollection(propertyConfiguration, configuration, ticks, eDistanceContentDirectory, readOnlyPersonKeyFormattedToNewestPersonKeyFormatted, readOnlyPersonKeyFormattedCollection);
|
||||
SetPersonCollectionsAfterSetSkipCollections(configuration, personContainers, personKeyFormattedToNewestPersonKeyFormatted, personKeyFormattedCollection);
|
||||
List<Record> records = DistanceLogic.DeleteEmptyDirectoriesAndGetCollection(propertyConfiguration, configuration, ticks, eDistanceContentDirectory, personKeyFormattedToNewestPersonKeyFormatted.AsReadOnly(), personKeyFormattedCollection.AsReadOnly());
|
||||
List<MappedFile> mappedFiles = GetMappedFiles(propertyConfiguration, configuration, personContainers, records);
|
||||
if (mappedFiles.Count > 0)
|
||||
{
|
||||
int totalSeconds = (int)Math.Floor(new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds);
|
||||
string message = $") Building Mapped Face Files Collection - {totalSeconds} total second(s)";
|
||||
ParallelOptions parallelOptions = new() { MaxDegreeOfParallelism = maxDegreeOfParallelism };
|
||||
ReadOnlyDictionary<int, List<(string, int)>> readOnlySkipNotSkipCollection = new(skipCollection);
|
||||
ProgressBarOptions options = new() { ProgressCharacter = '─', ProgressBarOnBottom = true, DisableBottomPercentage = true };
|
||||
using ProgressBar progressBar = new(mappedFiles.Count, message, options);
|
||||
_ = Parallel.For(0, mappedFiles.Count, parallelOptions, (i, state) =>
|
||||
{
|
||||
progressBar.Tick();
|
||||
MappedParallelFor(propertyConfiguration, configuration, readOnlySkipNotSkipCollection, locationContainers, mappedFiles[i]);
|
||||
MappedParallelFor(propertyConfiguration, configuration, skipCollection.AsReadOnly(), locationContainers, mappedFiles[i]);
|
||||
});
|
||||
}
|
||||
foreach (LocationContainer locationContainer in locationContainers)
|
||||
@ -176,21 +170,22 @@ internal abstract class FaceFileLogic
|
||||
RectangleF? rectangle = ILocation.GetPercentagesRectangle(configuration.LocationDigits, wholePercentages.Value);
|
||||
if (rectangle is null)
|
||||
return;
|
||||
LocationContainer locationContainer = new(dateOnly,
|
||||
exifDirectory,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
faceFile,
|
||||
filePath,
|
||||
fromDistanceContent,
|
||||
filePath.Id.Value,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
rectangle,
|
||||
wholePercentages.Value);
|
||||
lock (locationContainers)
|
||||
locationContainers.Add(new(dateOnly,
|
||||
exifDirectory,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
faceFile,
|
||||
filePath,
|
||||
fromDistanceContent,
|
||||
filePath.Id.Value,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
rectangle,
|
||||
wholePercentages.Value));
|
||||
locationContainers.Add(locationContainer);
|
||||
}
|
||||
|
||||
internal static List<LocationContainer> GetAvailable(int maxDegreeOfParallelism, Configuration configuration, IFaceD dFace, long ticks, ReadOnlyCollection<FilePath> filePaths)
|
||||
|
Reference in New Issue
Block a user