House Cleaning

This commit is contained in:
2025-07-05 19:54:45 -07:00
parent 30d8a270f9
commit 1ede3ebcdb
25 changed files with 445 additions and 145 deletions

View File

@ -89,10 +89,32 @@
"PropertiesChangedForProperty": false, "PropertiesChangedForProperty": false,
"RootDirectory": "C:/Tmp/Phares/Compare/Images-dd514b88", "RootDirectory": "C:/Tmp/Phares/Compare/Images-dd514b88",
"IgnoreExtensions": [ "IgnoreExtensions": [
".ffs_db",
".FFS_DB",
".gif", ".gif",
".GIF", ".GIF",
".html",
".HTML",
".ico",
".ICO",
".json",
".JSON",
".lnk",
".LNK",
".lsv",
".LSV",
".nef",
".NEF",
".pdf", ".pdf",
".PDF" ".PDF",
".ts",
".TS",
".txt",
".TXT",
".webp",
".WEBP",
".xmp",
".XMP"
], ],
"PropertyContentCollectionFiles": [ "PropertyContentCollectionFiles": [
"/Images-ec5a909 - Results/A) Property/2022-12-30/[()]/637869381676042455.json", "/Images-ec5a909 - Results/A) Property/2022-12-30/[()]/637869381676042455.json",
@ -117,7 +139,9 @@
".tiff", ".tiff",
".TIFF", ".TIFF",
".tif", ".tif",
".TIF" ".TIF",
".webp",
".WEBP"
], ],
"VerifyToSeason": [ "VerifyToSeason": [
". 2000", ". 2000",

View File

@ -90,12 +90,32 @@
"/zzz Phares Slides/Slides 2015-06-10/Magazine 01" "/zzz Phares Slides/Slides 2015-06-10/Magazine 01"
], ],
"IgnoreExtensions": [ "IgnoreExtensions": [
".ffs_db",
".FFS_DB",
".gif", ".gif",
".GIF", ".GIF",
".html",
".HTML",
".ico",
".ICO",
".json",
".JSON",
".lnk",
".LNK",
".lsv",
".LSV",
".nef", ".nef",
".NEF", ".NEF",
".pdf", ".pdf",
".PDF" ".PDF",
".ts",
".TS",
".txt",
".TXT",
".webp",
".WEBP",
".xmp",
".XMP"
], ],
"PropertyContentCollectionFiles": [ "PropertyContentCollectionFiles": [
"/Images-ec5a909 - Results/A) Property/2022-12-30/[()]/637869381676042455.json", "/Images-ec5a909 - Results/A) Property/2022-12-30/[()]/637869381676042455.json",
@ -120,7 +140,9 @@
".tiff", ".tiff",
".TIFF", ".TIFF",
".tif", ".tif",
".TIF" ".TIF",
".webp",
".WEBP"
], ],
"VerifyToSeason": [ "VerifyToSeason": [
". 2000", ". 2000",

View File

@ -71,12 +71,32 @@
"ResultSingleton": "{}", "ResultSingleton": "{}",
"RootDirectory": "D:/Images", "RootDirectory": "D:/Images",
"IgnoreExtensions": [ "IgnoreExtensions": [
".ffs_db",
".FFS_DB",
".gif", ".gif",
".GIF", ".GIF",
".html",
".HTML",
".ico",
".ICO",
".json",
".JSON",
".lnk",
".LNK",
".lsv",
".LSV",
".nef", ".nef",
".NEF", ".NEF",
".pdf", ".pdf",
".PDF" ".PDF",
".ts",
".TS",
".txt",
".TXT",
".webp",
".WEBP",
".xmp",
".XMP"
], ],
"ValidImageFormatExtensions": [ "ValidImageFormatExtensions": [
".bmp", ".bmp",
@ -92,7 +112,9 @@
".tiff", ".tiff",
".TIFF", ".TIFF",
".tif", ".tif",
".TIF" ".TIF",
".webp",
".WEBP"
] ]
} }
} }

View File

@ -70,12 +70,32 @@
"ResultSingleton": "{}", "ResultSingleton": "{}",
"RootDirectory": "C:/Tmp/phares/Pictures", "RootDirectory": "C:/Tmp/phares/Pictures",
"IgnoreExtensions": [ "IgnoreExtensions": [
".ffs_db",
".FFS_DB",
".gif", ".gif",
".GIF", ".GIF",
".html",
".HTML",
".ico",
".ICO",
".json",
".JSON",
".lnk",
".LNK",
".lsv",
".LSV",
".nef", ".nef",
".NEF", ".NEF",
".pdf", ".pdf",
".PDF" ".PDF",
".ts",
".TS",
".txt",
".TXT",
".webp",
".WEBP",
".xmp",
".XMP"
], ],
"PropertyContentCollectionFiles": [], "PropertyContentCollectionFiles": [],
"ValidImageFormatExtensions": [ "ValidImageFormatExtensions": [
@ -92,7 +112,9 @@
".tiff", ".tiff",
".TIFF", ".TIFF",
".tif", ".tif",
".TIF" ".TIF",
".webp",
".WEBP"
], ],
"VerifyToSeason": [ "VerifyToSeason": [
". 2000", ". 2000",

View File

@ -72,12 +72,32 @@
"ResultSingleton": "{}", "ResultSingleton": "{}",
"RootDirectory": "C:/Tmp/Phares/Compare/Images-dd514b88", "RootDirectory": "C:/Tmp/Phares/Compare/Images-dd514b88",
"IgnoreExtensions": [ "IgnoreExtensions": [
".ffs_db",
".FFS_DB",
".gif", ".gif",
".GIF", ".GIF",
".html",
".HTML",
".ico",
".ICO",
".json",
".JSON",
".lnk",
".LNK",
".lsv",
".LSV",
".nef", ".nef",
".NEF", ".NEF",
".pdf", ".pdf",
".PDF" ".PDF",
".ts",
".TS",
".txt",
".TXT",
".webp",
".WEBP",
".xmp",
".XMP"
], ],
"ValidImageFormatExtensions": [ "ValidImageFormatExtensions": [
".bmp", ".bmp",
@ -93,7 +113,9 @@
".tiff", ".tiff",
".TIFF", ".TIFF",
".tif", ".tif",
".TIF" ".TIF",
".webp",
".WEBP"
] ]
} }
} }

