2023-03-18

This commit is contained in:
Mike Phares 2023-03-18 14:58:51 -07:00
parent d38c558128
commit 79bcbf3487
9 changed files with 31 additions and 19 deletions

View File

@ -35,8 +35,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" /> <PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="7.0.3" /> <PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="7.0.3" /> <PackageReference Include="Microsoft.Extensions.Identity.Core" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.1" /> <PackageReference Include="Microsoft.Extensions.Options" Version="7.0.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" /> <PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" /> <PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />

View File

@ -34,9 +34,9 @@
<SupportedPlatform Include="browser" /> <SupportedPlatform Include="browser" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="7.0.3" /> <PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" /> <PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="7.0.3" /> <PackageReference Include="Microsoft.Extensions.Identity.Core" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.1" /> <PackageReference Include="Microsoft.Extensions.Options" Version="7.0.1" />
<PackageReference Include="MetadataExtractor" Version="2.7.2" /> <PackageReference Include="MetadataExtractor" Version="2.7.2" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" /> <PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />

View File

@ -35,8 +35,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" /> <PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="7.0.3" /> <PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="7.0.3" /> <PackageReference Include="Microsoft.Extensions.Identity.Core" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.1" /> <PackageReference Include="Microsoft.Extensions.Options" Version="7.0.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" /> <PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" /> <PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />

View File

@ -35,8 +35,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" /> <PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="7.0.3" /> <PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="7.0.3" /> <PackageReference Include="Microsoft.Extensions.Identity.Core" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.1" /> <PackageReference Include="Microsoft.Extensions.Options" Version="7.0.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" /> <PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" /> <PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />

View File

@ -35,8 +35,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" /> <PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="7.0.3" /> <PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="7.0.3" /> <PackageReference Include="Microsoft.Extensions.Identity.Core" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.1" /> <PackageReference Include="Microsoft.Extensions.Options" Version="7.0.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" /> <PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" /> <PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />

View File

@ -34,9 +34,9 @@
<SupportedPlatform Include="browser" /> <SupportedPlatform Include="browser" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="7.0.3" /> <PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" /> <PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="7.0.3" /> <PackageReference Include="Microsoft.Extensions.Identity.Core" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.1" /> <PackageReference Include="Microsoft.Extensions.Options" Version="7.0.1" />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" /> <PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="System.Text.Json" Version="7.0.2" /> <PackageReference Include="System.Text.Json" Version="7.0.2" />

View File