View File

@ -67,12 +67,32 @@
"ResultSingleton": "{}", "ResultSingleton": "{}",
"RootDirectory": "C:/Tmp/Phares/Compare/Images-dd514b88", "RootDirectory": "C:/Tmp/Phares/Compare/Images-dd514b88",
"IgnoreExtensions": [ "IgnoreExtensions": [
".ffs_db",
".FFS_DB",
".gif", ".gif",
".GIF", ".GIF",
".html",
".HTML",
".ico",
".ICO",
".json",
".JSON",
".lnk",
".LNK",
".lsv",
".LSV",
".nef", ".nef",
".NEF", ".NEF",
".pdf", ".pdf",
".PDF" ".PDF",
".ts",
".TS",
".txt",
".TXT",
".webp",
".WEBP",
".xmp",
".XMP"
], ],
"ValidImageFormatExtensions": [ "ValidImageFormatExtensions": [
".bmp", ".bmp",
@ -88,7 +108,9 @@
".tiff", ".tiff",
".TIFF", ".TIFF",
".tif", ".tif",
".TIF" ".TIF",
".webp",
".WEBP"
] ]
} }
} }

View File

@ -68,12 +68,32 @@
"ResultSingleton": "{}", "ResultSingleton": "{}",
"RootDirectory": "C:/Tmp/Phares/Compare/Images-dd514b88", "RootDirectory": "C:/Tmp/Phares/Compare/Images-dd514b88",
"IgnoreExtensions": [ "IgnoreExtensions": [
".ffs_db",
".FFS_DB",
".gif", ".gif",
".GIF", ".GIF",
".html",
".HTML",
".ico",
".ICO",
".json",
".JSON",
".lnk",
".LNK",
".lsv",
".LSV",
".nef", ".nef",
".NEF", ".NEF",
".pdf", ".pdf",
".PDF" ".PDF",
".ts",
".TS",
".txt",
".TXT",
".webp",
".WEBP",
".xmp",
".XMP"
], ],
"ValidImageFormatExtensions": [ "ValidImageFormatExtensions": [
".bmp", ".bmp",
@ -89,7 +109,9 @@
".tiff", ".tiff",
".TIFF", ".TIFF",
".tif", ".tif",
".TIF" ".TIF",
".webp",
".WEBP"
] ]
} }
} }

View File

@ -475,7 +475,7 @@ public class D_Face : IFaceD
dFace.ReSaveFace(exifDirectory, filePath, face, mappedFile: false); dFace.ReSaveFace(exifDirectory, filePath, face, mappedFile: false);
continue; continue;
} }
location = Shared.Models.Stateless.Methods.ILocation.GetLocation(face.Location, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, source.Height, source.Width, collection.Count); location = Shared.Models.Stateless.Methods.ILocation.GetLocation(face.Location, source.Height, source.Width, collection.Count);
if (location is null) if (location is null)
continue; continue;
width = location.Right - location.Left; width = location.Right - location.Left;
@ -506,7 +506,7 @@ public class D_Face : IFaceD
} }
if (File.Exists(fileName)) if (File.Exists(fileName))
File.Delete(fileName); File.Delete(fileName);
location = Shared.Models.Stateless.Methods.ILocation.GetLocation(_FaceDistanceHiddenImageFactor, face.Location, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, source.Height, source.Width, collection.Count); location = Shared.Models.Stateless.Methods.ILocation.GetLocation(_FaceDistanceHiddenImageFactor, face.Location, source.Height, source.Width, collection.Count);
if (location is null) if (location is null)
continue; continue;
width = location.Right - location.Left; width = location.Right - location.Left;

View File

@ -31,6 +31,8 @@ public partial class DlibDotNet : IDlibDotNet, IDisposable
ReadOnlyCollection<ReadOnlyCollection<FilePath>> FilePathsCollection, ReadOnlyCollection<ReadOnlyCollection<FilePath>> FilePathsCollection,
ReadOnlyDictionary<int, Identifier>? SplatNineIdentifiers); ReadOnlyDictionary<int, Identifier>? SplatNineIdentifiers);
public int? CurrentTick =>
_ProgressBar?.CurrentTick;
public long Ticks { get; init; } public long Ticks { get; init; }
private readonly D_Face _Faces; private readonly D_Face _Faces;
@ -1314,7 +1316,7 @@ public partial class DlibDotNet : IDlibDotNet, IDisposable
} }
} }
if (items.Count > 0) if (items.Count > 0)
throw new Exception($"{items.Count} item(s) of {count} item(s) are not setup!"); throw new Exception($"{items.Count} item(s) of {count} item(s) are not setup!{Environment.NewLine}{string.Join(Environment.NewLine, items.Select(l => l.FilePath.FileNameFirstSegment))}");
} }
private Record GetFilesCollectionThenCopyOrMove(IDlibDotNet dlibDotNet, B_Metadata metadata, string fileSearchFilter, string directorySearchFilter, string bResultsFullGroupDirectory, string outputResolution) private Record GetFilesCollectionThenCopyOrMove(IDlibDotNet dlibDotNet, B_Metadata metadata, string fileSearchFilter, string directorySearchFilter, string bResultsFullGroupDirectory, string outputResolution)

View File

@ -64,20 +64,19 @@ internal abstract class FaceFileLogic
exifDirectory = Metadata.Models.Stateless.Methods.IMetadata.GetExifDirectory(mappedFile.FilePath); exifDirectory = Metadata.Models.Stateless.Methods.IMetadata.GetExifDirectory(mappedFile.FilePath);
RectangleF? rectangle = ILocation.GetPercentagesRectangle(configuration.LocationDigits, wholePercentages.Value); RectangleF? rectangle = ILocation.GetPercentagesRectangle(configuration.LocationDigits, wholePercentages.Value);
personDisplayDirectoryName = mappedFile.PersonDisplayDirectoryName is null ? configuration.MappingDefaultName : mappedFile.PersonDisplayDirectoryName; personDisplayDirectoryName = mappedFile.PersonDisplayDirectoryName is null ? configuration.MappingDefaultName : mappedFile.PersonDisplayDirectoryName;
LocationContainer locationContainer = new(dateOnly, LocationContainer locationContainer = new(CreationDateOnly: dateOnly,
exifDirectory, ExifDirectory: exifDirectory,
mappedFile.DirectoryNumber, DirectoryNumber: mappedFile.DirectoryNumber,
personDisplayDirectoryName, DisplayDirectoryName: personDisplayDirectoryName,
null, Encoding: null,
null, FaceFile: null,
mappedFile.FilePath, FilePath: mappedFile.FilePath,
fromDistanceContent, FromDistanceContent: fromDistanceContent,
id.Value, Id: id.Value,
null, LengthPermyriad: null,
null, LengthSource: null,
mappedFile.PersonKey, PersonKey: mappedFile.PersonKey,
rectangle, WholePercentages: wholePercentages.Value);
wholePercentages.Value);
lock (locationContainers) lock (locationContainers)
locationContainers.Add(locationContainer); locationContainers.Add(locationContainer);
} }
@ -167,23 +166,19 @@ internal abstract class FaceFileLogic
MoveUnableToMatch(filePath); MoveUnableToMatch(filePath);
return; return;
} }
RectangleF? rectangle = ILocation.GetPercentagesRectangle(configuration.LocationDigits, wholePercentages.Value); LocationContainer locationContainer = new(CreationDateOnly: dateOnly,
if (rectangle is null) ExifDirectory: exifDirectory,
return; DirectoryNumber: null,
LocationContainer locationContainer = new(dateOnly, DisplayDirectoryName: null,
exifDirectory, Encoding: null,
null, FaceFile: faceFile,
null, FilePath: filePath,
null, FromDistanceContent: fromDistanceContent,
faceFile, Id: filePath.Id.Value,
filePath, LengthPermyriad: null,
fromDistanceContent, LengthSource: null,
filePath.Id.Value, PersonKey: null,
null, WholePercentages: wholePercentages.Value);
null,
null,
rectangle,
wholePercentages.Value);
lock (locationContainers) lock (locationContainers)
locationContainers.Add(locationContainer); locationContainers.Add(locationContainer);
} }

View File

@ -1152,22 +1152,20 @@ internal abstract class MapLogic
exifDirectory = null; exifDirectory = null;
else else
exifDirectory = Metadata.Models.Stateless.Methods.IMetadata.GetExifDirectory(mappedFile.FilePath); 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; personDisplayDirectoryName = mappedFile.PersonDisplayDirectoryName is null ? configuration.MappingDefaultName : mappedFile.PersonDisplayDirectoryName;
LocationContainer locationContainer = new(dateOnly, LocationContainer locationContainer = new(CreationDateOnly: dateOnly,
exifDirectory, ExifDirectory: exifDirectory,
mappedFile.DirectoryNumber, DirectoryNumber: mappedFile.DirectoryNumber,
personDisplayDirectoryName, DisplayDirectoryName: personDisplayDirectoryName,
null, Encoding: null,
null, FaceFile: null,
mappedFile.FilePath, FilePath: mappedFile.FilePath,
fromDistanceContent, FromDistanceContent: fromDistanceContent,
id.Value, Id: id.Value,
null, LengthPermyriad: null,
null, LengthSource: null,
mappedFile.PersonKey, PersonKey: mappedFile.PersonKey,
rectangle, WholePercentages: wholePercentages.Value);
wholePercentages.Value);
lock (locationContainers) lock (locationContainers)
locationContainers.Add(locationContainer); locationContainers.Add(locationContainer);
} }
@ -1192,12 +1190,18 @@ internal abstract class MapLogic
if (item.WholePercentages == locationContainer.WholePercentages) if (item.WholePercentages == locationContainer.WholePercentages)
continue; continue;
itemPercentagesRectangle = ILocation.GetPercentagesRectangle(configuration.LocationDigits, item.WholePercentages); itemPercentagesRectangle = ILocation.GetPercentagesRectangle(configuration.LocationDigits, item.WholePercentages);
if (itemPercentagesRectangle is null || locationContainer.Rectangle is null) if (itemPercentagesRectangle is null)
percent = null;
else
{
RectangleF? rectangle = ILocation.GetPercentagesRectangle(configuration.LocationDigits, item.WholePercentages);
if (rectangle is null)
percent = null; percent = null;
else else
{ {
itemPercentagesArea = itemPercentagesRectangle.Value.Width * itemPercentagesRectangle.Value.Height; itemPercentagesArea = itemPercentagesRectangle.Value.Width * itemPercentagesRectangle.Value.Height;
percent = ILocation.GetIntersectPercent(itemPercentagesRectangle.Value, itemPercentagesArea, locationContainer.Rectangle.Value); percent = ILocation.GetIntersectPercent(itemPercentagesRectangle.Value, itemPercentagesArea, rectangle.Value);
}
} }
delete.Add(item.FilePath); delete.Add(item.FilePath);
delete.Add(locationContainer.FilePath); delete.Add(locationContainer.FilePath);