@ -67,6 +67,7 @@ internal class F_Random
List<string>? collection; List<string>? collection;
string dateFormat = "MM-dd"; string dateFormat = "MM-dd";
List<string> relativePaths = new(); List<string> relativePaths = new();
List<int> distinctCollection = new();
DateTime dateTime = new(2024, 1, 1); //Leap year DateTime dateTime = new(2024, 1, 1); //Leap year
Dictionary<string, List<string>> dayToRelativePaths = Get(personKeyToIds, mappingCollection, dateFormat); Dictionary<string, List<string>> dayToRelativePaths = Get(personKeyToIds, mappingCollection, dateFormat);
string fRandomCollectionDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration, nameof(F_Random), "[]"); string fRandomCollectionDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration, nameof(F_Random), "[]");
@ -75,11 +76,14 @@ internal class F_Random
File.Delete(file); File.Delete(file);
foreach (Shared.Models.Mapping mapping in mappingCollection) foreach (Shared.Models.Mapping mapping in mappingCollection)
{ {
if (distinctCollection.Contains(mapping.MappingFromItem.Id))
continue;
if (mapping.MappingFromItem.ImageFileHolder.DirectoryName is null) if (mapping.MappingFromItem.ImageFileHolder.DirectoryName is null)
continue; continue;
if (mapping.MappingFromFilter.IsIgnoreRelativePath is not null && mapping.MappingFromFilter.IsIgnoreRelativePath.Value) if (mapping.MappingFromFilter.IsIgnoreRelativePath is not null && mapping.MappingFromFilter.IsIgnoreRelativePath.Value)
continue; continue;
relativePaths.Add(mapping.MappingFromItem.RelativePath); relativePaths.Add(mapping.MappingFromItem.RelativePath);
distinctCollection.Add(mapping.MappingFromItem.Id);
} }
if (relativePaths.Any()) if (relativePaths.Any())
{ {

View File

@ -974,16 +974,21 @@ public class MapLogic : Shared.Models.Methods.IMapLogic
if (_Configuration is null) if (_Configuration is null)
throw new NullReferenceException(nameof(_Configuration)); throw new NullReferenceException(nameof(_Configuration));
(int, FileHolder, int, string, string, string, string)[] results; (int, FileHolder, int, string, string, string, string)[] results;
int count = 0;
int group = 65;
string checkFile; string checkFile;
string directory; string directory;
string? directoryName; string? directoryName;
string personDirectory; string personDirectory;
string personKeyFormatted; string personKeyFormatted;
List<int> distinctCollection = new();
bool usePersonKeyAndDeterministicHashCodeKey = false; bool usePersonKeyAndDeterministicHashCodeKey = false;
List<string> personKeyFormattedCollection = GetPersonKeyFormattedCollection(jLinks, a2PeopleContentDirectory, personContainers, personKeyToIds); List<string> personKeyFormattedCollection = GetPersonKeyFormattedCollection(jLinks, a2PeopleContentDirectory, personContainers, personKeyToIds);
List<(int Id, FileHolder ImageFileHolder, int ApproximateYears, string PersonKeyFormatted, string CheckFile, string Directory, string PersonDirectory)> collection = new(); List<(int Id, FileHolder ImageFileHolder, int ApproximateYears, string PersonKeyFormatted, string CheckFile, string Directory, string PersonDirectory)> collection = new();
foreach (Mapping mapping in mappingCollection) foreach (Mapping mapping in mappingCollection)
{ {
if (distinctCollection.Contains(mapping.MappingFromItem.Id))
continue;
directoryName = Path.GetDirectoryName(mapping.MappingFromItem.RelativePath); directoryName = Path.GetDirectoryName(mapping.MappingFromItem.RelativePath);
if (directoryName is null) if (directoryName is null)
throw new NotSupportedException(); throw new NotSupportedException();
@ -1002,7 +1007,12 @@ public class MapLogic : Shared.Models.Methods.IMapLogic
continue; continue;
if (!usePersonKeyAndDeterministicHashCodeKey) if (!usePersonKeyAndDeterministicHashCodeKey)
{ {
directory = Path.Combine(_EDistanceContentTicksDirectory, "Images"); if (count > 499)
{
count = 0;
group += 1;
}
directory = Path.Combine(_EDistanceContentTicksDirectory, ((char)group).ToString());
personDirectory = Path.Combine(directory, mapping.MappingFromPerson.DisplayDirectoryName); personDirectory = Path.Combine(directory, mapping.MappingFromPerson.DisplayDirectoryName);
checkFile = Path.Combine(directory, $"{mapping.MappingFromItem.Id}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}"); checkFile = Path.Combine(directory, $"{mapping.MappingFromItem.Id}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}");
} }
@ -1013,6 +1023,8 @@ public class MapLogic : Shared.Models.Methods.IMapLogic
checkFile = Path.Combine(directory, $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}"); checkFile = Path.Combine(directory, $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}");
} }
collection.Add(new(mapping.MappingFromItem.Id, mapping.MappingFromItem.ImageFileHolder, mapping.MappingFromPerson.ApproximateYears.Value, personKeyFormatted, directory, personDirectory, checkFile)); collection.Add(new(mapping.MappingFromItem.Id, mapping.MappingFromItem.ImageFileHolder, mapping.MappingFromPerson.ApproximateYears.Value, personKeyFormatted, directory, personDirectory, checkFile));
distinctCollection.Add(mapping.MappingFromItem.Id);
count += 1;
} }
results = (from l in collection orderby l.ApproximateYears descending, l.PersonKeyFormatted descending select l).ToArray(); results = (from l in collection orderby l.ApproximateYears descending, l.PersonKeyFormatted descending select l).ToArray();
return results; return results;
@ -1074,15 +1086,11 @@ public class MapLogic : Shared.Models.Methods.IMapLogic
if (_Configuration is null) if (_Configuration is null)
throw new NullReferenceException(nameof(_Configuration)); throw new NullReferenceException(nameof(_Configuration));
SaveContainer? saveContainer; SaveContainer? saveContainer;
List<int> distinctCollection = new();
List<SaveContainer> saveContainers = new(); List<SaveContainer> saveContainers = new();
BeforeSaveFilteredOriginalImagesFromJLinks(jLinks, a2PeopleContentDirectory); BeforeSaveFilteredOriginalImagesFromJLinks(jLinks, a2PeopleContentDirectory);
(int, FileHolder, int, string, string, string, string)[] collection = GetCollectionForSaveFilteredOriginalImagesFromJLinks(jLinks, a2PeopleContentDirectory, personContainers, mappingCollection, personKeyToIds); (int, FileHolder, int, string, string, string, string)[] collection = GetCollectionForSaveFilteredOriginalImagesFromJLinks(jLinks, a2PeopleContentDirectory, personContainers, mappingCollection, personKeyToIds);
foreach ((int id, FileHolder imageFileHolder, int approximateYears, string personKeyFormatted, string directory, string personDirectory, string checkFile) in collection) foreach ((int id, FileHolder imageFileHolder, int approximateYears, string personKeyFormatted, string directory, string personDirectory, string checkFile) in collection)
{ {
if (distinctCollection.Contains(id))
continue;
distinctCollection.Add(id);
saveContainer = new(personDirectory); saveContainer = new(personDirectory);
saveContainers.Add(saveContainer); saveContainers.Add(saveContainer);
saveContainer = new(imageFileHolder, checkFile, directory); saveContainer = new(imageFileHolder, checkFile, directory);

View File

@ -43,8 +43,8 @@
<PackageReference Include="System.Drawing.Common" Version="7.0.0" /> <PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="System.Text.Json" Version="7.0.2" /> <PackageReference Include="System.Text.Json" Version="7.0.2" />
<PackageReference Include="MetadataExtractor" Version="2.7.2" /> <PackageReference Include="MetadataExtractor" Version="2.7.2" />
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="7.0.3" /> <PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="7.0.3" /> <PackageReference Include="Microsoft.Extensions.Identity.Core" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.1" /> <PackageReference Include="Microsoft.Extensions.Options" Version="7.0.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>