View File

@ -68,12 +68,32 @@
"ResultSingleton": "{}", "ResultSingleton": "{}",
"RootDirectory": "D:/Images", "RootDirectory": "D:/Images",
"IgnoreExtensions": [ "IgnoreExtensions": [
".ffs_db",
".FFS_DB",
".gif", ".gif",
".GIF", ".GIF",
".html",
".HTML",
".ico",
".ICO",
".json",
".JSON",
".lnk",
".LNK",
".lsv",
".LSV",
".nef", ".nef",
".NEF", ".NEF",
".pdf", ".pdf",
".PDF" ".PDF",
".ts",
".TS",
".txt",
".TXT",
".webp",
".WEBP",
".xmp",
".XMP"
], ],
"ValidImageFormatExtensions": [ "ValidImageFormatExtensions": [
".bmp", ".bmp",
@ -89,7 +109,9 @@
".tiff", ".tiff",
".TIFF", ".TIFF",
".tif", ".tif",
".TIF" ".TIF",
".webp",
".WEBP"
] ]
} }
} }

View File

@ -68,12 +68,32 @@
"ResultSingleton": "{}", "ResultSingleton": "{}",
"RootDirectory": "D:/Images", "RootDirectory": "D:/Images",
"IgnoreExtensions": [ "IgnoreExtensions": [
".ffs_db",
".FFS_DB",
".gif", ".gif",
".GIF", ".GIF",
".html",
".HTML",
".ico",
".ICO",
".json",
".JSON",
".lnk",
".LNK",
".lsv",
".LSV",
".nef", ".nef",
".NEF", ".NEF",
".pdf", ".pdf",
".PDF" ".PDF",
".ts",
".TS",
".txt",
".TXT",
".webp",
".WEBP",
".xmp",
".XMP"
], ],
"ValidImageFormatExtensions": [ "ValidImageFormatExtensions": [
".bmp", ".bmp",
@ -89,7 +109,9 @@
".tiff", ".tiff",
".TIFF", ".TIFF",
".tif", ".tif",
".TIF" ".TIF",
".webp",
".WEBP"
] ]
} }
} }

View File

@ -67,12 +67,32 @@
"ResultSingleton": "{}", "ResultSingleton": "{}",
"RootDirectory": "D:/Images", "RootDirectory": "D:/Images",
"IgnoreExtensions": [ "IgnoreExtensions": [
".ffs_db",
".FFS_DB",
".gif", ".gif",
".GIF", ".GIF",
".html",
".HTML",
".ico",
".ICO",
".json",
".JSON",
".lnk",
".LNK",
".lsv",
".LSV",
".nef", ".nef",
".NEF", ".NEF",
".pdf", ".pdf",
".PDF" ".PDF",
".ts",
".TS",
".txt",
".TXT",
".webp",
".WEBP",
".xmp",
".XMP"
], ],
"ValidImageFormatExtensions": [ "ValidImageFormatExtensions": [
".bmp", ".bmp",
@ -88,7 +108,9 @@
".tiff", ".tiff",
".TIFF", ".TIFF",
".tif", ".tif",
".TIF" ".TIF",
".webp",
".WEBP"
] ]
} }
} }

View File

@ -60,12 +60,32 @@
"PropertiesChangedForProperty": false, "PropertiesChangedForProperty": false,
"RootDirectory": "C:/Tmp/Phares/Pictures", "RootDirectory": "C:/Tmp/Phares/Pictures",
"IgnoreExtensions": [ "IgnoreExtensions": [
".ffs_db",
".FFS_DB",
".gif", ".gif",
".GIF", ".GIF",
".html",
".HTML",
".ico",
".ICO",
".json",
".JSON",
".lnk",
".LNK",
".lsv",
".LSV",
".nef", ".nef",
".NEF", ".NEF",
".pdf", ".pdf",
".PDF" ".PDF",
".ts",
".TS",
".txt",
".TXT",
".webp",
".WEBP",
".xmp",
".XMP"
], ],
"PropertyContentCollectionFiles": [], "PropertyContentCollectionFiles": [],
"Spelling": [ "Spelling": [
@ -108,7 +128,9 @@
".tiff", ".tiff",
".TIFF", ".TIFF",
".tif", ".tif",
".TIF" ".TIF",
".webp",
".WEBP"
], ],
"VerifyToSeason": [ "VerifyToSeason": [
". 2000", ". 2000",

View File

@ -82,12 +82,32 @@
"xxxRootDirectory": "D:/1-Images-A/Images-dd514b88/Facebook/2023.3 Facebook", "xxxRootDirectory": "D:/1-Images-A/Images-dd514b88/Facebook/2023.3 Facebook",
"RootDirectory": "D:/7-Question/California", "RootDirectory": "D:/7-Question/California",
"IgnoreExtensions": [ "IgnoreExtensions": [
".ffs_db",
".FFS_DB",
".gif", ".gif",
".GIF", ".GIF",
".html",
".HTML",
".ico",
".ICO",
".json",
".JSON",
".lnk",
".LNK",
".lsv",
".LSV",
".nef", ".nef",
".NEF", ".NEF",
".pdf", ".pdf",
".PDF" ".PDF",
".ts",
".TS",
".txt",
".TXT",
".webp",
".WEBP",
".xmp",
".XMP"
], ],
"ValidImageFormatExtensions": [ "ValidImageFormatExtensions": [
".bmp", ".bmp",
@ -103,7 +123,9 @@
".tiff", ".tiff",
".TIFF", ".TIFF",
".tif", ".tif",
".TIF" ".TIF",
".webp",
".WEBP"
] ]
} }
}, },

View File

@ -69,12 +69,32 @@
"ResultSingleton": "{}", "ResultSingleton": "{}",
"RootDirectory": "D:/Images", "RootDirectory": "D:/Images",
"IgnoreExtensions": [ "IgnoreExtensions": [
".ffs_db",
".FFS_DB",
".gif", ".gif",
".GIF", ".GIF",
".html",
".HTML",
".ico",
".ICO",
".json",
".JSON",
".lnk",
".LNK",
".lsv",
".LSV",
".nef", ".nef",
".NEF", ".NEF",
".pdf", ".pdf",
".PDF" ".PDF",
".ts",
".TS",
".txt",
".TXT",
".webp",
".WEBP",
".xmp",
".XMP"
], ],
"ValidImageFormatExtensions": [ "ValidImageFormatExtensions": [
".bmp", ".bmp",
@ -90,7 +110,9 @@
".tiff", ".tiff",
".TIFF", ".TIFF",
".tif", ".tif",
".TIF" ".TIF",
".webp",
".WEBP"
] ]
} }
} }

View File

@ -23,7 +23,7 @@ public class Location : Properties.ILocation, IEquatable<Location>
_ = Stateless.Methods.Location.Check(bottom, left, right, top, zCount: 1, throwException: true); _ = Stateless.Methods.Location.Check(bottom, left, right, top, zCount: 1, throwException: true);
} }
public Location(double confidence, int height, Location location, int locationDigits, int locationFactor, int width, int zCount) : public Location(double confidence, int height, Location location, int width, int zCount) :
this( this(
location.Bottom, location.Bottom,
confidence, confidence,
@ -32,7 +32,7 @@ public class Location : Properties.ILocation, IEquatable<Location>
location.Top) => location.Top) =>
Stateless.Methods.Location.Check(Bottom, height, Left, Right, Top, width, zCount, throwException: true); Stateless.Methods.Location.Check(Bottom, height, Left, Right, Top, width, zCount, throwException: true);
public Location(int bottom, double confidence, int height, int left, int locationDigits, int locationFactor, int right, int top, int width, int zCount) : public Location(int bottom, double confidence, int height, int left, int right, int top, int width, int zCount) :
this( this(
bottom, bottom,
confidence, confidence,
@ -41,7 +41,7 @@ public class Location : Properties.ILocation, IEquatable<Location>
top) => top) =>
Stateless.Methods.Location.Check(Bottom, height, Left, Right, Top, width, zCount, throwException: true); Stateless.Methods.Location.Check(Bottom, height, Left, Right, Top, width, zCount, throwException: true);
public Location(int height, Location location, int locationDigits, int locationFactor, int width, int zCount) : public Location(int height, Location location, int width, int zCount) :
this( this(
location.Bottom, location.Bottom,
location.Confidence, location.Confidence,
@ -50,7 +50,7 @@ public class Location : Properties.ILocation, IEquatable<Location>
location.Top) => location.Top) =>
Stateless.Methods.Location.Check(Bottom, height, Left, Right, Top, width, zCount, throwException: true); Stateless.Methods.Location.Check(Bottom, height, Left, Right, Top, width, zCount, throwException: true);
public Location(double confidence, int factor, int height, Location location, int locationDigits, int locationFactor, int width, int zCount) public Location(double confidence, int factor, int height, Location location, int width, int zCount)
{ {
int x = (location.Right - location.Left) / factor; int x = (location.Right - location.Left) / factor;
int y = (location.Bottom - location.Top) / factor; int y = (location.Bottom - location.Top) / factor;

View File

@ -1,5 +1,3 @@
using System.Drawing;
namespace View_by_Distance.Shared.Models; namespace View_by_Distance.Shared.Models;
public record LocationContainer(DateOnly CreationDateOnly, public record LocationContainer(DateOnly CreationDateOnly,
@ -14,47 +12,44 @@ public record LocationContainer(DateOnly CreationDateOnly,
int? LengthPermyriad, int? LengthPermyriad,
FilePath? LengthSource, FilePath? LengthSource,
long? PersonKey, long? PersonKey,
RectangleF? Rectangle,
int WholePercentages) int WholePercentages)
{ {
public static LocationContainer Get(LocationContainer locationContainer, object? encoding, bool keepExifDirectory) public static LocationContainer Get(LocationContainer locationContainer, object? encoding, bool keepExifDirectory)
{ {
LocationContainer result; LocationContainer result;
result = new(locationContainer.CreationDateOnly, result = new(CreationDateOnly: locationContainer.CreationDateOnly,
keepExifDirectory ? locationContainer.ExifDirectory : null, ExifDirectory: keepExifDirectory ? locationContainer.ExifDirectory : null,
locationContainer.DirectoryNumber, DirectoryNumber: locationContainer.DirectoryNumber,
locationContainer.DisplayDirectoryName, DisplayDirectoryName: locationContainer.DisplayDirectoryName,
encoding, Encoding: encoding,
locationContainer.FaceFile, FaceFile: locationContainer.FaceFile,
locationContainer.FilePath, FilePath: locationContainer.FilePath,
locationContainer.FromDistanceContent, FromDistanceContent: locationContainer.FromDistanceContent,
locationContainer.Id, Id: locationContainer.Id,
locationContainer.LengthPermyriad, LengthPermyriad: locationContainer.LengthPermyriad,
locationContainer.LengthSource, LengthSource: locationContainer.LengthSource,
locationContainer.PersonKey, PersonKey: locationContainer.PersonKey,
locationContainer.Rectangle, WholePercentages: locationContainer.WholePercentages);
locationContainer.WholePercentages);
return result; return result;
} }
public static LocationContainer Get(LocationContainer source, LocationContainer locationContainer, int lengthPermyriad, bool keepExifDirectory, bool keepEncoding) public static LocationContainer Get(LocationContainer source, LocationContainer locationContainer, int lengthPermyriad, bool keepExifDirectory, bool keepEncoding)
{ {
LocationContainer result; LocationContainer result;
result = new(locationContainer.CreationDateOnly, result = new(CreationDateOnly: locationContainer.CreationDateOnly,
keepExifDirectory ? locationContainer.ExifDirectory : null, ExifDirectory: keepExifDirectory ? locationContainer.ExifDirectory : null,
locationContainer.DirectoryNumber, DirectoryNumber: locationContainer.DirectoryNumber,
locationContainer.DisplayDirectoryName, DisplayDirectoryName: locationContainer.DisplayDirectoryName,
keepEncoding ? locationContainer.Encoding : null, Encoding: keepEncoding ? locationContainer.Encoding : null,
locationContainer.FaceFile, FaceFile: locationContainer.FaceFile,
locationContainer.FilePath, FilePath: locationContainer.FilePath,
locationContainer.FromDistanceContent, FromDistanceContent: locationContainer.FromDistanceContent,
locationContainer.Id, Id: locationContainer.Id,
lengthPermyriad, LengthPermyriad: lengthPermyriad,
source.FilePath, LengthSource: source.FilePath,
locationContainer.PersonKey, PersonKey: locationContainer.PersonKey,
locationContainer.Rectangle, WholePercentages: locationContainer.WholePercentages);
locationContainer.WholePercentages);
return result; return result;
} }

View File

@ -5,6 +5,7 @@ public interface IDlibDotNet
void Tick(); void Tick();
long Ticks { get; } long Ticks { get; }
int? CurrentTick { get; }
(string, string) GetResultsFullGroupDirectories(); (string, string) GetResultsFullGroupDirectories();
void ConstructProgressBar(int maxTicks, string message); void ConstructProgressBar(int maxTicks, string message);
(string, string, string, string) GetResultsFullGroupDirectories(string outputResolution); (string, string, string, string) GetResultsFullGroupDirectories(string outputResolution);

View File

@ -55,15 +55,15 @@ public interface ILocation
static string GetLeftPadded(int locationDigits, int value) => static string GetLeftPadded(int locationDigits, int value) =>
GetLeftPadded(locationDigits, value.ToString()); GetLeftPadded(locationDigits, value.ToString());
Models.Location? TestStatic_GetLocation(Models.Location? location, int locationDigits, int locationFactor, int height, int width, int zCount) => Models.Location? TestStatic_GetLocation(Models.Location? location, int height, int width, int zCount) =>
GetLocation(location, locationDigits, locationFactor, height, width, zCount); GetLocation(location, height, width, zCount);
static Models.Location? GetLocation(Models.Location? location, int locationDigits, int locationFactor, int height, int width, int zCount) => static Models.Location? GetLocation(Models.Location? location, int height, int width, int zCount) =>
location is null ? null : new(location.Confidence, height, location, locationDigits, locationFactor, width, zCount); location is null ? null : new(location.Confidence, height, location, width, zCount);
Models.Location? TestStatic_GetLocation(int factor, Models.Location? location, int locationDigits, int locationFactor, int height, int width, int zCount) => Models.Location? TestStatic_GetLocation(int factor, Models.Location? location, int height, int width, int zCount) =>
GetLocation(factor, location, locationDigits, locationFactor, height, width, zCount); GetLocation(factor, location, height, width, zCount);
static Models.Location? GetLocation(int factor, Models.Location? location, int locationDigits, int locationFactor, int height, int width, int zCount) => static Models.Location? GetLocation(int factor, Models.Location? location, int height, int width, int zCount) =>
location is null ? null : new(location.Confidence, factor, height, location, locationDigits, locationFactor, width, zCount); location is null ? null : new(location.Confidence, factor, height, location, width, zCount);
(decimal?, decimal?, decimal?, decimal?) TestStatic_GetHeightLeftTopWidth(int bottom, int height, int left, int right, int top, int width) => (decimal?, decimal?, decimal?, decimal?) TestStatic_GetHeightLeftTopWidth(int bottom, int height, int left, int right, int top, int width) =>
GetHeightLeftTopWidth(bottom, height, left, right, top, width); GetHeightLeftTopWidth(bottom, height, left, right, top, width);
@ -107,8 +107,6 @@ public interface ILocation
detectionConfidence, detectionConfidence,
height, height,
Math.Max(rectangle.Left, 0), Math.Max(rectangle.Left, 0),
Stateless.ILocation.Digits,
Stateless.ILocation.Factor,
Math.Min(rectangle.Right, width), Math.Min(rectangle.Right, width),
Math.Max(rectangle.Top, 0), Math.Max(rectangle.Top, 0),
width, width,

View File

@ -1,4 +1,5 @@
using System.Text; using System.Text;
using View_by_Distance.Shared.Models.Properties;
namespace View_by_Distance.Shared.Models.Stateless.Methods; namespace View_by_Distance.Shared.Models.Stateless.Methods;
@ -27,7 +28,20 @@ internal abstract class Id
internal static byte GetHasIgnoreKeyword(FilePath filePath) => internal static byte GetHasIgnoreKeyword(FilePath filePath) =>
(byte)(filePath.Id > -1 ? 8 : 2); (byte)(filePath.Id > -1 ? 8 : 2);
internal static int GetId(Properties.IPropertyConfiguration propertyConfiguration, string intelligentId) internal static byte GetHasDateTimeOriginal(IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
(byte)(IsIgnoreOrValidVideoFormatExtension(propertyConfiguration, filePath) ? filePath.Id > -1 ? 6 : 4 : filePath.Id > -1 ? 9 : 1);
private static bool IsIgnoreOrValidVideoFormatExtension(IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
IsIgnoreOrValidVideoFormatExtension(propertyConfiguration, filePath.ExtensionLowered);
private static bool IsIgnoreOrValidVideoFormatExtension(IPropertyConfiguration propertyConfiguration, string extensionLowered) =>
propertyConfiguration.IgnoreExtensions.Contains(extensionLowered)
|| propertyConfiguration.ValidVideoFormatExtensions.Contains(extensionLowered);
internal static byte GetMissingDateTimeOriginal(IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
(byte)(IsIgnoreOrValidVideoFormatExtension(propertyConfiguration, filePath) ? filePath.Id > -1 ? 5 : 0 : filePath.Id > -1 ? 7 : 3);
internal static int GetId(IPropertyConfiguration propertyConfiguration, string intelligentId)
{ {
int result; int result;
StringBuilder results = new(); StringBuilder results = new();
@ -44,13 +58,7 @@ internal abstract class Id
return result; return result;
} }
internal static byte GetHasDateTimeOriginal(Properties.IPropertyConfiguration propertyConfiguration, FilePath filePath) => internal static bool NameWithoutExtensionIsIdFormat(IPropertyConfiguration propertyConfiguration, string fileNameWithoutExtension)
(byte)(propertyConfiguration.IgnoreExtensions.Contains(filePath.ExtensionLowered) || propertyConfiguration.ValidVideoFormatExtensions.Contains(filePath.ExtensionLowered) ? filePath.Id > -1 ? 6 : 4 : filePath.Id > -1 ? 9 : 1);
internal static byte GetMissingDateTimeOriginal(Properties.IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
(byte)(propertyConfiguration.IgnoreExtensions.Contains(filePath.ExtensionLowered) || propertyConfiguration.ValidVideoFormatExtensions.Contains(filePath.ExtensionLowered) ? filePath.Id > -1 ? 5 : 0 : filePath.Id > -1 ? 7 : 3);
internal static bool NameWithoutExtensionIsIdFormat(Properties.IPropertyConfiguration propertyConfiguration, string fileNameWithoutExtension)
{ {
bool result; bool result;
if (fileNameWithoutExtension.Length < 5 || fileNameWithoutExtension.Length > propertyConfiguration.IntMinValueLength) if (fileNameWithoutExtension.Length < 5 || fileNameWithoutExtension.Length > propertyConfiguration.IntMinValueLength)
@ -63,7 +71,7 @@ internal abstract class Id
return result; return result;
} }
internal static string GetIntelligentId(Properties.IPropertyConfiguration propertyConfiguration, long id, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal) internal static string GetIntelligentId(IPropertyConfiguration propertyConfiguration, long id, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal)
{ {
string result; string result;
StringBuilder stringBuilder = new(); StringBuilder stringBuilder = new();
@ -79,18 +87,18 @@ internal abstract class Id
} }
else if (id > -1) else if (id > -1)
{ {
if (!propertyConfiguration.ValidVideoFormatExtensions.Contains(extensionLowered)) if (IsIgnoreOrValidVideoFormatExtension(propertyConfiguration, extensionLowered))
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? 8 : hasDateTimeOriginal.Value ? 9 : 7;
else
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? throw new NotImplementedException() : hasDateTimeOriginal.Value ? 6 : 5; key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? throw new NotImplementedException() : hasDateTimeOriginal.Value ? 6 : 5;
else
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? 8 : hasDateTimeOriginal.Value ? 9 : 7;
value = id.ToString().PadLeft(propertyConfiguration.IntMinValueLength, '0'); value = id.ToString().PadLeft(propertyConfiguration.IntMinValueLength, '0');
} }
else else
{ {
if (!propertyConfiguration.ValidVideoFormatExtensions.Contains(extensionLowered)) if (IsIgnoreOrValidVideoFormatExtension(propertyConfiguration, extensionLowered))
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? 2 : hasDateTimeOriginal.Value ? 1 : 3;
else
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? throw new NotImplementedException() : hasDateTimeOriginal.Value ? 4 : 0; key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? throw new NotImplementedException() : hasDateTimeOriginal.Value ? 4 : 0;
else
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? 2 : hasDateTimeOriginal.Value ? 1 : 3;
value = id.ToString()[1..].PadLeft(propertyConfiguration.IntMinValueLength, '0'); value = id.ToString()[1..].PadLeft(propertyConfiguration.IntMinValueLength, '0');
} }
for (int i = value.Length - propertyConfiguration.ResultAllInOneSubdirectoryLength - 1; i > -1; i--) for (int i = value.Length - propertyConfiguration.ResultAllInOneSubdirectoryLength - 1; i > -1; i--)
@ -101,7 +109,7 @@ internal abstract class Id
return result; return result;
} }
internal static string GetPaddedId(Properties.IPropertyConfiguration propertyConfiguration, int id, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index) internal static string GetPaddedId(IPropertyConfiguration propertyConfiguration, int id, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index)
{ {
string result; string result;
if (propertyConfiguration.Offset < 0) if (propertyConfiguration.Offset < 0)

View File

@ -136,7 +136,10 @@ internal abstract class Location
result = null; result = null;
else else
{ {
if (!int.TryParse(segments[1], out int xWholePercent) || !int.TryParse(segments[2], out int yWholePercent) || !int.TryParse(segments[3], out int wWholePercent) || !int.TryParse(segments[4], out int hWholePercent)) if (!int.TryParse(segments[1], out int xWholePercent)
|| !int.TryParse(segments[2], out int yWholePercent)
|| !int.TryParse(segments[3], out int wWholePercent)
|| !int.TryParse(segments[4], out int hWholePercent))
result = null; result = null;
else else
{ {

View File

@ -1,4 +1,5 @@
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Diagnostics;
namespace View_by_Distance.Shared.Models.Stateless.Methods; namespace View_by_Distance.Shared.Models.Stateless.Methods;
@ -384,7 +385,12 @@ internal abstract partial class XDirectory
else else
{ {
if (filePath.Id is null) if (filePath.Id is null)
{
if (Debugger.IsAttached)
continue;
else
throw new NullReferenceException(nameof(filePath.Id)); throw new NullReferenceException(nameof(filePath.Id));
}
intelligentId = IId.GetIntelligentId(propertyConfiguration, filePath.Id.Value, filePath.ExtensionLowered, filePath.HasIgnoreKeyword, filePath.HasDateTimeOriginal); intelligentId = IId.GetIntelligentId(propertyConfiguration, filePath.Id.Value, filePath.ExtensionLowered, filePath.HasIgnoreKeyword, filePath.HasDateTimeOriginal);
if (!isOffsetDeterministicHashCode) if (!isOffsetDeterministicHashCode)
checkFile = Path.Combine(directory, $"{intelligentId}{filePath.ExtensionLowered}"); checkFile = Path.Combine(directory, $"{intelligentId}{filePath.ExtensionLowered}");

View File

@ -162,8 +162,8 @@ public partial class UnitTestCalculations
width = 100; width = 100;
height = 100; height = 100;
Location location = new(bottom, confidence, left, right, top); Location location = new(bottom, confidence, left, right, top);
_ = new Location(confidence, height, location, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, width, 1); _ = new Location(confidence, height, location, width, 1);
_ = new Location(bottom, confidence, height, left, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, right, top, width, 1); _ = new Location(bottom, confidence, height, left, right, top, width, 1);
NonThrowTryCatch(); NonThrowTryCatch();
} }
@ -188,7 +188,7 @@ public partial class UnitTestCalculations
bottom = 50; bottom = 50;
width = 100; width = 100;
height = 100; height = 100;
location = new(bottom, confidence, height, left, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, right, top, width, 1); location = new(bottom, confidence, height, left, right, top, width, 1);
areaPermyriad = IMapping.GetAreaPermyriad(faceAreaPermyriad, height, location, width); areaPermyriad = IMapping.GetAreaPermyriad(faceAreaPermyriad, height, location, width);
Assert.IsTrue(areaPermyriad == 2500); Assert.IsTrue(areaPermyriad == 2500);
left = 0; left = 0;
@ -197,7 +197,7 @@ public partial class UnitTestCalculations
bottom = 25; bottom = 25;
width = 100; width = 100;
height = 100; height = 100;
location = new(bottom, confidence, height, left, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, right, top, width, 1); location = new(bottom, confidence, height, left, right, top, width, 1);
OutputResolution outputResolution = new(height, 0, width); OutputResolution outputResolution = new(height, 0, width);
areaPermyriad = IMapping.GetAreaPermyriad(faceAreaPermyriad, location, outputResolution); areaPermyriad = IMapping.GetAreaPermyriad(faceAreaPermyriad, location, outputResolution);
Assert.IsTrue(areaPermyriad == 625); Assert.IsTrue(areaPermyriad == 625);