Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
08164a880d |
@ -89,10 +89,34 @@
|
|||||||
"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",
|
||||||
|
".heic",
|
||||||
|
".HEIC",
|
||||||
|
".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",
|
||||||
@ -104,20 +128,24 @@
|
|||||||
"/Not-Copy-Copy - Delta/Blackberry - Results/A) Property/2022-12-30/[()]/637869745134124462.json"
|
"/Not-Copy-Copy - Delta/Blackberry - Results/A) Property/2022-12-30/[()]/637869745134124462.json"
|
||||||
],
|
],
|
||||||
"ValidImageFormatExtensions": [
|
"ValidImageFormatExtensions": [
|
||||||
|
".avif",
|
||||||
".bmp",
|
".bmp",
|
||||||
".BMP",
|
|
||||||
".gif",
|
".gif",
|
||||||
".GIF",
|
".heic",
|
||||||
|
".insp",
|
||||||
|
".jp2",
|
||||||
|
".jpe",
|
||||||
".jpeg",
|
".jpeg",
|
||||||
".JPEG",
|
|
||||||
".jpg",
|
".jpg",
|
||||||
".JPG",
|
".jxl",
|
||||||
".png",
|
".png",
|
||||||
".PNG",
|
".psd",
|
||||||
".tiff",
|
".raw",
|
||||||
".TIFF",
|
".rw2",
|
||||||
|
".svg",
|
||||||
".tif",
|
".tif",
|
||||||
".TIF"
|
".tiff",
|
||||||
|
".webp"
|
||||||
],
|
],
|
||||||
"VerifyToSeason": [
|
"VerifyToSeason": [
|
||||||
". 2000",
|
". 2000",
|
||||||
|
@ -90,12 +90,34 @@
|
|||||||
"/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",
|
||||||
|
".heic",
|
||||||
|
".HEIC",
|
||||||
|
".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",
|
||||||
@ -107,20 +129,24 @@
|
|||||||
"/Not-Copy-Copy - Delta/Blackberry - Results/A) Property/2022-12-30/[()]/637869745134124462.json"
|
"/Not-Copy-Copy - Delta/Blackberry - Results/A) Property/2022-12-30/[()]/637869745134124462.json"
|
||||||
],
|
],
|
||||||
"ValidImageFormatExtensions": [
|
"ValidImageFormatExtensions": [
|
||||||
|
".avif",
|
||||||
".bmp",
|
".bmp",
|
||||||
".BMP",
|
|
||||||
".gif",
|
".gif",
|
||||||
".GIF",
|
".heic",
|
||||||
|
".insp",
|
||||||
|
".jp2",
|
||||||
|
".jpe",
|
||||||
".jpeg",
|
".jpeg",
|
||||||
".JPEG",
|
|
||||||
".jpg",
|
".jpg",
|
||||||
".JPG",
|
".jxl",
|
||||||
".png",
|
".png",
|
||||||
".PNG",
|
".psd",
|
||||||
".tiff",
|
".raw",
|
||||||
".TIFF",
|
".rw2",
|
||||||
|
".svg",
|
||||||
".tif",
|
".tif",
|
||||||
".TIF"
|
".tiff",
|
||||||
|
".webp"
|
||||||
],
|
],
|
||||||
"VerifyToSeason": [
|
"VerifyToSeason": [
|
||||||
". 2000",
|
". 2000",
|
||||||
|
@ -133,9 +133,9 @@ internal abstract class Container
|
|||||||
ReadOnlyCollection<Shared.Models.FilePair> filePairs;
|
ReadOnlyCollection<Shared.Models.FilePair> filePairs;
|
||||||
int maxDegreeOfParallelism = Environment.ProcessorCount;
|
int maxDegreeOfParallelism = Environment.ProcessorCount;
|
||||||
int filesCollectionDirectoryLength = filesCollectionDirectory.Length;
|
int filesCollectionDirectoryLength = filesCollectionDirectory.Length;
|
||||||
|
string aResultsFullGroupDirectory = dlibDotNet.GetResultsFullGroupDirectories();
|
||||||
ParallelOptions parallelOptions = new() { MaxDegreeOfParallelism = maxDegreeOfParallelism };
|
ParallelOptions parallelOptions = new() { MaxDegreeOfParallelism = maxDegreeOfParallelism };
|
||||||
(_, string bResultsFullGroupDirectory) = dlibDotNet.GetResultsFullGroupDirectories();
|
string jsonGroupDirectory = Path.Combine(aResultsFullGroupDirectory, propertyConfiguration.ResultSingleton);
|
||||||
string jsonGroupDirectory = Path.Combine(bResultsFullGroupDirectory, propertyConfiguration.ResultSingleton);
|
|
||||||
if (!Directory.Exists(jsonGroupDirectory))
|
if (!Directory.Exists(jsonGroupDirectory))
|
||||||
_ = Directory.CreateDirectory(jsonGroupDirectory);
|
_ = Directory.CreateDirectory(jsonGroupDirectory);
|
||||||
filePairs = IFilePair.GetFilePairs(propertyConfiguration, directorySearchFilter, extension, jsonGroupDirectory, filePathsCollection);
|
filePairs = IFilePair.GetFilePairs(propertyConfiguration, directorySearchFilter, extension, jsonGroupDirectory, filePathsCollection);
|
||||||
@ -226,8 +226,8 @@ internal abstract class Container
|
|||||||
if (filePaths is not null && change is not null)
|
if (filePaths is not null && change is not null)
|
||||||
RenameFile(filePair, filePair.FilePath, change.Value, filePaths);
|
RenameFile(filePair, filePair.FilePath, change.Value, filePaths);
|
||||||
}
|
}
|
||||||
|
lastWriteTimeChanged = exifDirectory?.FilePath is not null ? exifDirectory.FilePath.LastWriteTicks != filePair.FilePath.LastWriteTicks : null;
|
||||||
relativePath = Shared.Models.Stateless.Methods.IPath.GetRelativePath(filePair.FilePath.FullName, rootDirectoryLength, forceExtensionToLower: true);
|
relativePath = Shared.Models.Stateless.Methods.IPath.GetRelativePath(filePair.FilePath.FullName, rootDirectoryLength, forceExtensionToLower: true);
|
||||||
lastWriteTimeChanged = exifDirectory?.FilePath is not null ? propertyConfiguration.PropertiesChangedForProperty || exifDirectory.FilePath.LastWriteTicks != filePair.FilePath.LastWriteTicks : null;
|
|
||||||
if (filePair.Match is not null)
|
if (filePair.Match is not null)
|
||||||
sourceDirectoryFileHolder = IFileHolder.Get(filePair.Match);
|
sourceDirectoryFileHolder = IFileHolder.Get(filePair.Match);
|
||||||
else if (!filePair.IsUnique)
|
else if (!filePair.IsUnique)
|
||||||
@ -381,8 +381,8 @@ internal abstract class Container
|
|||||||
private static void AnyMoved(IDlibDotNet dlibDotNet, IPropertyConfiguration propertyConfiguration, string facesFileNameExtension, string facesHiddenFileNameExtension, string eDistanceContentDirectory, ReadOnlyCollection<ReadOnlyCollection<FilePath>> filePathsCollection, ReadOnlyDictionary<int, ReadOnlyCollection<FilePath>> idToFilePaths, string directorySearchFilter)
|
private static void AnyMoved(IDlibDotNet dlibDotNet, IPropertyConfiguration propertyConfiguration, string facesFileNameExtension, string facesHiddenFileNameExtension, string eDistanceContentDirectory, ReadOnlyCollection<ReadOnlyCollection<FilePath>> filePathsCollection, ReadOnlyDictionary<int, ReadOnlyCollection<FilePath>> idToFilePaths, string directorySearchFilter)
|
||||||
{
|
{
|
||||||
const string extension = ".json";
|
const string extension = ".json";
|
||||||
(_, string bResultsFullGroupDirectory) = dlibDotNet.GetResultsFullGroupDirectories();
|
string aResultsFullGroupDirectory = dlibDotNet.GetResultsFullGroupDirectories();
|
||||||
string bMetaSingletonDirectory = Path.Combine(bResultsFullGroupDirectory, propertyConfiguration.ResultSingleton);
|
string bMetaSingletonDirectory = Path.Combine(aResultsFullGroupDirectory, propertyConfiguration.ResultSingleton);
|
||||||
if (!Directory.Exists(bMetaSingletonDirectory))
|
if (!Directory.Exists(bMetaSingletonDirectory))
|
||||||
_ = Directory.CreateDirectory(bMetaSingletonDirectory);
|
_ = Directory.CreateDirectory(bMetaSingletonDirectory);
|
||||||
_ = IFilePair.GetFilePairs(propertyConfiguration, directorySearchFilter, extension, bMetaSingletonDirectory, filePathsCollection);
|
_ = IFilePair.GetFilePairs(propertyConfiguration, directorySearchFilter, extension, bMetaSingletonDirectory, filePathsCollection);
|
||||||
|
@ -71,28 +71,54 @@
|
|||||||
"ResultSingleton": "{}",
|
"ResultSingleton": "{}",
|
||||||
"RootDirectory": "D:/Images",
|
"RootDirectory": "D:/Images",
|
||||||
"IgnoreExtensions": [
|
"IgnoreExtensions": [
|
||||||
|
".ffs_db",
|
||||||
|
".FFS_DB",
|
||||||
".gif",
|
".gif",
|
||||||
".GIF",
|
".GIF",
|
||||||
|
".heic",
|
||||||
|
".HEIC",
|
||||||
|
".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": [
|
||||||
|
".avif",
|
||||||
".bmp",
|
".bmp",
|
||||||
".BMP",
|
|
||||||
".gif",
|
".gif",
|
||||||
".GIF",
|
".heic",
|
||||||
|
".insp",
|
||||||
|
".jp2",
|
||||||
|
".jpe",
|
||||||
".jpeg",
|
".jpeg",
|
||||||
".JPEG",
|
|
||||||
".jpg",
|
".jpg",
|
||||||
".JPG",
|
".jxl",
|
||||||
".png",
|
".png",
|
||||||
".PNG",
|
".psd",
|
||||||
".tiff",
|
".raw",
|
||||||
".TIFF",
|
".rw2",
|
||||||
|
".svg",
|
||||||
".tif",
|
".tif",
|
||||||
".TIF"
|
".tiff",
|
||||||
|
".webp"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public class DateGroup
|
|||||||
if (!_IsEnvironment.Development)
|
if (!_IsEnvironment.Development)
|
||||||
throw new Exception("This program only allows development environments!");
|
throw new Exception("This program only allows development environments!");
|
||||||
long ticks = DateTime.Now.Ticks;
|
long ticks = DateTime.Now.Ticks;
|
||||||
Metadata.Models.B_Metadata metadata = new(propertyConfiguration);
|
Metadata.Models.A_Metadata metadata = new(propertyConfiguration);
|
||||||
string[] dbFiles = Directory.GetFiles(propertyConfiguration.RootDirectory, "*.db", SearchOption.AllDirectories);
|
string[] dbFiles = Directory.GetFiles(propertyConfiguration.RootDirectory, "*.db", SearchOption.AllDirectories);
|
||||||
foreach (string dbFile in dbFiles)
|
foreach (string dbFile in dbFiles)
|
||||||
File.Delete(dbFile);
|
File.Delete(dbFile);
|
||||||
|
@ -70,29 +70,55 @@
|
|||||||
"ResultSingleton": "{}",
|
"ResultSingleton": "{}",
|
||||||
"RootDirectory": "C:/Tmp/phares/Pictures",
|
"RootDirectory": "C:/Tmp/phares/Pictures",
|
||||||
"IgnoreExtensions": [
|
"IgnoreExtensions": [
|
||||||
|
".ffs_db",
|
||||||
|
".FFS_DB",
|
||||||
".gif",
|
".gif",
|
||||||
".GIF",
|
".GIF",
|
||||||
|
".heic",
|
||||||
|
".HEIC",
|
||||||
|
".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": [
|
||||||
|
".avif",
|
||||||
".bmp",
|
".bmp",
|
||||||
".BMP",
|
|
||||||
".gif",
|
".gif",
|
||||||
".GIF",
|
".heic",
|
||||||
|
".insp",
|
||||||
|
".jp2",
|
||||||
|
".jpe",
|
||||||
".jpeg",
|
".jpeg",
|
||||||
".JPEG",
|
|
||||||
".jpg",
|
".jpg",
|
||||||
".JPG",
|
".jxl",
|
||||||
".png",
|
".png",
|
||||||
".PNG",
|
".psd",
|
||||||
".tiff",
|
".raw",
|
||||||
".TIFF",
|
".rw2",
|
||||||
|
".svg",
|
||||||
".tif",
|
".tif",
|
||||||
".TIF"
|
".tiff",
|
||||||
|
".webp"
|
||||||
],
|
],
|
||||||
"VerifyToSeason": [
|
"VerifyToSeason": [
|
||||||
". 2000",
|
". 2000",
|
||||||
|
@ -72,28 +72,54 @@
|
|||||||
"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",
|
||||||
|
".heic",
|
||||||
|
".HEIC",
|
||||||
|
".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": [
|
||||||
|
".avif",
|
||||||
".bmp",
|
".bmp",
|
||||||
".BMP",
|
|
||||||
".gif",
|
".gif",
|
||||||
".GIF",
|
".heic",
|
||||||
|
".insp",
|
||||||
|
".jp2",
|
||||||
|
".jpe",
|
||||||
".jpeg",
|
".jpeg",
|
||||||
".JPEG",
|
|
||||||
".jpg",
|
".jpg",
|
||||||
".JPG",
|
".jxl",
|
||||||
".png",
|
".png",
|
||||||
".PNG",
|
".psd",
|
||||||
".tiff",
|
".raw",
|
||||||
".TIFF",
|
".rw2",
|
||||||
|
".svg",
|
||||||
".tif",
|
".tif",
|
||||||
".TIF"
|
".tiff",
|
||||||
|
".webp"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,28 +67,54 @@
|
|||||||
"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",
|
||||||
|
".heic",
|
||||||
|
".HEIC",
|
||||||
|
".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": [
|
||||||
|
".avif",
|
||||||
".bmp",
|
".bmp",
|
||||||
".BMP",
|
|
||||||
".gif",
|
".gif",
|
||||||
".GIF",
|
".heic",
|
||||||
|
".insp",
|
||||||
|
".jp2",
|
||||||
|
".jpe",
|
||||||
".jpeg",
|
".jpeg",
|
||||||
".JPEG",
|
|
||||||
".jpg",
|
".jpg",
|
||||||
".JPG",
|
".jxl",
|
||||||
".png",
|
".png",
|
||||||
".PNG",
|
".psd",
|
||||||
".tiff",
|
".raw",
|
||||||
".TIFF",
|
".rw2",
|
||||||
|
".svg",
|
||||||
".tif",
|
".tif",
|
||||||
".TIF"
|
".tiff",
|
||||||
|
".webp"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ public partial class E_Distance : IDistance
|
|||||||
throw new NullReferenceException(nameof(locationContainer.ExifDirectory));
|
throw new NullReferenceException(nameof(locationContainer.ExifDirectory));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
json = Metadata.Models.Stateless.Methods.IMetadata.GetFaceEncoding(locationContainer.ExifDirectory);
|
json = Metadata.Models.Stateless.Methods.IMetadata.GetRawFaceEncoding(locationContainer.ExifDirectory);
|
||||||
if (json is null)
|
if (json is null)
|
||||||
{
|
{
|
||||||
if (_DistanceMoveUnableToMatch)
|
if (_DistanceMoveUnableToMatch)
|
||||||
@ -338,7 +338,6 @@ public partial class E_Distance : IDistance
|
|||||||
public static ReadOnlyDictionary<int, ReadOnlyDictionary<int, LocationContainer>> GetMappedWithEncoding(ReadOnlyDictionary<int, ReadOnlyDictionary<int, LocationContainer>> mapped)
|
public static ReadOnlyDictionary<int, ReadOnlyDictionary<int, LocationContainer>> GetMappedWithEncoding(ReadOnlyDictionary<int, ReadOnlyDictionary<int, LocationContainer>> mapped)
|
||||||
{
|
{
|
||||||
Dictionary<int, ReadOnlyDictionary<int, LocationContainer>> results = [];
|
Dictionary<int, ReadOnlyDictionary<int, LocationContainer>> results = [];
|
||||||
string? json;
|
|
||||||
LocationContainer? locationContainer;
|
LocationContainer? locationContainer;
|
||||||
Shared.Models.FaceEncoding? faceEncoding;
|
Shared.Models.FaceEncoding? faceEncoding;
|
||||||
FaceRecognitionDotNet.FaceEncoding? encoding;
|
FaceRecognitionDotNet.FaceEncoding? encoding;
|
||||||
@ -348,8 +347,7 @@ public partial class E_Distance : IDistance
|
|||||||
keyValuePairs = [];
|
keyValuePairs = [];
|
||||||
foreach (KeyValuePair<int, LocationContainer> keyValue in keyValuePair.Value)
|
foreach (KeyValuePair<int, LocationContainer> keyValue in keyValuePair.Value)
|
||||||
{
|
{
|
||||||
json = Metadata.Models.Stateless.Methods.IMetadata.GetFaceEncoding(keyValue.Value.ExifDirectory);
|
faceEncoding = Metadata.Models.Stateless.Methods.IMetadata.GetFaceEncoding(keyValue.Value.ExifDirectory);
|
||||||
faceEncoding = json is null ? null : JsonSerializer.Deserialize<Shared.Models.FaceEncoding>(json);
|
|
||||||
if (faceEncoding is null)
|
if (faceEncoding is null)
|
||||||
continue;
|
continue;
|
||||||
encoding = FaceRecognition.LoadFaceEncoding(faceEncoding.RawEncoding);
|
encoding = FaceRecognition.LoadFaceEncoding(faceEncoding.RawEncoding);
|
||||||
@ -364,7 +362,6 @@ public partial class E_Distance : IDistance
|
|||||||
public static List<LocationContainer> GetPreFilterLocationContainer(int maxDegreeOfParallelism, Configuration configuration, string focusDirectory, string focusModel, int? skipPersonWithMoreThen, long ticks, MapLogic mapLogic, long[] jLinkResolvedPersonKeys, ReadOnlyDictionary<int, ReadOnlyDictionary<int, LocationContainer>> mapped, List<LocationContainer> available)
|
public static List<LocationContainer> GetPreFilterLocationContainer(int maxDegreeOfParallelism, Configuration configuration, string focusDirectory, string focusModel, int? skipPersonWithMoreThen, long ticks, MapLogic mapLogic, long[] jLinkResolvedPersonKeys, ReadOnlyDictionary<int, ReadOnlyDictionary<int, LocationContainer>> mapped, List<LocationContainer> available)
|
||||||
{
|
{
|
||||||
List<LocationContainer> results = [];
|
List<LocationContainer> results = [];
|
||||||
string? json;
|
|
||||||
string? model;
|
string? model;
|
||||||
bool? canReMap;
|
bool? canReMap;
|
||||||
bool? isFocusPerson;
|
bool? isFocusPerson;
|
||||||
@ -403,8 +400,7 @@ public partial class E_Distance : IDistance
|
|||||||
if (!locationContainer.FilePath.DirectoryFullPath.Contains(focusDirectory))
|
if (!locationContainer.FilePath.DirectoryFullPath.Contains(focusDirectory))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
json = Metadata.Models.Stateless.Methods.IMetadata.GetFaceEncoding(locationContainer.ExifDirectory);
|
faceEncoding = Metadata.Models.Stateless.Methods.IMetadata.GetFaceEncoding(locationContainer.ExifDirectory);
|
||||||
faceEncoding = json is null ? null : JsonSerializer.Deserialize<Shared.Models.FaceEncoding>(json);
|
|
||||||
if (faceEncoding is null)
|
if (faceEncoding is null)
|
||||||
continue;
|
continue;
|
||||||
encoding = FaceRecognition.LoadFaceEncoding(faceEncoding.RawEncoding);
|
encoding = FaceRecognition.LoadFaceEncoding(faceEncoding.RawEncoding);
|
||||||
@ -678,16 +674,12 @@ public partial class E_Distance : IDistance
|
|||||||
ReadOnlyCollection<RelationContainer> IDistance.GetRelationContainers(IDistanceLimits distanceLimits, int faceDistancePermyriad, int locationContainerDistanceTake, float locationContainerDistanceTolerance, ReadOnlyCollection<LocationContainer> locationContainers)
|
ReadOnlyCollection<RelationContainer> IDistance.GetRelationContainers(IDistanceLimits distanceLimits, int faceDistancePermyriad, int locationContainerDistanceTake, float locationContainerDistanceTolerance, ReadOnlyCollection<LocationContainer> locationContainers)
|
||||||
{
|
{
|
||||||
ReadOnlyCollection<RelationContainer> result;
|
ReadOnlyCollection<RelationContainer> result;
|
||||||
string? json;
|
|
||||||
List<Record> records = [];
|
List<Record> records = [];
|
||||||
Shared.Models.FaceEncoding? modelsFaceEncoding;
|
Shared.Models.FaceEncoding? modelsFaceEncoding;
|
||||||
FaceRecognitionDotNet.FaceEncoding faceRecognitionDotNetFaceEncoding;
|
FaceRecognitionDotNet.FaceEncoding faceRecognitionDotNetFaceEncoding;
|
||||||
foreach (LocationContainer locationContainer in locationContainers)
|
foreach (LocationContainer locationContainer in locationContainers)
|
||||||
{
|
{
|
||||||
json = Metadata.Models.Stateless.Methods.IMetadata.GetFaceEncoding(locationContainer.ExifDirectory);
|
modelsFaceEncoding = Metadata.Models.Stateless.Methods.IMetadata.GetFaceEncoding(locationContainer.ExifDirectory);
|
||||||
if (json is null)
|
|
||||||
continue;
|
|
||||||
modelsFaceEncoding = JsonSerializer.Deserialize<Shared.Models.FaceEncoding>(json);
|
|
||||||
if (modelsFaceEncoding is null)
|
if (modelsFaceEncoding is null)
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
faceRecognitionDotNetFaceEncoding = FaceRecognition.LoadFaceEncoding(modelsFaceEncoding.RawEncoding);
|
faceRecognitionDotNetFaceEncoding = FaceRecognition.LoadFaceEncoding(modelsFaceEncoding.RawEncoding);
|
||||||
|
@ -68,28 +68,54 @@
|
|||||||
"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",
|
||||||
|
".heic",
|
||||||
|
".HEIC",
|
||||||
|
".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": [
|
||||||
|
".avif",
|
||||||
".bmp",
|
".bmp",
|
||||||
".BMP",
|
|
||||||
".gif",
|
".gif",
|
||||||
".GIF",
|
".heic",
|
||||||
|
".insp",
|
||||||
|
".jp2",
|
||||||
|
".jpe",
|
||||||
".jpeg",
|
".jpeg",
|
||||||
".JPEG",
|
|
||||||
".jpg",
|
".jpg",
|
||||||
".JPG",
|
".jxl",
|
||||||
".png",
|
".png",
|
||||||
".PNG",
|
".psd",
|
||||||
".tiff",
|
".raw",
|
||||||
".TIFF",
|
".rw2",
|
||||||
|
".svg",
|
||||||
".tif",
|
".tif",
|
||||||
".TIF"
|
".tiff",
|
||||||
|
".webp"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ public class D_Face : IFaceD
|
|||||||
FileHolder fileHolder;
|
FileHolder fileHolder;
|
||||||
string deterministicHashCodeKey;
|
string deterministicHashCodeKey;
|
||||||
string fileName = mappingFromItem.FilePath.NameWithoutExtension;
|
string fileName = mappingFromItem.FilePath.NameWithoutExtension;
|
||||||
string[] changesFrom = [nameof(A_Property), nameof(B_Metadata), nameof(C_Resize)];
|
string[] changesFrom = [nameof(A_Metadata), nameof(C_Resize)];
|
||||||
List<DateTime> dateTimes = (from l in subFileTuples where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
List<DateTime> dateTimes = (from l in subFileTuples where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
||||||
CombinedEnumAndIndex cei = Shared.Models.Stateless.Methods.IPath.GetCombinedEnumAndIndex(_PropertyConfiguration, filePath);
|
CombinedEnumAndIndex cei = Shared.Models.Stateless.Methods.IPath.GetCombinedEnumAndIndex(_PropertyConfiguration, filePath);
|
||||||
string directory = _ResultContentFileGroups[0][cei.Enum][cei.Index];
|
string directory = _ResultContentFileGroups[0][cei.Enum][cei.Index];
|
||||||
@ -269,7 +269,7 @@ public class D_Face : IFaceD
|
|||||||
List<Shared.Models.Face>? results;
|
List<Shared.Models.Face>? results;
|
||||||
string? json;
|
string? json;
|
||||||
List<Location> locations;
|
List<Location> locations;
|
||||||
string[] changesFrom = [nameof(A_Property), nameof(B_Metadata), nameof(C_Resize)];
|
string[] changesFrom = [nameof(A_Metadata), nameof(C_Resize)];
|
||||||
List<DateTime> dateTimes = (from l in subFileTuples where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
List<DateTime> dateTimes = (from l in subFileTuples where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
||||||
string fileName = $"{mappingFromItem.FilePath.NameWithoutExtension}{mappingFromItem.FilePath.ExtensionLowered}.json";
|
string fileName = $"{mappingFromItem.FilePath.NameWithoutExtension}{mappingFromItem.FilePath.ExtensionLowered}.json";
|
||||||
CombinedEnumAndIndex cei = Shared.Models.Stateless.Methods.IPath.GetCombinedEnumAndIndex(_PropertyConfiguration, filePath);
|
CombinedEnumAndIndex cei = Shared.Models.Stateless.Methods.IPath.GetCombinedEnumAndIndex(_PropertyConfiguration, filePath);
|
||||||
@ -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;
|
||||||
|
@ -214,7 +214,7 @@ public class D2_FaceParts
|
|||||||
bool updateDateWhenMatches = false;
|
bool updateDateWhenMatches = false;
|
||||||
List<(Shared.Models.Face, string, string)> collection = [];
|
List<(Shared.Models.Face, string, string)> collection = [];
|
||||||
string fileName = mappingFromItem.FilePath.NameWithoutExtension;
|
string fileName = mappingFromItem.FilePath.NameWithoutExtension;
|
||||||
string[] changesFrom = [nameof(A_Property), nameof(B_Metadata), nameof(C_Resize), nameof(D_Face)];
|
string[] changesFrom = [nameof(A_Metadata), nameof(C_Resize), nameof(D_Face)];
|
||||||
List<DateTime> dateTimes = (from l in subFileTuples where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
List<DateTime> dateTimes = (from l in subFileTuples where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
||||||
CombinedEnumAndIndex cei = Shared.Models.Stateless.Methods.IPath.GetCombinedEnumAndIndex(_PropertyConfiguration, filePath);
|
CombinedEnumAndIndex cei = Shared.Models.Stateless.Methods.IPath.GetCombinedEnumAndIndex(_PropertyConfiguration, filePath);
|
||||||
string directory = _ResultContentFileGroups[0][cei.Enum][cei.Index];
|
string directory = _ResultContentFileGroups[0][cei.Enum][cei.Index];
|
||||||
|
@ -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;
|
||||||
@ -87,7 +89,7 @@ public partial class DlibDotNet : IDlibDotNet, IDisposable
|
|||||||
if (configuration.IgnoreExtensions is null)
|
if (configuration.IgnoreExtensions is null)
|
||||||
throw new NullReferenceException(nameof(configuration.IgnoreExtensions));
|
throw new NullReferenceException(nameof(configuration.IgnoreExtensions));
|
||||||
_BlurHasher = new BlurHash.Models.C2_BlurHasher(configuration.PropertyConfiguration);
|
_BlurHasher = new BlurHash.Models.C2_BlurHasher(configuration.PropertyConfiguration);
|
||||||
string propertyRoot = Property.Models.Stateless.IResult.GetResultsGroupDirectory(propertyConfiguration, nameof(A_Property), create: false);
|
string propertyRoot = Property.Models.Stateless.IResult.GetResultsGroupDirectory(propertyConfiguration, nameof(A_Metadata), create: false);
|
||||||
_PropertyRootExistedBefore = !Directory.Exists(propertyRoot);
|
_PropertyRootExistedBefore = !Directory.Exists(propertyRoot);
|
||||||
string argZero = args.Count > 0 ? Path.GetFullPath(args[0]) : Path.GetFullPath(propertyConfiguration.RootDirectory);
|
string argZero = args.Count > 0 ? Path.GetFullPath(args[0]) : Path.GetFullPath(propertyConfiguration.RootDirectory);
|
||||||
_ArgZeroIsConfigurationRootDirectory = propertyConfiguration.RootDirectory == argZero;
|
_ArgZeroIsConfigurationRootDirectory = propertyConfiguration.RootDirectory == argZero;
|
||||||
@ -175,7 +177,7 @@ public partial class DlibDotNet : IDlibDotNet, IDisposable
|
|||||||
_Logger?.LogInformation("First run completed. Run again if wanted");
|
_Logger?.LogInformation("First run completed. Run again if wanted");
|
||||||
}
|
}
|
||||||
|
|
||||||
private int FullParallelForWork(B_Metadata metadata,
|
private int FullParallelForWork(A_Metadata metadata,
|
||||||
MapLogic mapLogic,
|
MapLogic mapLogic,
|
||||||
string outputResolution,
|
string outputResolution,
|
||||||
bool outputResolutionHasNumber,
|
bool outputResolutionHasNumber,
|
||||||
@ -195,22 +197,22 @@ public partial class DlibDotNet : IDlibDotNet, IDisposable
|
|||||||
long ticks = DateTime.Now.Ticks;
|
long ticks = DateTime.Now.Ticks;
|
||||||
DateTime dateTime = DateTime.Now;
|
DateTime dateTime = DateTime.Now;
|
||||||
List<string> parseExceptions = [];
|
List<string> parseExceptions = [];
|
||||||
string[] changesFrom = [nameof(A_Property)];
|
string[] changesFrom = [nameof(A_Metadata)];
|
||||||
List<Tuple<string, DateTime>> subFileTuples = [];
|
List<Tuple<string, DateTime>> subFileTuples = [];
|
||||||
FileHolder resizedFileHolder = _Resize.GetResizedFileHolder(cResultsFullGroupDirectory, item, outputResolutionHasNumber);
|
FileHolder resizedFileHolder = _Resize.GetResizedFileHolder(cResultsFullGroupDirectory, item, outputResolutionHasNumber);
|
||||||
if (item.ExifDirectory is null || item.ExifDirectory.FilePath?.Id is null)
|
if (item.ExifDirectory is null || item.ExifDirectory.FilePath?.Id is null)
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
if (!item.SourceDirectoryFileHolder.Exists || item.SourceDirectoryFileHolder.CreationTime is null || item.SourceDirectoryFileHolder.LastWriteTime is null || item.Any())
|
if (!item.SourceDirectoryFileHolder.Exists || item.SourceDirectoryFileHolder.CreationTime is null || item.SourceDirectoryFileHolder.LastWriteTime is null || item.Any())
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
if (_Configuration.PropertyConfiguration.ForcePropertyLastWriteTimeToCreationTime && item.SourceDirectoryFileHolder.LastWriteTime.Value != item.SourceDirectoryFileHolder.CreationTime.Value)
|
if (item.SourceDirectoryFileHolder.LastWriteTime.Value != item.SourceDirectoryFileHolder.CreationTime.Value)
|
||||||
{
|
{
|
||||||
File.SetLastWriteTime(item.SourceDirectoryFileHolder.FullName, item.SourceDirectoryFileHolder.CreationTime.Value);
|
File.SetLastWriteTime(item.SourceDirectoryFileHolder.FullName, item.SourceDirectoryFileHolder.CreationTime.Value);
|
||||||
subFileTuples.Add(new Tuple<string, DateTime>(nameof(A_Property), item.SourceDirectoryFileHolder.CreationTime.Value));
|
subFileTuples.Add(new Tuple<string, DateTime>(nameof(A_Metadata), item.SourceDirectoryFileHolder.CreationTime.Value));
|
||||||
}
|
}
|
||||||
else if (item.SourceDirectoryFileHolder.LastWriteTime is not null)
|
else if (item.SourceDirectoryFileHolder.LastWriteTime is not null)
|
||||||
subFileTuples.Add(new Tuple<string, DateTime>(nameof(A_Property), item.SourceDirectoryFileHolder.LastWriteTime.Value));
|
subFileTuples.Add(new Tuple<string, DateTime>(nameof(A_Metadata), item.SourceDirectoryFileHolder.LastWriteTime.Value));
|
||||||
else
|
else
|
||||||
subFileTuples.Add(new Tuple<string, DateTime>(nameof(A_Property), new FileInfo(item.SourceDirectoryFileHolder.FullName).LastWriteTime));
|
subFileTuples.Add(new Tuple<string, DateTime>(nameof(A_Metadata), new FileInfo(item.SourceDirectoryFileHolder.FullName).LastWriteTime));
|
||||||
if (resizedFileHolder.Exists && item.ExifDirectory.Width is not null && item.ExifDirectory.Width.Value > 4 && _Configuration.SaveBlurHashForOutputResolutions.Contains(outputResolution))
|
if (resizedFileHolder.Exists && item.ExifDirectory.Width is not null && item.ExifDirectory.Width.Value > 4 && _Configuration.SaveBlurHashForOutputResolutions.Contains(outputResolution))
|
||||||
{
|
{
|
||||||
string? file = _BlurHasher.GetFile(item.FilePath);
|
string? file = _BlurHasher.GetFile(item.FilePath);
|
||||||
@ -323,7 +325,7 @@ public partial class DlibDotNet : IDlibDotNet, IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
private (int, bool) FullParallelWork(int maxDegreeOfParallelism,
|
private (int, bool) FullParallelWork(int maxDegreeOfParallelism,
|
||||||
B_Metadata metadata,
|
A_Metadata metadata,
|
||||||
MapLogic mapLogic,
|
MapLogic mapLogic,
|
||||||
string outputResolution,
|
string outputResolution,
|
||||||
bool outputResolutionHasNumber,
|
bool outputResolutionHasNumber,
|
||||||
@ -343,7 +345,7 @@ public partial class DlibDotNet : IDlibDotNet, IDisposable
|
|||||||
DateTime[] containerDateTimes = Container.Models.Stateless.Methods.IContainer.GetContainerDateTimes(filteredItems);
|
DateTime[] containerDateTimes = Container.Models.Stateless.Methods.IContainer.GetContainerDateTimes(filteredItems);
|
||||||
string focusRelativePath = Path.GetFullPath(string.Concat(_Configuration.PropertyConfiguration.RootDirectory, _Configuration.FocusDirectory));
|
string focusRelativePath = Path.GetFullPath(string.Concat(_Configuration.PropertyConfiguration.RootDirectory, _Configuration.FocusDirectory));
|
||||||
bool? isFocusRelativePath = string.IsNullOrEmpty(_Configuration.FocusDirectory) ? null : container.SourceDirectory.StartsWith(focusRelativePath);
|
bool? isFocusRelativePath = string.IsNullOrEmpty(_Configuration.FocusDirectory) ? null : container.SourceDirectory.StartsWith(focusRelativePath);
|
||||||
bool anyPropertiesChangedForX = _Configuration.PropertyConfiguration.PropertiesChangedForProperty || _Configuration.PropertiesChangedForDistance || _Configuration.PropertiesChangedForFaces || _Configuration.PropertiesChangedForIndex || _Configuration.PropertiesChangedForMetadata || _Configuration.PropertiesChangedForResize;
|
bool anyPropertiesChangedForX = _Configuration.PropertiesChangedForDistance || _Configuration.PropertiesChangedForFaces || _Configuration.PropertiesChangedForIndex || _Configuration.PropertiesChangedForMetadata || _Configuration.PropertiesChangedForResize;
|
||||||
dlibDotNet.ConstructProgressBar(filteredItems.Count, message);
|
dlibDotNet.ConstructProgressBar(filteredItems.Count, message);
|
||||||
_ = Parallel.For(0, filteredItems.Count, parallelOptions, (i, state) =>
|
_ = Parallel.For(0, filteredItems.Count, parallelOptions, (i, state) =>
|
||||||
{
|
{
|
||||||
@ -382,7 +384,7 @@ public partial class DlibDotNet : IDlibDotNet, IDisposable
|
|||||||
string propertyRoot,
|
string propertyRoot,
|
||||||
string fPhotoPrismSingletonDirectory,
|
string fPhotoPrismSingletonDirectory,
|
||||||
int count,
|
int count,
|
||||||
B_Metadata metadata,
|
A_Metadata metadata,
|
||||||
Record record,
|
Record record,
|
||||||
ReadOnlyCollection<Container.Models.Container> readOnlyContainers,
|
ReadOnlyCollection<Container.Models.Container> readOnlyContainers,
|
||||||
MapLogic mapLogic)
|
MapLogic mapLogic)
|
||||||
@ -478,23 +480,16 @@ public partial class DlibDotNet : IDlibDotNet, IDisposable
|
|||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
(string, string) IDlibDotNet.GetResultsFullGroupDirectories()
|
string IDlibDotNet.GetResultsFullGroupDirectories()
|
||||||
{
|
{
|
||||||
string aResultsFullGroupDirectory = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
|
string result = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
|
||||||
_Configuration.PropertyConfiguration,
|
_Configuration.PropertyConfiguration,
|
||||||
nameof(A_Property),
|
nameof(A_Metadata),
|
||||||
string.Empty,
|
string.Empty,
|
||||||
includeResizeGroup: false,
|
includeResizeGroup: false,
|
||||||
includeModel: false,
|
includeModel: false,
|
||||||
includePredictorModel: false);
|
includePredictorModel: false);
|
||||||
string bResultsFullGroupDirectory = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
|
return new(result);
|
||||||
_Configuration.PropertyConfiguration,
|
|
||||||
nameof(B_Metadata),
|
|
||||||
string.Empty,
|
|
||||||
includeResizeGroup: false,
|
|
||||||
includeModel: false,
|
|
||||||
includePredictorModel: false);
|
|
||||||
return new(aResultsFullGroupDirectory, bResultsFullGroupDirectory);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IDlibDotNet.ConstructProgressBar(int maxTicks, string message)
|
void IDlibDotNet.ConstructProgressBar(int maxTicks, string message)
|
||||||
@ -570,7 +565,7 @@ public partial class DlibDotNet : IDlibDotNet, IDisposable
|
|||||||
if (filePath.Id is null)
|
if (filePath.Id is null)
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
string[] directoryNames = keyValuePair.Value.Select(l => l.DirectoryFullPath.Replace('\\', '/')).ToArray();
|
string[] directoryNames = keyValuePair.Value.Select(l => l.DirectoryFullPath.Replace('\\', '/')).ToArray();
|
||||||
string paddedId = IId.GetPaddedId(propertyConfiguration, filePath.Id.Value, filePath.ExtensionLowered, filePath.HasIgnoreKeyword, filePath.HasDateTimeOriginal, index: null);
|
string paddedId = IId.GetPaddedId(propertyConfiguration, filePath, index: null);
|
||||||
result = new(directoryNames, filePath.ExtensionLowered, filePath.HasDateTimeOriginal, filePath.Id.Value, filePath.Length, paddedId, filePath.LastWriteTicks);
|
result = new(directoryNames, filePath.ExtensionLowered, filePath.HasDateTimeOriginal, filePath.Id.Value, filePath.Length, paddedId, filePath.LastWriteTicks);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -887,7 +882,7 @@ public partial class DlibDotNet : IDlibDotNet, IDisposable
|
|||||||
return results.AsReadOnly();
|
return results.AsReadOnly();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ReadOnlyDictionary<int, Identifier> GetSplatNineIdentifiers(Property.Models.Configuration propertyConfiguration, string bResultsFullGroupDirectory, ReadOnlyDictionary<int, ReadOnlyCollection<FilePath>> idToFilePaths)
|
private static ReadOnlyDictionary<int, Identifier> GetSplatNineIdentifiers(ILogger<Program>? logger, Property.Models.Configuration propertyConfiguration, string aResultsFullGroupDirectory, ReadOnlyDictionary<int, ReadOnlyCollection<FilePath>> idToFilePaths)
|
||||||
{
|
{
|
||||||
Dictionary<int, Identifier> results = [];
|
Dictionary<int, Identifier> results = [];
|
||||||
string json;
|
string json;
|
||||||
@ -895,7 +890,7 @@ public partial class DlibDotNet : IDlibDotNet, IDisposable
|
|||||||
Identifier identifier;
|
Identifier identifier;
|
||||||
List<Identifier> identifiers = [];
|
List<Identifier> identifiers = [];
|
||||||
string rootDirectory = propertyConfiguration.RootDirectory.Replace('\\', '/');
|
string rootDirectory = propertyConfiguration.RootDirectory.Replace('\\', '/');
|
||||||
string bMetadataCollectionDirectory = Path.Combine(bResultsFullGroupDirectory, propertyConfiguration.ResultCollection);
|
string bMetadataCollectionDirectory = Path.Combine(aResultsFullGroupDirectory, propertyConfiguration.ResultCollection);
|
||||||
if (!Directory.Exists(bMetadataCollectionDirectory))
|
if (!Directory.Exists(bMetadataCollectionDirectory))
|
||||||
_ = Directory.CreateDirectory(bMetadataCollectionDirectory);
|
_ = Directory.CreateDirectory(bMetadataCollectionDirectory);
|
||||||
foreach (KeyValuePair<int, ReadOnlyCollection<FilePath>> keyValuePair in idToFilePaths)
|
foreach (KeyValuePair<int, ReadOnlyCollection<FilePath>> keyValuePair in idToFilePaths)
|
||||||
@ -924,13 +919,19 @@ public partial class DlibDotNet : IDlibDotNet, IDisposable
|
|||||||
results.Add(keyValuePair.Key, identifier);
|
results.Add(keyValuePair.Key, identifier);
|
||||||
}
|
}
|
||||||
json = JsonSerializer.Serialize(results.Values.ToArray(), IdentifierCollectionSourceGenerationContext.Default.IdentifierArray);
|
json = JsonSerializer.Serialize(results.Values.ToArray(), IdentifierCollectionSourceGenerationContext.Default.IdentifierArray);
|
||||||
_ = Shared.Models.Stateless.Methods.IPath.WriteAllText(Path.Combine(bMetadataCollectionDirectory, "!9.json"), json, updateDateWhenMatches: false, compareBeforeWrite: true, updateToWhenMatches: null);
|
if (Shared.Models.Stateless.Methods.IPath.WriteAllText(Path.Combine(bMetadataCollectionDirectory, "!9.json"), json, updateDateWhenMatches: false, compareBeforeWrite: true, updateToWhenMatches: null))
|
||||||
|
logger?.LogWarning("!9.json has been updated!");
|
||||||
|
else
|
||||||
|
logger?.LogInformation("!9.json matches");
|
||||||
json = JsonSerializer.Serialize((from l in identifiers orderby l.PaddedId select l).ToArray(), IdentifierCollectionSourceGenerationContext.Default.IdentifierArray);
|
json = JsonSerializer.Serialize((from l in identifiers orderby l.PaddedId select l).ToArray(), IdentifierCollectionSourceGenerationContext.Default.IdentifierArray);
|
||||||
_ = Shared.Models.Stateless.Methods.IPath.WriteAllText(Path.Combine(bMetadataCollectionDirectory, ".json"), json.Replace(rootDirectory, string.Empty), updateDateWhenMatches: false, compareBeforeWrite: true, updateToWhenMatches: null);
|
if (Shared.Models.Stateless.Methods.IPath.WriteAllText(Path.Combine(bMetadataCollectionDirectory, ".json"), json.Replace(rootDirectory, string.Empty), updateDateWhenMatches: false, compareBeforeWrite: true, updateToWhenMatches: null))
|
||||||
|
logger?.LogWarning(".json has been updated!");
|
||||||
|
else
|
||||||
|
logger?.LogInformation(".json matches");
|
||||||
return results.AsReadOnly();
|
return results.AsReadOnly();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ReadOnlyDictionary<int, Identifier> GetSplatNineIdentifiersAndHideSplatNine(Property.Models.Configuration propertyConfiguration, string bResultsFullGroupDirectory, ReadOnlyCollection<ReadOnlyCollection<FilePath>> filePathsCollection)
|
private static ReadOnlyDictionary<int, Identifier> GetSplatNineIdentifiersAndHideSplatNine(ILogger<Program>? logger, Property.Models.Configuration propertyConfiguration, string aResultsFullGroupDirectory, ReadOnlyCollection<ReadOnlyCollection<FilePath>> filePathsCollection)
|
||||||
{
|
{
|
||||||
ReadOnlyDictionary<int, Identifier> results;
|
ReadOnlyDictionary<int, Identifier> results;
|
||||||
if (filePathsCollection.Count == 0)
|
if (filePathsCollection.Count == 0)
|
||||||
@ -941,7 +942,7 @@ public partial class DlibDotNet : IDlibDotNet, IDisposable
|
|||||||
ReadOnlyCollection<FilePath> moved = HideSplatNineAndGetMovedDuplicatesWithSameSplatNine(propertyConfiguration, idToFilePaths);
|
ReadOnlyCollection<FilePath> moved = HideSplatNineAndGetMovedDuplicatesWithSameSplatNine(propertyConfiguration, idToFilePaths);
|
||||||
if (moved.Count > 0)
|
if (moved.Count > 0)
|
||||||
throw new Exception($"House cleaning needed!{Environment.NewLine}{string.Join(Environment.NewLine, moved.Select(l => l.Id))}");
|
throw new Exception($"House cleaning needed!{Environment.NewLine}{string.Join(Environment.NewLine, moved.Select(l => l.Id))}");
|
||||||
results = GetSplatNineIdentifiers(propertyConfiguration, bResultsFullGroupDirectory, idToFilePaths);
|
results = GetSplatNineIdentifiers(logger, propertyConfiguration, aResultsFullGroupDirectory, idToFilePaths);
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
@ -1112,13 +1113,11 @@ public partial class DlibDotNet : IDlibDotNet, IDisposable
|
|||||||
MapLogic? mapLogic;
|
MapLogic? mapLogic;
|
||||||
Record? record = null;
|
Record? record = null;
|
||||||
string seasonDirectory;
|
string seasonDirectory;
|
||||||
A_Property propertyLogic;
|
|
||||||
IDlibDotNet dlibDotNet = this;
|
IDlibDotNet dlibDotNet = this;
|
||||||
DateTime dateTime = new(Ticks);
|
DateTime dateTime = new(Ticks);
|
||||||
string eDistanceContentDirectory;
|
string eDistanceContentDirectory;
|
||||||
string? a2PeopleContentDirectory;
|
string? a2PeopleContentDirectory;
|
||||||
string aResultsFullGroupDirectory;
|
string aResultsFullGroupDirectory;
|
||||||
string bResultsFullGroupDirectory;
|
|
||||||
string cResultsFullGroupDirectory;
|
string cResultsFullGroupDirectory;
|
||||||
string fPhotoPrismContentDirectory;
|
string fPhotoPrismContentDirectory;
|
||||||
const string fileSearchFilter = "*";
|
const string fileSearchFilter = "*";
|
||||||
@ -1132,15 +1131,15 @@ public partial class DlibDotNet : IDlibDotNet, IDisposable
|
|||||||
Path.Combine(_Configuration.PropertyConfiguration.RootDirectory, "Facebook"),
|
Path.Combine(_Configuration.PropertyConfiguration.RootDirectory, "Facebook"),
|
||||||
Path.Combine(_Configuration.PropertyConfiguration.RootDirectory, "LinkedIn")
|
Path.Combine(_Configuration.PropertyConfiguration.RootDirectory, "LinkedIn")
|
||||||
];
|
];
|
||||||
|
aResultsFullGroupDirectory = dlibDotNet.GetResultsFullGroupDirectories();
|
||||||
bool runToDoCollectionFirst = GetRunToDoCollectionFirst(_Configuration, checkDirectories);
|
bool runToDoCollectionFirst = GetRunToDoCollectionFirst(_Configuration, checkDirectories);
|
||||||
(aResultsFullGroupDirectory, bResultsFullGroupDirectory) = dlibDotNet.GetResultsFullGroupDirectories();
|
|
||||||
(int season, string seasonName) = Shared.Models.Stateless.Methods.IProperty.GetSeason(dateTime.DayOfYear);
|
(int season, string seasonName) = Shared.Models.Stateless.Methods.IProperty.GetSeason(dateTime.DayOfYear);
|
||||||
Shared.Models.Stateless.Methods.IPath.ChangeDateForEmptyDirectories(_Configuration.PropertyConfiguration.RootDirectory, dlibDotNet.Ticks);
|
Shared.Models.Stateless.Methods.IPath.ChangeDateForEmptyDirectories(_Configuration.PropertyConfiguration.RootDirectory, dlibDotNet.Ticks);
|
||||||
a2PeopleContentDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(_Configuration.PropertyConfiguration, nameof(A2_People), "([])");
|
a2PeopleContentDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(_Configuration.PropertyConfiguration, nameof(A2_People), "([])");
|
||||||
eDistanceContentDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(_Configuration.PropertyConfiguration, nameof(E_Distance), _Configuration.PropertyConfiguration.ResultContent);
|
eDistanceContentDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(_Configuration.PropertyConfiguration, nameof(E_Distance), _Configuration.PropertyConfiguration.ResultContent);
|
||||||
string a2PeopleSingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(_Configuration.PropertyConfiguration, nameof(A2_People), _Configuration.PropertyConfiguration.ResultSingleton);
|
string a2PeopleSingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(_Configuration.PropertyConfiguration, nameof(A2_People), _Configuration.PropertyConfiguration.ResultSingleton);
|
||||||
_ = Directory.CreateDirectory(Path.Combine(eDistanceContentDirectory, dlibDotNet.Ticks.ToString()));
|
_ = Directory.CreateDirectory(Path.Combine(eDistanceContentDirectory, dlibDotNet.Ticks.ToString()));
|
||||||
B_Metadata metadata = new(dlibDotNet, _Configuration.PropertyConfiguration, _Configuration.ForceMetadataLastWriteTimeToCreationTime, _Configuration.PropertiesChangedForMetadata, dlibDotNet.Ticks, bResultsFullGroupDirectory);
|
A_Metadata metadata = new(dlibDotNet, _Configuration.PropertyConfiguration, _Configuration.ForceMetadataLastWriteTimeToCreationTime, _Configuration.PropertiesChangedForMetadata, dlibDotNet.Ticks, aResultsFullGroupDirectory);
|
||||||
if (runToDoCollectionFirst)
|
if (runToDoCollectionFirst)
|
||||||
mapLogic = null;
|
mapLogic = null;
|
||||||
else
|
else
|
||||||
@ -1152,12 +1151,11 @@ public partial class DlibDotNet : IDlibDotNet, IDisposable
|
|||||||
configurationOutputResolutionsHas = true;
|
configurationOutputResolutionsHas = true;
|
||||||
if (!runToDoCollectionFirst)
|
if (!runToDoCollectionFirst)
|
||||||
break;
|
break;
|
||||||
record = GetFilesCollectionThenCopyOrMove(dlibDotNet, metadata, fileSearchFilter, directorySearchFilter, bResultsFullGroupDirectory, outputResolution);
|
record = GetFilesCollectionThenCopyOrMove(dlibDotNet, metadata, fileSearchFilter, directorySearchFilter, aResultsFullGroupDirectory, outputResolution);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fPhotoPrismContentDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(_Configuration.PropertyConfiguration, nameof(F_PhotoPrism), _Configuration.PropertyConfiguration.ResultContent);
|
fPhotoPrismContentDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(_Configuration.PropertyConfiguration, nameof(F_PhotoPrism), _Configuration.PropertyConfiguration.ResultContent);
|
||||||
fPhotoPrismSingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(_Configuration.PropertyConfiguration, nameof(F_PhotoPrism), _Configuration.PropertyConfiguration.ResultSingleton);
|
fPhotoPrismSingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(_Configuration.PropertyConfiguration, nameof(F_PhotoPrism), _Configuration.PropertyConfiguration.ResultSingleton);
|
||||||
propertyLogic = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, _Resize.FileNameExtension, _Configuration.Reverse, aResultsFullGroupDirectory);
|
|
||||||
if (record is not null && record.FilesCollectionCountIsOne)
|
if (record is not null && record.FilesCollectionCountIsOne)
|
||||||
{
|
{
|
||||||
if (record.FilePathsCollection is null)
|
if (record.FilePathsCollection is null)
|
||||||
@ -1174,9 +1172,8 @@ public partial class DlibDotNet : IDlibDotNet, IDisposable
|
|||||||
}
|
}
|
||||||
argZero = SaveUrlAndGetNewRootDirectory(record.FilePathsCollection.First());
|
argZero = SaveUrlAndGetNewRootDirectory(record.FilePathsCollection.First());
|
||||||
_Configuration.PropertyConfiguration.ChangeRootDirectory(argZero);
|
_Configuration.PropertyConfiguration.ChangeRootDirectory(argZero);
|
||||||
(aResultsFullGroupDirectory, bResultsFullGroupDirectory) = dlibDotNet.GetResultsFullGroupDirectories();
|
aResultsFullGroupDirectory = dlibDotNet.GetResultsFullGroupDirectories();
|
||||||
propertyRoot = Property.Models.Stateless.IResult.GetResultsGroupDirectory(_Configuration.PropertyConfiguration, nameof(A_Property), create: false);
|
propertyRoot = Property.Models.Stateless.IResult.GetResultsGroupDirectory(_Configuration.PropertyConfiguration, nameof(A_Property), create: false);
|
||||||
propertyLogic = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, _Resize.FileNameExtension, _Configuration.Reverse, aResultsFullGroupDirectory);
|
|
||||||
}
|
}
|
||||||
if (configurationOutputResolutionsHas)
|
if (configurationOutputResolutionsHas)
|
||||||
{
|
{
|
||||||
@ -1230,7 +1227,7 @@ public partial class DlibDotNet : IDlibDotNet, IDisposable
|
|||||||
{
|
{
|
||||||
dlibDotNet.ConstructProgressBar(5, nameof(mapLogic.LookForAbandoned));
|
dlibDotNet.ConstructProgressBar(5, nameof(mapLogic.LookForAbandoned));
|
||||||
(cResultsFullGroupDirectory, _, dResultsFullGroupDirectory, d2ResultsFullGroupDirectory) = dlibDotNet.GetResultsFullGroupDirectories(outputResolution);
|
(cResultsFullGroupDirectory, _, dResultsFullGroupDirectory, d2ResultsFullGroupDirectory) = dlibDotNet.GetResultsFullGroupDirectories(outputResolution);
|
||||||
mapLogic.LookForAbandoned(_Configuration.PropertyConfiguration, bResultsFullGroupDirectory, readOnlyContainers, cResultsFullGroupDirectory, dResultsFullGroupDirectory, d2ResultsFullGroupDirectory, dlibDotNet.Tick);
|
mapLogic.LookForAbandoned(_Configuration.PropertyConfiguration, aResultsFullGroupDirectory, readOnlyContainers, cResultsFullGroupDirectory, dResultsFullGroupDirectory, d2ResultsFullGroupDirectory, dlibDotNet.Tick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_Distance.Clear();
|
_Distance.Clear();
|
||||||
@ -1271,7 +1268,6 @@ public partial class DlibDotNet : IDlibDotNet, IDisposable
|
|||||||
string d2ResultsFullGroupDirectory;
|
string d2ResultsFullGroupDirectory;
|
||||||
(cResultsFullGroupDirectory, c2ResultsFullGroupDirectory, dResultsFullGroupDirectory, d2ResultsFullGroupDirectory) = dlibDotNet.GetResultsFullGroupDirectories(outputResolution);
|
(cResultsFullGroupDirectory, c2ResultsFullGroupDirectory, dResultsFullGroupDirectory, d2ResultsFullGroupDirectory) = dlibDotNet.GetResultsFullGroupDirectories(outputResolution);
|
||||||
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(Path.Combine(aResultsFullGroupDirectory, _Configuration.PropertyConfiguration.ResultSingleton));
|
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(Path.Combine(aResultsFullGroupDirectory, _Configuration.PropertyConfiguration.ResultSingleton));
|
||||||
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(Path.Combine(bResultsFullGroupDirectory, _Configuration.PropertyConfiguration.ResultSingleton));
|
|
||||||
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(Path.Combine(cResultsFullGroupDirectory, _Configuration.PropertyConfiguration.ResultSingleton));
|
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(Path.Combine(cResultsFullGroupDirectory, _Configuration.PropertyConfiguration.ResultSingleton));
|
||||||
if (_Configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions.Contains(outputResolution))
|
if (_Configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions.Contains(outputResolution))
|
||||||
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(Path.Combine(dResultsFullGroupDirectory, _Configuration.PropertyConfiguration.ResultCollection));
|
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(Path.Combine(dResultsFullGroupDirectory, _Configuration.PropertyConfiguration.ResultCollection));
|
||||||
@ -1314,10 +1310,10 @@ 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, A_Metadata metadata, string fileSearchFilter, string directorySearchFilter, string aResultsFullGroupDirectory, string outputResolution)
|
||||||
{
|
{
|
||||||
Record result;
|
Record result;
|
||||||
int count;
|
int count;
|
||||||
@ -1329,7 +1325,7 @@ public partial class DlibDotNet : IDlibDotNet, IDisposable
|
|||||||
string filesCollectionRootDirectory = _Configuration.PropertyConfiguration.RootDirectory;
|
string filesCollectionRootDirectory = _Configuration.PropertyConfiguration.RootDirectory;
|
||||||
ParallelOptions parallelOptions = new() { MaxDegreeOfParallelism = maxDegreeOfParallelism };
|
ParallelOptions parallelOptions = new() { MaxDegreeOfParallelism = maxDegreeOfParallelism };
|
||||||
(string cResultsFullGroupDirectory, _, _, _) = dlibDotNet.GetResultsFullGroupDirectories(outputResolution);
|
(string cResultsFullGroupDirectory, _, _, _) = dlibDotNet.GetResultsFullGroupDirectories(outputResolution);
|
||||||
string jsonGroupDirectory = Path.Combine(bResultsFullGroupDirectory, _Configuration.PropertyConfiguration.ResultSingleton);
|
string jsonGroupDirectory = Path.Combine(aResultsFullGroupDirectory, _Configuration.PropertyConfiguration.ResultSingleton);
|
||||||
if (!Directory.Exists(jsonGroupDirectory))
|
if (!Directory.Exists(jsonGroupDirectory))
|
||||||
_ = Directory.CreateDirectory(jsonGroupDirectory);
|
_ = Directory.CreateDirectory(jsonGroupDirectory);
|
||||||
ReadOnlyDictionary<string, ReadOnlyDictionary<byte, ReadOnlyCollection<string>>> keyValuePairs =
|
ReadOnlyDictionary<string, ReadOnlyDictionary<byte, ReadOnlyCollection<string>>> keyValuePairs =
|
||||||
@ -1359,7 +1355,7 @@ public partial class DlibDotNet : IDlibDotNet, IDisposable
|
|||||||
message = $") Copying to ## pattern directory - {(int)Math.Floor(new TimeSpan(DateTime.Now.Ticks - dlibDotNet.Ticks).TotalSeconds)} total second(s)";
|
message = $") Copying to ## pattern directory - {(int)Math.Floor(new TimeSpan(DateTime.Now.Ticks - dlibDotNet.Ticks).TotalSeconds)} total second(s)";
|
||||||
dlibDotNet.ConstructProgressBar(count, message);
|
dlibDotNet.ConstructProgressBar(count, message);
|
||||||
_ = IDirectory.CopyOrMove(toDoCollection, move: false, moveBack: false, dlibDotNet.Tick);
|
_ = IDirectory.CopyOrMove(toDoCollection, move: false, moveBack: false, dlibDotNet.Tick);
|
||||||
ReadOnlyDictionary<int, Identifier> splatNineIdentifiers = GetSplatNineIdentifiersAndHideSplatNine(_Configuration.PropertyConfiguration, bResultsFullGroupDirectory, filePathsCollection);
|
ReadOnlyDictionary<int, Identifier> splatNineIdentifiers = GetSplatNineIdentifiersAndHideSplatNine(_Logger, _Configuration.PropertyConfiguration, aResultsFullGroupDirectory, filePathsCollection);
|
||||||
result = new(ExifDirectoriesById: exifDirectoriesById,
|
result = new(ExifDirectoriesById: exifDirectoriesById,
|
||||||
FilesCollectionRootDirectory: filesCollectionRootDirectory,
|
FilesCollectionRootDirectory: filesCollectionRootDirectory,
|
||||||
FilesCollectionCountIsOne: filesCollectionCountIsOne,
|
FilesCollectionCountIsOne: filesCollectionCountIsOne,
|
||||||
|
@ -921,7 +921,7 @@ public partial class MapLogic : Shared.Models.Methods.IMapLogic
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LookForAbandoned(Property.Models.Configuration propertyConfiguration, string bResultsFullGroupDirectory, ReadOnlyCollection<Container.Models.Container> readOnlyContainers, string cResultsFullGroupDirectory, string dResultsFullGroupDirectory, string d2ResultsFullGroupDirectory, Action? tick)
|
public void LookForAbandoned(Property.Models.Configuration propertyConfiguration, string aResultsFullGroupDirectory, ReadOnlyCollection<Container.Models.Container> readOnlyContainers, string cResultsFullGroupDirectory, string dResultsFullGroupDirectory, string d2ResultsFullGroupDirectory, Action? tick)
|
||||||
{
|
{
|
||||||
string[] directories;
|
string[] directories;
|
||||||
string? directoryName;
|
string? directoryName;
|
||||||
@ -929,7 +929,7 @@ public partial class MapLogic : Shared.Models.Methods.IMapLogic
|
|||||||
LookForAbandoned(propertyConfiguration, distinctFilteredIds);
|
LookForAbandoned(propertyConfiguration, distinctFilteredIds);
|
||||||
tick?.Invoke();
|
tick?.Invoke();
|
||||||
List<string> distinctFilteredFileNameFirstSegments = Container.Models.Stateless.Methods.IContainer.GetFilteredDistinctFileNameFirstSegments(propertyConfiguration, readOnlyContainers);
|
List<string> distinctFilteredFileNameFirstSegments = Container.Models.Stateless.Methods.IContainer.GetFilteredDistinctFileNameFirstSegments(propertyConfiguration, readOnlyContainers);
|
||||||
Stateless.LookForAbandonedLogic.LookForAbandoned(propertyConfiguration, bResultsFullGroupDirectory, distinctFilteredFileNameFirstSegments);
|
Stateless.LookForAbandonedLogic.LookForAbandoned(propertyConfiguration, aResultsFullGroupDirectory, distinctFilteredFileNameFirstSegments);
|
||||||
tick?.Invoke();
|
tick?.Invoke();
|
||||||
directories = Directory.GetDirectories(cResultsFullGroupDirectory, "*", SearchOption.TopDirectoryOnly);
|
directories = Directory.GetDirectories(cResultsFullGroupDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||||
foreach (string directory in directories)
|
foreach (string directory in directories)
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -35,9 +35,9 @@ internal abstract class LookForAbandonedLogic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void LookForAbandoned(Property.Models.Configuration propertyConfiguration, string bResultsFullGroupDirectory, List<string> distinctFilteredFileNameFirstSegments)
|
internal static void LookForAbandoned(Property.Models.Configuration propertyConfiguration, string aResultsFullGroupDirectory, List<string> distinctFilteredFileNameFirstSegments)
|
||||||
{
|
{
|
||||||
string[] directories = Directory.GetDirectories(bResultsFullGroupDirectory, "*", SearchOption.TopDirectoryOnly);
|
string[] directories = Directory.GetDirectories(aResultsFullGroupDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||||
foreach (string directory in directories)
|
foreach (string directory in directories)
|
||||||
{
|
{
|
||||||
string? directoryName = Path.GetFileName(directory);
|
string? directoryName = Path.GetFileName(directory);
|
||||||
|
@ -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);
|
||||||
|
@ -68,28 +68,54 @@
|
|||||||
"ResultSingleton": "{}",
|
"ResultSingleton": "{}",
|
||||||
"RootDirectory": "D:/Images",
|
"RootDirectory": "D:/Images",
|
||||||
"IgnoreExtensions": [
|
"IgnoreExtensions": [
|
||||||
|
".ffs_db",
|
||||||
|
".FFS_DB",
|
||||||
".gif",
|
".gif",
|
||||||
".GIF",
|
".GIF",
|
||||||
|
".heic",
|
||||||
|
".HEIC",
|
||||||
|
".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": [
|
||||||
|
".avif",
|
||||||
".bmp",
|
".bmp",
|
||||||
".BMP",
|
|
||||||
".gif",
|
".gif",
|
||||||
".GIF",
|
".heic",
|
||||||
|
".insp",
|
||||||
|
".jp2",
|
||||||
|
".jpe",
|
||||||
".jpeg",
|
".jpeg",
|
||||||
".JPEG",
|
|
||||||
".jpg",
|
".jpg",
|
||||||
".JPG",
|
".jxl",
|
||||||
".png",
|
".png",
|
||||||
".PNG",
|
".psd",
|
||||||
".tiff",
|
".raw",
|
||||||
".TIFF",
|
".rw2",
|
||||||
|
".svg",
|
||||||
".tif",
|
".tif",
|
||||||
".TIF"
|
".tiff",
|
||||||
|
".webp"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ namespace View_by_Distance.Metadata.Models;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
// Dictionary<string, List<KeyValuePair<string, string>>>
|
// Dictionary<string, List<KeyValuePair<string, string>>>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class B_Metadata : IMetadata<MetadataExtractor.Directory>
|
public class A_Metadata : IMetadata<MetadataExtractor.Directory>
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly Dictionary<int, ExifDirectory> _ExifDirectoriesById;
|
private readonly Dictionary<int, ExifDirectory> _ExifDirectoriesById;
|
||||||
@ -32,14 +32,14 @@ public class B_Metadata : IMetadata<MetadataExtractor.Directory>
|
|||||||
private readonly JsonSerializerOptions _WriteIndentedJsonSerializerOptions;
|
private readonly JsonSerializerOptions _WriteIndentedJsonSerializerOptions;
|
||||||
private readonly ReadOnlyDictionary<byte, ReadOnlyCollection<string>>[] _ResultSingletonFileGroups;
|
private readonly ReadOnlyDictionary<byte, ReadOnlyCollection<string>>[] _ResultSingletonFileGroups;
|
||||||
|
|
||||||
public B_Metadata(IDlibDotNet? dlibDotNet, IPropertyConfiguration propertyConfiguration, bool forceMetadataLastWriteTimeToCreationTime, bool propertiesChangedForMetadata, long ticks, string bResultsFullGroupDirectory)
|
public A_Metadata(IDlibDotNet? dlibDotNet, IPropertyConfiguration propertyConfiguration, bool forceMetadataLastWriteTimeToCreationTime, bool propertiesChangedForMetadata, long ticks, string aResultsFullGroupDirectory)
|
||||||
{
|
{
|
||||||
_PropertyConfiguration = propertyConfiguration;
|
_PropertyConfiguration = propertyConfiguration;
|
||||||
_PropertiesChangedForMetadata = propertiesChangedForMetadata;
|
_PropertiesChangedForMetadata = propertiesChangedForMetadata;
|
||||||
_ForceMetadataLastWriteTimeToCreationTime = forceMetadataLastWriteTimeToCreationTime;
|
_ForceMetadataLastWriteTimeToCreationTime = forceMetadataLastWriteTimeToCreationTime;
|
||||||
_ResultSingletonFileGroups = [new(new Dictionary<byte, ReadOnlyCollection<string>>())];
|
_ResultSingletonFileGroups = [new(new Dictionary<byte, ReadOnlyCollection<string>>())];
|
||||||
_WriteIndentedJsonSerializerOptions = new JsonSerializerOptions { WriteIndented = true };
|
_WriteIndentedJsonSerializerOptions = new JsonSerializerOptions { WriteIndented = true };
|
||||||
ReadOnlyDictionary<string, ReadOnlyDictionary<byte, ReadOnlyCollection<string>>> keyValuePairs = Shared.Models.Stateless.Methods.IPath.GetKeyValuePairs(propertyConfiguration, bResultsFullGroupDirectory, [propertyConfiguration.ResultSingleton]);
|
ReadOnlyDictionary<string, ReadOnlyDictionary<byte, ReadOnlyCollection<string>>> keyValuePairs = Shared.Models.Stateless.Methods.IPath.GetKeyValuePairs(propertyConfiguration, aResultsFullGroupDirectory, [propertyConfiguration.ResultSingleton]);
|
||||||
foreach (KeyValuePair<string, ReadOnlyDictionary<byte, ReadOnlyCollection<string>>> keyValuePair in keyValuePairs)
|
foreach (KeyValuePair<string, ReadOnlyDictionary<byte, ReadOnlyCollection<string>>> keyValuePair in keyValuePairs)
|
||||||
{
|
{
|
||||||
if (keyValuePair.Key == _PropertyConfiguration.ResultSingleton)
|
if (keyValuePair.Key == _PropertyConfiguration.ResultSingleton)
|
||||||
@ -56,13 +56,10 @@ public class B_Metadata : IMetadata<MetadataExtractor.Directory>
|
|||||||
Action? tick = dlibDotNet is null ? null : dlibDotNet.Tick;
|
Action? tick = dlibDotNet is null ? null : dlibDotNet.Tick;
|
||||||
filesCollectionRootDirectory = propertyConfiguration.RootDirectory;
|
filesCollectionRootDirectory = propertyConfiguration.RootDirectory;
|
||||||
ParallelOptions parallelOptions = new() { MaxDegreeOfParallelism = maxDegreeOfParallelism };
|
ParallelOptions parallelOptions = new() { MaxDegreeOfParallelism = maxDegreeOfParallelism };
|
||||||
string jsonGroupSingletonDirectory = Path.Combine(bResultsFullGroupDirectory, propertyConfiguration.ResultSingleton);
|
string jsonGroupSingletonDirectory = Path.Combine(aResultsFullGroupDirectory, propertyConfiguration.ResultSingleton);
|
||||||
string jsonGroupCollectionDirectory = Path.Combine(bResultsFullGroupDirectory, propertyConfiguration.ResultCollection);
|
|
||||||
ReadOnlyCollection<string> directories = new([jsonGroupSingletonDirectory, jsonGroupCollectionDirectory]);
|
|
||||||
Shared.Models.Stateless.Methods.IPath.CreateDirectories(directories);
|
|
||||||
ReadOnlyCollection<ReadOnlyCollection<FilePath>> filePathsCollection = IDirectory.GetFilePathCollections(propertyConfiguration, directorySearchFilter, fileSearchFilter, filesCollectionRootDirectory, useIgnoreExtensions: true, useCeilingAverage: false);
|
ReadOnlyCollection<ReadOnlyCollection<FilePath>> filePathsCollection = IDirectory.GetFilePathCollections(propertyConfiguration, directorySearchFilter, fileSearchFilter, filesCollectionRootDirectory, useIgnoreExtensions: true, useCeilingAverage: false);
|
||||||
ReadOnlyCollection<FilePair> filePairs = IFilePair.GetFilePairs(propertyConfiguration, directorySearchFilter, extension, jsonGroupSingletonDirectory, filePathsCollection);
|
ReadOnlyCollection<FilePair> filePairs = IFilePair.GetFilePairs(propertyConfiguration, directorySearchFilter, extension, jsonGroupSingletonDirectory, filePathsCollection);
|
||||||
string message = $") {nameof(B_Metadata)} - Preloading ExifDirectory Dictionary - {(int)Math.Floor(new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds)} total second(s)";
|
string message = $") {nameof(A_Metadata)} - Preloading ExifDirectory Dictionary - {(int)Math.Floor(new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds)} total second(s)";
|
||||||
dlibDotNet?.ConstructProgressBar(filePairs.Count, message);
|
dlibDotNet?.ConstructProgressBar(filePairs.Count, message);
|
||||||
_ = Parallel.For(0, filePairs.Count, parallelOptions, (i, state) => ParallelFor(filePairs[i], exifDirectoriesById, tick));
|
_ = Parallel.For(0, filePairs.Count, parallelOptions, (i, state) => ParallelFor(filePairs[i], exifDirectoriesById, tick));
|
||||||
_ExifDirectoriesById = exifDirectoriesById;
|
_ExifDirectoriesById = exifDirectoriesById;
|
||||||
@ -156,12 +153,12 @@ public class B_Metadata : IMetadata<MetadataExtractor.Directory>
|
|||||||
result = JsonSerializer.Deserialize(json, ExifDirectorySourceGenerationContext.Default.ExifDirectory);
|
result = JsonSerializer.Deserialize(json, ExifDirectorySourceGenerationContext.Default.ExifDirectory);
|
||||||
if (result is null)
|
if (result is null)
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
subFileTuples.Add(new Tuple<string, DateTime>(nameof(B_Metadata), fileInfo.LastWriteTime));
|
subFileTuples.Add(new Tuple<string, DateTime>(nameof(A_Metadata), fileInfo.LastWriteTime));
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
result = null;
|
result = null;
|
||||||
parseExceptions.Add(nameof(B_Metadata));
|
parseExceptions.Add(nameof(A_Metadata));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result is null)
|
if (result is null)
|
||||||
@ -173,12 +170,12 @@ public class B_Metadata : IMetadata<MetadataExtractor.Directory>
|
|||||||
if (Shared.Models.Stateless.Methods.IPath.WriteAllText(fileInfo.FullName, json, updateDateWhenMatches, compareBeforeWrite: true, updateToWhenMatches: dateTime))
|
if (Shared.Models.Stateless.Methods.IPath.WriteAllText(fileInfo.FullName, json, updateDateWhenMatches, compareBeforeWrite: true, updateToWhenMatches: dateTime))
|
||||||
{
|
{
|
||||||
if (!_ForceMetadataLastWriteTimeToCreationTime)
|
if (!_ForceMetadataLastWriteTimeToCreationTime)
|
||||||
subFileTuples.Add(new Tuple<string, DateTime>(nameof(B_Metadata), DateTime.Now));
|
subFileTuples.Add(new Tuple<string, DateTime>(nameof(A_Metadata), DateTime.Now));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
File.SetLastWriteTime(fileInfo.FullName, fileInfo.CreationTime);
|
File.SetLastWriteTime(fileInfo.FullName, fileInfo.CreationTime);
|
||||||
fileInfo.Refresh();
|
fileInfo.Refresh();
|
||||||
subFileTuples.Add(new Tuple<string, DateTime>(nameof(B_Metadata), fileInfo.CreationTime));
|
subFileTuples.Add(new Tuple<string, DateTime>(nameof(A_Metadata), fileInfo.CreationTime));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -28,22 +28,24 @@ internal abstract class Exif
|
|||||||
private static Shared.Models.AviDirectory[] GetAviDirectories(IReadOnlyList<MetadataExtractor.Directory> directories)
|
private static Shared.Models.AviDirectory[] GetAviDirectories(IReadOnlyList<MetadataExtractor.Directory> directories)
|
||||||
{
|
{
|
||||||
List<Shared.Models.AviDirectory> results = [];
|
List<Shared.Models.AviDirectory> results = [];
|
||||||
|
Shared.Models.AviDirectory aviDirectory;
|
||||||
IEnumerable<MetadataExtractor.Formats.Avi.AviDirectory> aviDirectories = directories.OfType<MetadataExtractor.Formats.Avi.AviDirectory>();
|
IEnumerable<MetadataExtractor.Formats.Avi.AviDirectory> aviDirectories = directories.OfType<MetadataExtractor.Formats.Avi.AviDirectory>();
|
||||||
foreach (MetadataExtractor.Formats.Avi.AviDirectory aviDirectory in aviDirectories)
|
foreach (MetadataExtractor.Formats.Avi.AviDirectory a in aviDirectories)
|
||||||
{
|
{
|
||||||
if (aviDirectory.Tags.Count == 0)
|
if (a.Tags.Count == 0)
|
||||||
continue;
|
continue;
|
||||||
DateTime? dateTimeOriginal;
|
DateTime? dateTimeOriginal;
|
||||||
string? duration = aviDirectory.GetDescription(MetadataExtractor.Formats.Avi.AviDirectory.TagDuration);
|
string? duration = a.GetDescription(MetadataExtractor.Formats.Avi.AviDirectory.TagDuration);
|
||||||
string? height = aviDirectory.GetDescription(MetadataExtractor.Formats.Avi.AviDirectory.TagHeight);
|
string? height = a.GetDescription(MetadataExtractor.Formats.Avi.AviDirectory.TagHeight);
|
||||||
string? width = aviDirectory.GetDescription(MetadataExtractor.Formats.Avi.AviDirectory.TagWidth);
|
string? width = a.GetDescription(MetadataExtractor.Formats.Avi.AviDirectory.TagWidth);
|
||||||
if (aviDirectory.TryGetDateTime(MetadataExtractor.Formats.Avi.AviDirectory.TagDateTimeOriginal, out DateTime checkDateTime))
|
if (a.TryGetDateTime(MetadataExtractor.Formats.Avi.AviDirectory.TagDateTimeOriginal, out DateTime checkDateTime))
|
||||||
dateTimeOriginal = checkDateTime;
|
dateTimeOriginal = checkDateTime;
|
||||||
else
|
else
|
||||||
dateTimeOriginal = GetDateTime(aviDirectory.GetString(MetadataExtractor.Formats.Avi.AviDirectory.TagDateTimeOriginal));
|
dateTimeOriginal = GetDateTime(a.GetString(MetadataExtractor.Formats.Avi.AviDirectory.TagDateTimeOriginal));
|
||||||
if (dateTimeOriginal is null && duration is null && height is null && width is null)
|
if (dateTimeOriginal is null && duration is null && height is null && width is null)
|
||||||
continue;
|
continue;
|
||||||
results.Add(new(dateTimeOriginal, duration, height, width));
|
aviDirectory = new(DateTimeOriginal: dateTimeOriginal, Duration: duration, Height: height, Width: width);
|
||||||
|
results.Add(aviDirectory);
|
||||||
}
|
}
|
||||||
return results.ToArray();
|
return results.ToArray();
|
||||||
}
|
}
|
||||||
@ -51,72 +53,73 @@ internal abstract class Exif
|
|||||||
private static Shared.Models.ExifDirectoryBase[] GetExifBaseDirectories(IReadOnlyList<MetadataExtractor.Directory> directories)
|
private static Shared.Models.ExifDirectoryBase[] GetExifBaseDirectories(IReadOnlyList<MetadataExtractor.Directory> directories)
|
||||||
{
|
{
|
||||||
List<Shared.Models.ExifDirectoryBase> results = [];
|
List<Shared.Models.ExifDirectoryBase> results = [];
|
||||||
|
Shared.Models.ExifDirectoryBase exifDirectoryBase;
|
||||||
IEnumerable<ExifDirectoryBase> exifBaseDirectories = directories.OfType<ExifDirectoryBase>();
|
IEnumerable<ExifDirectoryBase> exifBaseDirectories = directories.OfType<ExifDirectoryBase>();
|
||||||
foreach (ExifDirectoryBase exifDirectoryBase in exifBaseDirectories)
|
foreach (ExifDirectoryBase e in exifBaseDirectories)
|
||||||
{
|
{
|
||||||
if (exifDirectoryBase.Tags.Count == 0)
|
if (e.Tags.Count == 0)
|
||||||
continue;
|
continue;
|
||||||
DateTime? dateTime;
|
DateTime? dateTime;
|
||||||
DateTime checkDateTime;
|
DateTime checkDateTime;
|
||||||
DateTime? dateTimeOriginal;
|
DateTime? dateTimeOriginal;
|
||||||
DateTime? dateTimeDigitized;
|
DateTime? dateTimeDigitized;
|
||||||
string? aperture = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagAperture);
|
string? aperture = e.GetDescription(ExifDirectoryBase.TagAperture);
|
||||||
string? applicationNotes = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagApplicationNotes);
|
string? applicationNotes = e.GetDescription(ExifDirectoryBase.TagApplicationNotes);
|
||||||
string? artist = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagArtist);
|
string? artist = e.GetDescription(ExifDirectoryBase.TagArtist);
|
||||||
string? bitsPerSample = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagBitsPerSample);
|
string? bitsPerSample = e.GetDescription(ExifDirectoryBase.TagBitsPerSample);
|
||||||
string? bodySerialNumber = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagBodySerialNumber);
|
string? bodySerialNumber = e.GetDescription(ExifDirectoryBase.TagBodySerialNumber);
|
||||||
string? cameraOwnerName = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagCameraOwnerName);
|
string? cameraOwnerName = e.GetDescription(ExifDirectoryBase.TagCameraOwnerName);
|
||||||
string? compressedAverageBitsPerPixel = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagCompressedAverageBitsPerPixel);
|
string? compressedAverageBitsPerPixel = e.GetDescription(ExifDirectoryBase.TagCompressedAverageBitsPerPixel);
|
||||||
string? compression = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagCompression);
|
string? compression = e.GetDescription(ExifDirectoryBase.TagCompression);
|
||||||
string? copyright = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagCopyright);
|
string? copyright = e.GetDescription(ExifDirectoryBase.TagCopyright);
|
||||||
string? documentName = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagDocumentName);
|
string? documentName = e.GetDescription(ExifDirectoryBase.TagDocumentName);
|
||||||
string? exifVersion = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagExifVersion);
|
string? exifVersion = e.GetDescription(ExifDirectoryBase.TagExifVersion);
|
||||||
string? exposureTime = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagExposureTime);
|
string? exposureTime = e.GetDescription(ExifDirectoryBase.TagExposureTime);
|
||||||
string? fileSource = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagFileSource);
|
string? fileSource = e.GetDescription(ExifDirectoryBase.TagFileSource);
|
||||||
string? imageDescription = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagImageDescription);
|
string? imageDescription = e.GetDescription(ExifDirectoryBase.TagImageDescription);
|
||||||
string? imageHeight = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagImageHeight);
|
string? imageHeight = e.GetDescription(ExifDirectoryBase.TagImageHeight);
|
||||||
int? imageHeightValue = imageHeight is null ? null : exifDirectoryBase.GetInt32(ExifDirectoryBase.TagImageHeight);
|
int? imageHeightValue = imageHeight is null ? null : e.GetInt32(ExifDirectoryBase.TagImageHeight);
|
||||||
string? imageNumber = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagImageNumber);
|
string? imageNumber = e.GetDescription(ExifDirectoryBase.TagImageNumber);
|
||||||
string? imageUniqueId = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagImageUniqueId);
|
string? imageUniqueId = e.GetDescription(ExifDirectoryBase.TagImageUniqueId);
|
||||||
string? imageWidth = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagImageWidth);
|
string? imageWidth = e.GetDescription(ExifDirectoryBase.TagImageWidth);
|
||||||
int? imageWidthValue = imageWidth is null ? null : exifDirectoryBase.GetInt32(ExifDirectoryBase.TagImageWidth);
|
int? imageWidthValue = imageWidth is null ? null : e.GetInt32(ExifDirectoryBase.TagImageWidth);
|
||||||
string? isoSpeed = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagIsoSpeed);
|
string? isoSpeed = e.GetDescription(ExifDirectoryBase.TagIsoSpeed);
|
||||||
string? lensMake = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagLensMake);
|
string? lensMake = e.GetDescription(ExifDirectoryBase.TagLensMake);
|
||||||
string? lensModel = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagLensModel);
|
string? lensModel = e.GetDescription(ExifDirectoryBase.TagLensModel);
|
||||||
string? lensSerialNumber = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagLensSerialNumber);
|
string? lensSerialNumber = e.GetDescription(ExifDirectoryBase.TagLensSerialNumber);
|
||||||
string? make = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagMake);
|
string? make = e.GetDescription(ExifDirectoryBase.TagMake);
|
||||||
string? makerNote = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagMakernote);
|
string? makerNote = e.GetDescription(ExifDirectoryBase.TagMakernote);
|
||||||
string? model = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagModel);
|
string? model = e.GetDescription(ExifDirectoryBase.TagModel);
|
||||||
string? orientation = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagOrientation);
|
string? orientation = e.GetDescription(ExifDirectoryBase.TagOrientation);
|
||||||
int? orientationValue = orientation is null ? null : exifDirectoryBase.GetInt32(ExifDirectoryBase.TagOrientation);
|
int? orientationValue = orientation is null ? null : e.GetInt32(ExifDirectoryBase.TagOrientation);
|
||||||
string? rating = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagRating);
|
string? rating = e.GetDescription(ExifDirectoryBase.TagRating);
|
||||||
string? ratingPercent = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagRatingPercent);
|
string? ratingPercent = e.GetDescription(ExifDirectoryBase.TagRatingPercent);
|
||||||
string? securityClassification = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagSecurityClassification);
|
string? securityClassification = e.GetDescription(ExifDirectoryBase.TagSecurityClassification);
|
||||||
string? shutterSpeed = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagShutterSpeed);
|
string? shutterSpeed = e.GetDescription(ExifDirectoryBase.TagShutterSpeed);
|
||||||
string? software = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagSoftware);
|
string? software = e.GetDescription(ExifDirectoryBase.TagSoftware);
|
||||||
string? timeZone = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagTimeZone);
|
string? timeZone = e.GetDescription(ExifDirectoryBase.TagTimeZone);
|
||||||
string? timeZoneDigitized = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagTimeZoneDigitized);
|
string? timeZoneDigitized = e.GetDescription(ExifDirectoryBase.TagTimeZoneDigitized);
|
||||||
string? timeZoneOriginal = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagTimeZoneOriginal);
|
string? timeZoneOriginal = e.GetDescription(ExifDirectoryBase.TagTimeZoneOriginal);
|
||||||
string? userComment = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagUserComment);
|
string? userComment = e.GetDescription(ExifDirectoryBase.TagUserComment);
|
||||||
string? winAuthor = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagWinAuthor);
|
string? winAuthor = e.GetDescription(ExifDirectoryBase.TagWinAuthor);
|
||||||
string? winComment = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagWinComment);
|
string? winComment = e.GetDescription(ExifDirectoryBase.TagWinComment);
|
||||||
string? winKeywords = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagWinKeywords);
|
string? winKeywords = e.GetDescription(ExifDirectoryBase.TagWinKeywords);
|
||||||
string? winSubject = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagWinSubject);
|
string? winSubject = e.GetDescription(ExifDirectoryBase.TagWinSubject);
|
||||||
string? winTitle = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagWinTitle);
|
string? winTitle = e.GetDescription(ExifDirectoryBase.TagWinTitle);
|
||||||
string? xResolution = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagXResolution);
|
string? xResolution = e.GetDescription(ExifDirectoryBase.TagXResolution);
|
||||||
string? yResolution = exifDirectoryBase.GetDescription(ExifDirectoryBase.TagYResolution);
|
string? yResolution = e.GetDescription(ExifDirectoryBase.TagYResolution);
|
||||||
if (exifDirectoryBase.TryGetDateTime(ExifDirectoryBase.TagDateTime, out checkDateTime))
|
if (e.TryGetDateTime(ExifDirectoryBase.TagDateTime, out checkDateTime))
|
||||||
dateTime = checkDateTime;
|
dateTime = checkDateTime;
|
||||||
else
|
else
|
||||||
dateTime = GetDateTime(exifDirectoryBase.GetString(ExifDirectoryBase.TagDateTime));
|
dateTime = GetDateTime(e.GetString(ExifDirectoryBase.TagDateTime));
|
||||||
if (exifDirectoryBase.TryGetDateTime(ExifDirectoryBase.TagDateTimeOriginal, out checkDateTime))
|
if (e.TryGetDateTime(ExifDirectoryBase.TagDateTimeOriginal, out checkDateTime))
|
||||||
dateTimeOriginal = checkDateTime;
|
dateTimeOriginal = checkDateTime;
|
||||||
else
|
else
|
||||||
dateTimeOriginal = GetDateTime(exifDirectoryBase.GetString(ExifDirectoryBase.TagDateTimeOriginal));
|
dateTimeOriginal = GetDateTime(e.GetString(ExifDirectoryBase.TagDateTimeOriginal));
|
||||||
if (exifDirectoryBase.TryGetDateTime(ExifDirectoryBase.TagDateTimeDigitized, out checkDateTime))
|
if (e.TryGetDateTime(ExifDirectoryBase.TagDateTimeDigitized, out checkDateTime))
|
||||||
dateTimeDigitized = checkDateTime;
|
dateTimeDigitized = checkDateTime;
|
||||||
else
|
else
|
||||||
dateTimeDigitized = GetDateTime(exifDirectoryBase.GetString(ExifDirectoryBase.TagDateTimeDigitized));
|
dateTimeDigitized = GetDateTime(e.GetString(ExifDirectoryBase.TagDateTimeDigitized));
|
||||||
if (userComment is not null && userComment.Length > 255)
|
if (userComment is not null && userComment.Length > 255)
|
||||||
userComment = "...";
|
userComment = "...";
|
||||||
if (aperture is null
|
if (aperture is null
|
||||||
@ -166,7 +169,7 @@ internal abstract class Exif
|
|||||||
&& xResolution is not null
|
&& xResolution is not null
|
||||||
&& yResolution is null)
|
&& yResolution is null)
|
||||||
continue;
|
continue;
|
||||||
results.Add(new(Aperture: aperture,
|
exifDirectoryBase = new(Aperture: aperture,
|
||||||
ApplicationNotes: applicationNotes,
|
ApplicationNotes: applicationNotes,
|
||||||
Artist: artist,
|
Artist: artist,
|
||||||
BitsPerSample: bitsPerSample,
|
BitsPerSample: bitsPerSample,
|
||||||
@ -213,7 +216,8 @@ internal abstract class Exif
|
|||||||
WinSubject: winSubject,
|
WinSubject: winSubject,
|
||||||
WinTitle: winTitle,
|
WinTitle: winTitle,
|
||||||
XResolution: xResolution,
|
XResolution: xResolution,
|
||||||
YResolution: yResolution));
|
YResolution: yResolution);
|
||||||
|
results.Add(exifDirectoryBase);
|
||||||
}
|
}
|
||||||
return results.ToArray();
|
return results.ToArray();
|
||||||
}
|
}
|
||||||
@ -221,23 +225,25 @@ internal abstract class Exif
|
|||||||
private static Shared.Models.FileMetadataDirectory[] GetFileMetadataDirectories(string file, IReadOnlyList<MetadataExtractor.Directory> directories)
|
private static Shared.Models.FileMetadataDirectory[] GetFileMetadataDirectories(string file, IReadOnlyList<MetadataExtractor.Directory> directories)
|
||||||
{
|
{
|
||||||
List<Shared.Models.FileMetadataDirectory> results = [];
|
List<Shared.Models.FileMetadataDirectory> results = [];
|
||||||
|
Shared.Models.FileMetadataDirectory fileMetadataDirectory;
|
||||||
IEnumerable<MetadataExtractor.Formats.FileSystem.FileMetadataDirectory> fileMetadataDirectories = directories.OfType<MetadataExtractor.Formats.FileSystem.FileMetadataDirectory>();
|
IEnumerable<MetadataExtractor.Formats.FileSystem.FileMetadataDirectory> fileMetadataDirectories = directories.OfType<MetadataExtractor.Formats.FileSystem.FileMetadataDirectory>();
|
||||||
foreach (MetadataExtractor.Formats.FileSystem.FileMetadataDirectory fileMetadataDirectory in fileMetadataDirectories)
|
foreach (MetadataExtractor.Formats.FileSystem.FileMetadataDirectory f in fileMetadataDirectories)
|
||||||
{
|
{
|
||||||
if (fileMetadataDirectory.Tags.Count == 0)
|
if (f.Tags.Count == 0)
|
||||||
continue;
|
continue;
|
||||||
DateTime? fileModifiedDate;
|
DateTime? fileModifiedDate;
|
||||||
string? fileName = fileMetadataDirectory.GetDescription(MetadataExtractor.Formats.FileSystem.FileMetadataDirectory.TagFileName);
|
string? fileName = f.GetDescription(MetadataExtractor.Formats.FileSystem.FileMetadataDirectory.TagFileName);
|
||||||
string? fileSize = fileMetadataDirectory.GetDescription(MetadataExtractor.Formats.FileSystem.FileMetadataDirectory.TagFileSize);
|
string? fileSize = f.GetDescription(MetadataExtractor.Formats.FileSystem.FileMetadataDirectory.TagFileSize);
|
||||||
if (fileMetadataDirectory.TryGetDateTime(MetadataExtractor.Formats.FileSystem.FileMetadataDirectory.TagFileModifiedDate, out DateTime checkDateTime))
|
if (f.TryGetDateTime(MetadataExtractor.Formats.FileSystem.FileMetadataDirectory.TagFileModifiedDate, out DateTime checkDateTime))
|
||||||
fileModifiedDate = checkDateTime;
|
fileModifiedDate = checkDateTime;
|
||||||
else
|
else
|
||||||
fileModifiedDate = GetDateTime(fileMetadataDirectory.GetString(MetadataExtractor.Formats.FileSystem.FileMetadataDirectory.TagFileModifiedDate));
|
fileModifiedDate = GetDateTime(f.GetString(MetadataExtractor.Formats.FileSystem.FileMetadataDirectory.TagFileModifiedDate));
|
||||||
if (fileName is null || !file.EndsWith(fileName))
|
if (fileName is null || !file.EndsWith(fileName))
|
||||||
throw new NotSupportedException($"!{file}.EndsWith({fileName})");
|
throw new NotSupportedException($"!{file}.EndsWith({fileName})");
|
||||||
if (fileModifiedDate is null && fileName is null && fileSize is null)
|
if (fileModifiedDate is null && fileName is null && fileSize is null)
|
||||||
continue;
|
continue;
|
||||||
results.Add(new(fileModifiedDate, fileName, fileSize));
|
fileMetadataDirectory = new(FileModifiedDate: fileModifiedDate, FileName: fileName, FileSize: fileSize);
|
||||||
|
results.Add(fileMetadataDirectory);
|
||||||
}
|
}
|
||||||
return results.ToArray();
|
return results.ToArray();
|
||||||
}
|
}
|
||||||
@ -245,16 +251,18 @@ internal abstract class Exif
|
|||||||
private static Shared.Models.GifHeaderDirectory[] GetGifHeaderDirectories(IReadOnlyList<MetadataExtractor.Directory> directories)
|
private static Shared.Models.GifHeaderDirectory[] GetGifHeaderDirectories(IReadOnlyList<MetadataExtractor.Directory> directories)
|
||||||
{
|
{
|
||||||
List<Shared.Models.GifHeaderDirectory> results = [];
|
List<Shared.Models.GifHeaderDirectory> results = [];
|
||||||
|
Shared.Models.GifHeaderDirectory gifHeaderDirectory;
|
||||||
IEnumerable<MetadataExtractor.Formats.Gif.GifHeaderDirectory> gifHeaderDirectories = directories.OfType<MetadataExtractor.Formats.Gif.GifHeaderDirectory>();
|
IEnumerable<MetadataExtractor.Formats.Gif.GifHeaderDirectory> gifHeaderDirectories = directories.OfType<MetadataExtractor.Formats.Gif.GifHeaderDirectory>();
|
||||||
foreach (MetadataExtractor.Formats.Gif.GifHeaderDirectory gifHeaderDirectory in gifHeaderDirectories)
|
foreach (MetadataExtractor.Formats.Gif.GifHeaderDirectory g in gifHeaderDirectories)
|
||||||
{
|
{
|
||||||
if (gifHeaderDirectory.Tags.Count == 0)
|
if (g.Tags.Count == 0)
|
||||||
continue;
|
continue;
|
||||||
string? imageHeight = gifHeaderDirectory.GetDescription(MetadataExtractor.Formats.Gif.GifHeaderDirectory.TagImageHeight);
|
string? imageHeight = g.GetDescription(MetadataExtractor.Formats.Gif.GifHeaderDirectory.TagImageHeight);
|
||||||
string? imageWidth = gifHeaderDirectory.GetDescription(MetadataExtractor.Formats.Gif.GifHeaderDirectory.TagImageWidth);
|
string? imageWidth = g.GetDescription(MetadataExtractor.Formats.Gif.GifHeaderDirectory.TagImageWidth);
|
||||||
if (imageHeight is null && imageWidth is null)
|
if (imageHeight is null && imageWidth is null)
|
||||||
continue;
|
continue;
|
||||||
results.Add(new(imageHeight, imageWidth));
|
gifHeaderDirectory = new(ImageHeight: imageHeight, ImageWidth: imageWidth);
|
||||||
|
results.Add(gifHeaderDirectory);
|
||||||
}
|
}
|
||||||
return results.ToArray();
|
return results.ToArray();
|
||||||
}
|
}
|
||||||
@ -262,29 +270,31 @@ internal abstract class Exif
|
|||||||
private static Shared.Models.GpsDirectory[] GetGpsDirectories(IReadOnlyList<MetadataExtractor.Directory> directories)
|
private static Shared.Models.GpsDirectory[] GetGpsDirectories(IReadOnlyList<MetadataExtractor.Directory> directories)
|
||||||
{
|
{
|
||||||
List<Shared.Models.GpsDirectory> results = [];
|
List<Shared.Models.GpsDirectory> results = [];
|
||||||
|
Shared.Models.GpsDirectory gpsDirectory;
|
||||||
IEnumerable<GpsDirectory> gpsDirectories = directories.OfType<GpsDirectory>();
|
IEnumerable<GpsDirectory> gpsDirectories = directories.OfType<GpsDirectory>();
|
||||||
foreach (GpsDirectory gpsDirectory in gpsDirectories)
|
foreach (GpsDirectory g in gpsDirectories)
|
||||||
{
|
{
|
||||||
if (gpsDirectory.Tags.Count == 0)
|
if (g.Tags.Count == 0)
|
||||||
continue;
|
continue;
|
||||||
DateTime? timeStamp;
|
DateTime? timeStamp;
|
||||||
string? altitude = gpsDirectory.GetDescription(GpsDirectory.TagAltitude);
|
string? altitude = g.GetDescription(GpsDirectory.TagAltitude);
|
||||||
string? latitude = gpsDirectory.GetDescription(GpsDirectory.TagLatitude);
|
string? latitude = g.GetDescription(GpsDirectory.TagLatitude);
|
||||||
string? latitudeRef = gpsDirectory.GetDescription(GpsDirectory.TagLatitudeRef);
|
string? latitudeRef = g.GetDescription(GpsDirectory.TagLatitudeRef);
|
||||||
string? longitude = gpsDirectory.GetDescription(GpsDirectory.TagLongitude);
|
string? longitude = g.GetDescription(GpsDirectory.TagLongitude);
|
||||||
string? longitudeRef = gpsDirectory.GetDescription(GpsDirectory.TagLongitudeRef);
|
string? longitudeRef = g.GetDescription(GpsDirectory.TagLongitudeRef);
|
||||||
if (gpsDirectory.TryGetDateTime(GpsDirectory.TagTimeStamp, out DateTime checkDateTime))
|
if (g.TryGetDateTime(GpsDirectory.TagTimeStamp, out DateTime checkDateTime))
|
||||||
timeStamp = checkDateTime;
|
timeStamp = checkDateTime;
|
||||||
else
|
else
|
||||||
timeStamp = GetDateTime(gpsDirectory.GetString(GpsDirectory.TagTimeStamp));
|
timeStamp = GetDateTime(g.GetString(GpsDirectory.TagTimeStamp));
|
||||||
if (altitude is null && latitude is null && latitudeRef is null && longitude is null && longitudeRef is null && timeStamp is null)
|
if (altitude is null && latitude is null && latitudeRef is null && longitude is null && longitudeRef is null && timeStamp is null)
|
||||||
continue;
|
continue;
|
||||||
results.Add(new(altitude,
|
gpsDirectory = new(Altitude: altitude,
|
||||||
latitude,
|
Latitude: latitude,
|
||||||
latitudeRef,
|
LatitudeRef: latitudeRef,
|
||||||
longitude,
|
Longitude: longitude,
|
||||||
longitudeRef,
|
LongitudeRef: longitudeRef,
|
||||||
timeStamp));
|
TimeStamp: timeStamp);
|
||||||
|
results.Add(gpsDirectory);
|
||||||
}
|
}
|
||||||
return results.ToArray();
|
return results.ToArray();
|
||||||
}
|
}
|
||||||
@ -292,16 +302,18 @@ internal abstract class Exif
|
|||||||
private static Shared.Models.JpegDirectory[] GetJpegDirectories(IReadOnlyList<MetadataExtractor.Directory> directories)
|
private static Shared.Models.JpegDirectory[] GetJpegDirectories(IReadOnlyList<MetadataExtractor.Directory> directories)
|
||||||
{
|
{
|
||||||
List<Shared.Models.JpegDirectory> results = [];
|
List<Shared.Models.JpegDirectory> results = [];
|
||||||
|
Shared.Models.JpegDirectory jpegDirectory;
|
||||||
IEnumerable<MetadataExtractor.Formats.Jpeg.JpegDirectory> jpegDirectories = directories.OfType<MetadataExtractor.Formats.Jpeg.JpegDirectory>();
|
IEnumerable<MetadataExtractor.Formats.Jpeg.JpegDirectory> jpegDirectories = directories.OfType<MetadataExtractor.Formats.Jpeg.JpegDirectory>();
|
||||||
foreach (MetadataExtractor.Formats.Jpeg.JpegDirectory jpegDirectory in jpegDirectories)
|
foreach (MetadataExtractor.Formats.Jpeg.JpegDirectory j in jpegDirectories)
|
||||||
{
|
{
|
||||||
if (jpegDirectory.Tags.Count == 0)
|
if (j.Tags.Count == 0)
|
||||||
continue;
|
continue;
|
||||||
string? imageHeight = jpegDirectory.GetDescription(MetadataExtractor.Formats.Jpeg.JpegDirectory.TagImageHeight);
|
string? imageHeight = j.GetDescription(MetadataExtractor.Formats.Jpeg.JpegDirectory.TagImageHeight);
|
||||||
string? imageWidth = jpegDirectory.GetDescription(MetadataExtractor.Formats.Jpeg.JpegDirectory.TagImageWidth);
|
string? imageWidth = j.GetDescription(MetadataExtractor.Formats.Jpeg.JpegDirectory.TagImageWidth);
|
||||||
if (imageHeight is null && imageWidth is null)
|
if (imageHeight is null && imageWidth is null)
|
||||||
continue;
|
continue;
|
||||||
results.Add(new(imageHeight, imageWidth));
|
jpegDirectory = new(ImageHeight: imageHeight, ImageWidth: imageWidth);
|
||||||
|
results.Add(jpegDirectory);
|
||||||
}
|
}
|
||||||
return results.ToArray();
|
return results.ToArray();
|
||||||
}
|
}
|
||||||
@ -309,6 +321,7 @@ internal abstract class Exif
|
|||||||
private static Shared.Models.MakernoteDirectory[] GetMakernoteDirectories(IReadOnlyList<MetadataExtractor.Directory> directories)
|
private static Shared.Models.MakernoteDirectory[] GetMakernoteDirectories(IReadOnlyList<MetadataExtractor.Directory> directories)
|
||||||
{
|
{
|
||||||
List<Shared.Models.MakernoteDirectory> results = [];
|
List<Shared.Models.MakernoteDirectory> results = [];
|
||||||
|
Shared.Models.MakernoteDirectory makernoteDirectory;
|
||||||
IEnumerable<AppleMakernoteDirectory> appleMakernoteDirectories = directories.OfType<AppleMakernoteDirectory>();
|
IEnumerable<AppleMakernoteDirectory> appleMakernoteDirectories = directories.OfType<AppleMakernoteDirectory>();
|
||||||
foreach (AppleMakernoteDirectory appleMakernoteDirectory in appleMakernoteDirectories)
|
foreach (AppleMakernoteDirectory appleMakernoteDirectory in appleMakernoteDirectories)
|
||||||
{
|
{
|
||||||
@ -319,7 +332,8 @@ internal abstract class Exif
|
|||||||
string? qualityAndFileFormat = null;
|
string? qualityAndFileFormat = null;
|
||||||
if (cameraSerialNumber is null && firmwareVersion is null && qualityAndFileFormat is null)
|
if (cameraSerialNumber is null && firmwareVersion is null && qualityAndFileFormat is null)
|
||||||
continue;
|
continue;
|
||||||
results.Add(new(cameraSerialNumber, firmwareVersion, qualityAndFileFormat));
|
makernoteDirectory = new(cameraSerialNumber, firmwareVersion, qualityAndFileFormat);
|
||||||
|
results.Add(makernoteDirectory);
|
||||||
}
|
}
|
||||||
IEnumerable<CanonMakernoteDirectory> canonMakernoteDirectories = directories.OfType<CanonMakernoteDirectory>();
|
IEnumerable<CanonMakernoteDirectory> canonMakernoteDirectories = directories.OfType<CanonMakernoteDirectory>();
|
||||||
foreach (CanonMakernoteDirectory canonMakernoteDirectory in canonMakernoteDirectories)
|
foreach (CanonMakernoteDirectory canonMakernoteDirectory in canonMakernoteDirectories)
|
||||||
@ -331,7 +345,8 @@ internal abstract class Exif
|
|||||||
string? qualityAndFileFormat = canonMakernoteDirectory.GetDescription(CanonMakernoteDirectory.CameraSettings.TagQuality);
|
string? qualityAndFileFormat = canonMakernoteDirectory.GetDescription(CanonMakernoteDirectory.CameraSettings.TagQuality);
|
||||||
if (cameraSerialNumber is null && firmwareVersion is null && qualityAndFileFormat is null)
|
if (cameraSerialNumber is null && firmwareVersion is null && qualityAndFileFormat is null)
|
||||||
continue;
|
continue;
|
||||||
results.Add(new(cameraSerialNumber, firmwareVersion, qualityAndFileFormat));
|
makernoteDirectory = new(cameraSerialNumber, firmwareVersion, qualityAndFileFormat);
|
||||||
|
results.Add(makernoteDirectory);
|
||||||
}
|
}
|
||||||
IEnumerable<NikonType2MakernoteDirectory> nikonType2MakernoteDirectories = directories.OfType<NikonType2MakernoteDirectory>();
|
IEnumerable<NikonType2MakernoteDirectory> nikonType2MakernoteDirectories = directories.OfType<NikonType2MakernoteDirectory>();
|
||||||
foreach (NikonType2MakernoteDirectory nikonType2MakernoteDirectory in nikonType2MakernoteDirectories)
|
foreach (NikonType2MakernoteDirectory nikonType2MakernoteDirectory in nikonType2MakernoteDirectories)
|
||||||
@ -343,7 +358,8 @@ internal abstract class Exif
|
|||||||
string? qualityAndFileFormat = nikonType2MakernoteDirectory.GetDescription(NikonType2MakernoteDirectory.TagQualityAndFileFormat);
|
string? qualityAndFileFormat = nikonType2MakernoteDirectory.GetDescription(NikonType2MakernoteDirectory.TagQualityAndFileFormat);
|
||||||
if (cameraSerialNumber is null && firmwareVersion is null && qualityAndFileFormat is null)
|
if (cameraSerialNumber is null && firmwareVersion is null && qualityAndFileFormat is null)
|
||||||
continue;
|
continue;
|
||||||
results.Add(new(cameraSerialNumber, firmwareVersion, qualityAndFileFormat));
|
makernoteDirectory = new(cameraSerialNumber, firmwareVersion, qualityAndFileFormat);
|
||||||
|
results.Add(makernoteDirectory);
|
||||||
}
|
}
|
||||||
IEnumerable<OlympusMakernoteDirectory> olympusMakernoteDirectories = directories.OfType<OlympusMakernoteDirectory>();
|
IEnumerable<OlympusMakernoteDirectory> olympusMakernoteDirectories = directories.OfType<OlympusMakernoteDirectory>();
|
||||||
foreach (OlympusMakernoteDirectory olympusMakernoteDirectory in olympusMakernoteDirectories)
|
foreach (OlympusMakernoteDirectory olympusMakernoteDirectory in olympusMakernoteDirectories)
|
||||||
@ -355,7 +371,8 @@ internal abstract class Exif
|
|||||||
string? qualityAndFileFormat = olympusMakernoteDirectory.GetDescription(OlympusMakernoteDirectory.TagJpegQuality);
|
string? qualityAndFileFormat = olympusMakernoteDirectory.GetDescription(OlympusMakernoteDirectory.TagJpegQuality);
|
||||||
if (cameraSerialNumber is null && firmwareVersion is null && qualityAndFileFormat is null)
|
if (cameraSerialNumber is null && firmwareVersion is null && qualityAndFileFormat is null)
|
||||||
continue;
|
continue;
|
||||||
results.Add(new(cameraSerialNumber, firmwareVersion, qualityAndFileFormat));
|
makernoteDirectory = new(cameraSerialNumber, firmwareVersion, qualityAndFileFormat);
|
||||||
|
results.Add(makernoteDirectory);
|
||||||
}
|
}
|
||||||
IEnumerable<PanasonicMakernoteDirectory> panasonicMakernoteDirectories = directories.OfType<PanasonicMakernoteDirectory>();
|
IEnumerable<PanasonicMakernoteDirectory> panasonicMakernoteDirectories = directories.OfType<PanasonicMakernoteDirectory>();
|
||||||
foreach (PanasonicMakernoteDirectory panasonicMakernoteDirectory in panasonicMakernoteDirectories)
|
foreach (PanasonicMakernoteDirectory panasonicMakernoteDirectory in panasonicMakernoteDirectories)
|
||||||
@ -367,7 +384,8 @@ internal abstract class Exif
|
|||||||
string? qualityAndFileFormat = panasonicMakernoteDirectory.GetDescription(PanasonicMakernoteDirectory.TagQualityMode);
|
string? qualityAndFileFormat = panasonicMakernoteDirectory.GetDescription(PanasonicMakernoteDirectory.TagQualityMode);
|
||||||
if (cameraSerialNumber is null && firmwareVersion is null && qualityAndFileFormat is null)
|
if (cameraSerialNumber is null && firmwareVersion is null && qualityAndFileFormat is null)
|
||||||
continue;
|
continue;
|
||||||
results.Add(new(cameraSerialNumber, firmwareVersion, qualityAndFileFormat));
|
makernoteDirectory = new(cameraSerialNumber, firmwareVersion, qualityAndFileFormat);
|
||||||
|
results.Add(makernoteDirectory);
|
||||||
}
|
}
|
||||||
IEnumerable<SamsungType2MakernoteDirectory> samsungType2MakernoteDirectories = directories.OfType<SamsungType2MakernoteDirectory>();
|
IEnumerable<SamsungType2MakernoteDirectory> samsungType2MakernoteDirectories = directories.OfType<SamsungType2MakernoteDirectory>();
|
||||||
foreach (SamsungType2MakernoteDirectory samsungType2MakernoteDirectory in samsungType2MakernoteDirectories)
|
foreach (SamsungType2MakernoteDirectory samsungType2MakernoteDirectory in samsungType2MakernoteDirectories)
|
||||||
@ -379,7 +397,8 @@ internal abstract class Exif
|
|||||||
string? qualityAndFileFormat = null;
|
string? qualityAndFileFormat = null;
|
||||||
if (cameraSerialNumber is null && firmwareVersion is null && qualityAndFileFormat is null)
|
if (cameraSerialNumber is null && firmwareVersion is null && qualityAndFileFormat is null)
|
||||||
continue;
|
continue;
|
||||||
results.Add(new(cameraSerialNumber, firmwareVersion, qualityAndFileFormat));
|
makernoteDirectory = new(cameraSerialNumber, firmwareVersion, qualityAndFileFormat);
|
||||||
|
results.Add(makernoteDirectory);
|
||||||
}
|
}
|
||||||
IEnumerable<SonyType6MakernoteDirectory> sonyType6MakernoteDirectories = directories.OfType<SonyType6MakernoteDirectory>();
|
IEnumerable<SonyType6MakernoteDirectory> sonyType6MakernoteDirectories = directories.OfType<SonyType6MakernoteDirectory>();
|
||||||
foreach (SonyType6MakernoteDirectory sonyType6MakernoteDirectory in sonyType6MakernoteDirectories)
|
foreach (SonyType6MakernoteDirectory sonyType6MakernoteDirectory in sonyType6MakernoteDirectories)
|
||||||
@ -391,7 +410,8 @@ internal abstract class Exif
|
|||||||
string? qualityAndFileFormat = null;
|
string? qualityAndFileFormat = null;
|
||||||
if (cameraSerialNumber is null && firmwareVersion is null && qualityAndFileFormat is null)
|
if (cameraSerialNumber is null && firmwareVersion is null && qualityAndFileFormat is null)
|
||||||
continue;
|
continue;
|
||||||
results.Add(new(cameraSerialNumber, firmwareVersion, qualityAndFileFormat));
|
makernoteDirectory = new(CameraSerialNumber: cameraSerialNumber, FirmwareVersion: firmwareVersion, QualityAndFileFormat: qualityAndFileFormat);
|
||||||
|
results.Add(makernoteDirectory);
|
||||||
}
|
}
|
||||||
return results.ToArray();
|
return results.ToArray();
|
||||||
}
|
}
|
||||||
@ -399,16 +419,18 @@ internal abstract class Exif
|
|||||||
private static Shared.Models.PhotoshopDirectory[] GetPhotoshopDirectories(IReadOnlyList<MetadataExtractor.Directory> directories)
|
private static Shared.Models.PhotoshopDirectory[] GetPhotoshopDirectories(IReadOnlyList<MetadataExtractor.Directory> directories)
|
||||||
{
|
{
|
||||||
List<Shared.Models.PhotoshopDirectory> results = [];
|
List<Shared.Models.PhotoshopDirectory> results = [];
|
||||||
|
Shared.Models.PhotoshopDirectory photoshopDirectory;
|
||||||
IEnumerable<MetadataExtractor.Formats.Photoshop.PhotoshopDirectory> photoshopDirectories = directories.OfType<MetadataExtractor.Formats.Photoshop.PhotoshopDirectory>();
|
IEnumerable<MetadataExtractor.Formats.Photoshop.PhotoshopDirectory> photoshopDirectories = directories.OfType<MetadataExtractor.Formats.Photoshop.PhotoshopDirectory>();
|
||||||
foreach (MetadataExtractor.Formats.Photoshop.PhotoshopDirectory photoshopDirectory in photoshopDirectories)
|
foreach (MetadataExtractor.Formats.Photoshop.PhotoshopDirectory p in photoshopDirectories)
|
||||||
{
|
{
|
||||||
if (photoshopDirectory.Tags.Count == 0)
|
if (p.Tags.Count == 0)
|
||||||
continue;
|
continue;
|
||||||
string? jpegQuality = photoshopDirectory.GetDescription(MetadataExtractor.Formats.Photoshop.PhotoshopDirectory.TagJpegQuality);
|
string? jpegQuality = p.GetDescription(MetadataExtractor.Formats.Photoshop.PhotoshopDirectory.TagJpegQuality);
|
||||||
string? url = photoshopDirectory.GetDescription(MetadataExtractor.Formats.Photoshop.PhotoshopDirectory.TagUrl);
|
string? url = p.GetDescription(MetadataExtractor.Formats.Photoshop.PhotoshopDirectory.TagUrl);
|
||||||
if (jpegQuality is null && url is null)
|
if (jpegQuality is null && url is null)
|
||||||
continue;
|
continue;
|
||||||
results.Add(new(jpegQuality, url));
|
photoshopDirectory = new(JpegQuality: jpegQuality, Url: url);
|
||||||
|
results.Add(photoshopDirectory);
|
||||||
}
|
}
|
||||||
return results.ToArray();
|
return results.ToArray();
|
||||||
}
|
}
|
||||||
@ -416,17 +438,19 @@ internal abstract class Exif
|
|||||||
private static Shared.Models.PngDirectory[] GetPngDirectories(IReadOnlyList<MetadataExtractor.Directory> directories)
|
private static Shared.Models.PngDirectory[] GetPngDirectories(IReadOnlyList<MetadataExtractor.Directory> directories)
|
||||||
{
|
{
|
||||||
List<Shared.Models.PngDirectory> results = [];
|
List<Shared.Models.PngDirectory> results = [];
|
||||||
|
Shared.Models.PngDirectory pngDirectory;
|
||||||
IEnumerable<MetadataExtractor.Formats.Png.PngDirectory> pngDirectories = directories.OfType<MetadataExtractor.Formats.Png.PngDirectory>();
|
IEnumerable<MetadataExtractor.Formats.Png.PngDirectory> pngDirectories = directories.OfType<MetadataExtractor.Formats.Png.PngDirectory>();
|
||||||
foreach (MetadataExtractor.Formats.Png.PngDirectory pngDirectory in pngDirectories)
|
foreach (MetadataExtractor.Formats.Png.PngDirectory p in pngDirectories)
|
||||||
{
|
{
|
||||||
if (pngDirectory.Tags.Count == 0)
|
if (p.Tags.Count == 0)
|
||||||
continue;
|
continue;
|
||||||
string? imageHeight = pngDirectory.GetDescription(MetadataExtractor.Formats.Png.PngDirectory.TagImageHeight);
|
string? imageHeight = p.GetDescription(MetadataExtractor.Formats.Png.PngDirectory.TagImageHeight);
|
||||||
string? imageWidth = pngDirectory.GetDescription(MetadataExtractor.Formats.Png.PngDirectory.TagImageWidth);
|
string? imageWidth = p.GetDescription(MetadataExtractor.Formats.Png.PngDirectory.TagImageWidth);
|
||||||
string? textualData = pngDirectory.GetDescription(MetadataExtractor.Formats.Png.PngDirectory.TagTextualData);
|
string? textualData = p.GetDescription(MetadataExtractor.Formats.Png.PngDirectory.TagTextualData);
|
||||||
if (imageHeight is null && imageWidth is null && textualData is null)
|
if (imageHeight is null && imageWidth is null && textualData is null)
|
||||||
continue;
|
continue;
|
||||||
results.Add(new(imageHeight, imageWidth, textualData));
|
pngDirectory = new(ImageHeight: imageHeight, ImageWidth: imageWidth, TextualData: textualData);
|
||||||
|
results.Add(pngDirectory);
|
||||||
}
|
}
|
||||||
return results.ToArray();
|
return results.ToArray();
|
||||||
}
|
}
|
||||||
@ -434,19 +458,21 @@ internal abstract class Exif
|
|||||||
private static Shared.Models.QuickTimeMovieHeaderDirectory[] GetQuickTimeMovieHeaderDirectoryDirectories(IReadOnlyList<MetadataExtractor.Directory> directories)
|
private static Shared.Models.QuickTimeMovieHeaderDirectory[] GetQuickTimeMovieHeaderDirectoryDirectories(IReadOnlyList<MetadataExtractor.Directory> directories)
|
||||||
{
|
{
|
||||||
List<Shared.Models.QuickTimeMovieHeaderDirectory> results = [];
|
List<Shared.Models.QuickTimeMovieHeaderDirectory> results = [];
|
||||||
|
Shared.Models.QuickTimeMovieHeaderDirectory quickTimeMovieHeaderDirectory;
|
||||||
IEnumerable<MetadataExtractor.Formats.QuickTime.QuickTimeMovieHeaderDirectory> quickTimeMovieHeaderDirectories = directories.OfType<MetadataExtractor.Formats.QuickTime.QuickTimeMovieHeaderDirectory>();
|
IEnumerable<MetadataExtractor.Formats.QuickTime.QuickTimeMovieHeaderDirectory> quickTimeMovieHeaderDirectories = directories.OfType<MetadataExtractor.Formats.QuickTime.QuickTimeMovieHeaderDirectory>();
|
||||||
foreach (MetadataExtractor.Formats.QuickTime.QuickTimeMovieHeaderDirectory quickTimeMovieHeaderDirectory in quickTimeMovieHeaderDirectories)
|
foreach (MetadataExtractor.Formats.QuickTime.QuickTimeMovieHeaderDirectory q in quickTimeMovieHeaderDirectories)
|
||||||
{
|
{
|
||||||
if (quickTimeMovieHeaderDirectory.Tags.Count == 0)
|
if (q.Tags.Count == 0)
|
||||||
continue;
|
continue;
|
||||||
DateTime? created;
|
DateTime? created;
|
||||||
if (quickTimeMovieHeaderDirectory.TryGetDateTime(MetadataExtractor.Formats.QuickTime.QuickTimeMovieHeaderDirectory.TagCreated, out DateTime checkDateTime))
|
if (q.TryGetDateTime(MetadataExtractor.Formats.QuickTime.QuickTimeMovieHeaderDirectory.TagCreated, out DateTime checkDateTime))
|
||||||
created = checkDateTime;
|
created = checkDateTime;
|
||||||
else
|
else
|
||||||
created = GetDateTime(quickTimeMovieHeaderDirectory.GetString(MetadataExtractor.Formats.QuickTime.QuickTimeMovieHeaderDirectory.TagCreated));
|
created = GetDateTime(q.GetString(MetadataExtractor.Formats.QuickTime.QuickTimeMovieHeaderDirectory.TagCreated));
|
||||||
if (created is null)
|
if (created is null)
|
||||||
continue;
|
continue;
|
||||||
results.Add(new(created));
|
quickTimeMovieHeaderDirectory = new(Created: created);
|
||||||
|
results.Add(quickTimeMovieHeaderDirectory);
|
||||||
}
|
}
|
||||||
return results.ToArray();
|
return results.ToArray();
|
||||||
}
|
}
|
||||||
@ -454,19 +480,21 @@ internal abstract class Exif
|
|||||||
private static Shared.Models.QuickTimeTrackHeaderDirectory[] GetQuickTimeTrackHeaderDirectoryDirectories(IReadOnlyList<MetadataExtractor.Directory> directories)
|
private static Shared.Models.QuickTimeTrackHeaderDirectory[] GetQuickTimeTrackHeaderDirectoryDirectories(IReadOnlyList<MetadataExtractor.Directory> directories)
|
||||||
{
|
{
|
||||||
List<Shared.Models.QuickTimeTrackHeaderDirectory> results = [];
|
List<Shared.Models.QuickTimeTrackHeaderDirectory> results = [];
|
||||||
|
Shared.Models.QuickTimeTrackHeaderDirectory quickTimeTrackHeaderDirectory;
|
||||||
IEnumerable<MetadataExtractor.Formats.QuickTime.QuickTimeTrackHeaderDirectory> quickTimeTrackHeaderDirectories = directories.OfType<MetadataExtractor.Formats.QuickTime.QuickTimeTrackHeaderDirectory>();
|
IEnumerable<MetadataExtractor.Formats.QuickTime.QuickTimeTrackHeaderDirectory> quickTimeTrackHeaderDirectories = directories.OfType<MetadataExtractor.Formats.QuickTime.QuickTimeTrackHeaderDirectory>();
|
||||||
foreach (MetadataExtractor.Formats.QuickTime.QuickTimeTrackHeaderDirectory quickTimeTrackHeaderDirectory in quickTimeTrackHeaderDirectories)
|
foreach (MetadataExtractor.Formats.QuickTime.QuickTimeTrackHeaderDirectory q in quickTimeTrackHeaderDirectories)
|
||||||
{
|
{
|
||||||
if (quickTimeTrackHeaderDirectory.Tags.Count == 0)
|
if (q.Tags.Count == 0)
|
||||||
continue;
|
continue;
|
||||||
DateTime? created;
|
DateTime? created;
|
||||||
if (quickTimeTrackHeaderDirectory.TryGetDateTime(MetadataExtractor.Formats.QuickTime.QuickTimeTrackHeaderDirectory.TagCreated, out DateTime checkDateTime))
|
if (q.TryGetDateTime(MetadataExtractor.Formats.QuickTime.QuickTimeTrackHeaderDirectory.TagCreated, out DateTime checkDateTime))
|
||||||
created = checkDateTime;
|
created = checkDateTime;
|
||||||
else
|
else
|
||||||
created = GetDateTime(quickTimeTrackHeaderDirectory.GetString(MetadataExtractor.Formats.QuickTime.QuickTimeTrackHeaderDirectory.TagCreated));
|
created = GetDateTime(q.GetString(MetadataExtractor.Formats.QuickTime.QuickTimeTrackHeaderDirectory.TagCreated));
|
||||||
if (created is null)
|
if (created is null)
|
||||||
continue;
|
continue;
|
||||||
results.Add(new(created));
|
quickTimeTrackHeaderDirectory = new(Created: created);
|
||||||
|
results.Add(quickTimeTrackHeaderDirectory);
|
||||||
}
|
}
|
||||||
return results.ToArray();
|
return results.ToArray();
|
||||||
}
|
}
|
||||||
@ -474,16 +502,18 @@ internal abstract class Exif
|
|||||||
private static Shared.Models.WebPDirectory[] GetWebPDirectories(IReadOnlyList<MetadataExtractor.Directory> directories)
|
private static Shared.Models.WebPDirectory[] GetWebPDirectories(IReadOnlyList<MetadataExtractor.Directory> directories)
|
||||||
{
|
{
|
||||||
List<Shared.Models.WebPDirectory> results = [];
|
List<Shared.Models.WebPDirectory> results = [];
|
||||||
|
Shared.Models.WebPDirectory webPDirectory;
|
||||||
IEnumerable<MetadataExtractor.Formats.WebP.WebPDirectory> webPDirectories = directories.OfType<MetadataExtractor.Formats.WebP.WebPDirectory>();
|
IEnumerable<MetadataExtractor.Formats.WebP.WebPDirectory> webPDirectories = directories.OfType<MetadataExtractor.Formats.WebP.WebPDirectory>();
|
||||||
foreach (MetadataExtractor.Formats.WebP.WebPDirectory webPDirectory in webPDirectories)
|
foreach (MetadataExtractor.Formats.WebP.WebPDirectory w in webPDirectories)
|
||||||
{
|
{
|
||||||
if (webPDirectory.Tags.Count == 0)
|
if (w.Tags.Count == 0)
|
||||||
continue;
|
continue;
|
||||||
string? imageHeight = webPDirectory.GetDescription(MetadataExtractor.Formats.WebP.WebPDirectory.TagImageHeight);
|
string? imageHeight = w.GetDescription(MetadataExtractor.Formats.WebP.WebPDirectory.TagImageHeight);
|
||||||
string? imageWidth = webPDirectory.GetDescription(MetadataExtractor.Formats.WebP.WebPDirectory.TagImageWidth);
|
string? imageWidth = w.GetDescription(MetadataExtractor.Formats.WebP.WebPDirectory.TagImageWidth);
|
||||||
if (imageHeight is null && imageWidth is null)
|
if (imageHeight is null && imageWidth is null)
|
||||||
continue;
|
continue;
|
||||||
results.Add(new(imageHeight, imageWidth));
|
webPDirectory = new(ImageHeight: imageHeight, ImageWidth: imageWidth);
|
||||||
|
results.Add(webPDirectory);
|
||||||
}
|
}
|
||||||
return results.ToArray();
|
return results.ToArray();
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using System.Text.Json;
|
||||||
using View_by_Distance.Shared.Models;
|
using View_by_Distance.Shared.Models;
|
||||||
|
|
||||||
namespace View_by_Distance.Metadata.Models.Stateless.Methods;
|
namespace View_by_Distance.Metadata.Models.Stateless.Methods;
|
||||||
@ -5,6 +6,14 @@ namespace View_by_Distance.Metadata.Models.Stateless.Methods;
|
|||||||
internal static class Face
|
internal static class Face
|
||||||
{
|
{
|
||||||
|
|
||||||
|
internal static FaceEncoding? GetFaceEncoding(ExifDirectory? exifDirectory)
|
||||||
|
{
|
||||||
|
FaceEncoding? result;
|
||||||
|
string? json = GetFaceEncoding(exifDirectory?.PngDirectories);
|
||||||
|
result = string.IsNullOrEmpty(json) ? null : JsonSerializer.Deserialize(json, FaceEncodingGenerationContext.Default.FaceEncoding);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
internal static string? GetFaceEncoding(PngDirectory[]? pngDirectories)
|
internal static string? GetFaceEncoding(PngDirectory[]? pngDirectories)
|
||||||
{
|
{
|
||||||
string? result = null;
|
string? result = null;
|
||||||
@ -22,6 +31,14 @@ internal static class Face
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static FaceFile? GetFaceFile(ExifDirectory? exifDirectory)
|
||||||
|
{
|
||||||
|
FaceFile? result;
|
||||||
|
string? json = GetOutputResolution(exifDirectory?.PngDirectories);
|
||||||
|
result = string.IsNullOrEmpty(json) ? null : JsonSerializer.Deserialize(json, FaceFileGenerationContext.Default.FaceFile);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
internal static string? GetOutputResolution(PngDirectory[]? pngDirectories)
|
internal static string? GetOutputResolution(PngDirectory[]? pngDirectories)
|
||||||
{
|
{
|
||||||
string? result = null;
|
string? result = null;
|
||||||
|
@ -14,44 +14,46 @@ public interface IMetadata
|
|||||||
Meters
|
Meters
|
||||||
}
|
}
|
||||||
|
|
||||||
ExifDirectory TestStatic_GetExifDirectory(FilePath filePath) =>
|
public static ExifDirectory GetExifDirectory(FilePath filePath) =>
|
||||||
GetExifDirectory(filePath);
|
|
||||||
static ExifDirectory GetExifDirectory(FilePath filePath) =>
|
|
||||||
Exif.GetExifDirectory(filePath);
|
Exif.GetExifDirectory(filePath);
|
||||||
|
|
||||||
string? TestStatic_GetOutputResolution(ExifDirectory? exifDirectory) =>
|
public static FaceFile? GetFaceFile(ExifDirectory? exifDirectory) =>
|
||||||
GetOutputResolution(exifDirectory);
|
Face.GetFaceFile(exifDirectory);
|
||||||
static string? GetOutputResolution(ExifDirectory? exifDirectory) =>
|
|
||||||
Face.GetOutputResolution(exifDirectory?.PngDirectories);
|
|
||||||
|
|
||||||
string? TestStatic_GetFaceEncoding(ExifDirectory? exifDirectory) =>
|
public static GeoLocation? GeoLocation(ExifDirectory? exifDirectory) =>
|
||||||
GetFaceEncoding(exifDirectory);
|
|
||||||
static string? GetFaceEncoding(ExifDirectory? exifDirectory) =>
|
|
||||||
Face.GetFaceEncoding(exifDirectory?.PngDirectories);
|
|
||||||
|
|
||||||
GeoLocation? TestStatic_GeoLocation(ExifDirectory? exifDirectory) =>
|
|
||||||
GeoLocation(exifDirectory);
|
|
||||||
static GeoLocation? GeoLocation(ExifDirectory? exifDirectory) =>
|
|
||||||
GPS.GeoLocation(exifDirectory?.GpsDirectories);
|
GPS.GeoLocation(exifDirectory?.GpsDirectories);
|
||||||
|
|
||||||
double? TestStatic_GetDistance(double originLatitude, double originLongitude, double destinationLatitude, double destinationLongitude, int decimalPlaces = 1, DistanceUnit distanceUnit = DistanceUnit.Miles) =>
|
public static string? GetOutputResolution(ExifDirectory? exifDirectory) =>
|
||||||
GetDistance(originLatitude, originLongitude, destinationLatitude, destinationLongitude, decimalPlaces, distanceUnit);
|
Face.GetOutputResolution(exifDirectory?.PngDirectories);
|
||||||
static double? GetDistance(double originLatitude, double originLongitude, double destinationLatitude, double destinationLongitude, int decimalPlaces = 1, DistanceUnit distanceUnit = DistanceUnit.Miles) =>
|
|
||||||
|
public static string? GetRawFaceEncoding(ExifDirectory? exifDirectory) =>
|
||||||
|
Face.GetFaceEncoding(exifDirectory?.PngDirectories);
|
||||||
|
|
||||||
|
public static FaceEncoding? GetFaceEncoding(ExifDirectory? exifDirectory) =>
|
||||||
|
Face.GetFaceEncoding(exifDirectory);
|
||||||
|
|
||||||
|
public static double? GetDistance(double originLatitude, double originLongitude, double destinationLatitude, double destinationLongitude, int decimalPlaces = 1, DistanceUnit distanceUnit = DistanceUnit.Miles) =>
|
||||||
GPS.GetDistance(originLatitude, originLongitude, destinationLatitude, destinationLongitude, decimalPlaces, distanceUnit);
|
GPS.GetDistance(originLatitude, originLongitude, destinationLatitude, destinationLongitude, decimalPlaces, distanceUnit);
|
||||||
|
|
||||||
// string? TestStatic_GetFaceEncoding(IReadOnlyList<MetadataExtractor.Directory> directories) =>
|
internal ExifDirectory TestStatic_GetExifDirectory(FilePath filePath) =>
|
||||||
// GetFaceEncoding(directories);
|
GetExifDirectory(filePath);
|
||||||
// static string? GetFaceEncoding(IReadOnlyList<MetadataExtractor.Directory> directories) =>
|
|
||||||
// Metadata.GetFaceEncoding(directories);
|
|
||||||
|
|
||||||
// string? TestStatic_GetOutputResolution(IReadOnlyList<MetadataExtractor.Directory> directories) =>
|
internal GeoLocation? TestStatic_GeoLocation(ExifDirectory? exifDirectory) =>
|
||||||
// GetOutputResolution(directories);
|
GeoLocation(exifDirectory);
|
||||||
// static string? GetOutputResolution(IReadOnlyList<MetadataExtractor.Directory> directories) =>
|
|
||||||
// Metadata.GetOutputResolution(directories);
|
|
||||||
|
|
||||||
// Dictionary<string, MetadataExtractorDirectory> TestStatic_GetMetadataCollection(FileInfo fileInfo, List<Tuple<string, DateTime>> subFileTuples, List<string> parseExceptions) =>
|
internal string? TestStatic_GetRawFaceEncoding(ExifDirectory? exifDirectory) =>
|
||||||
// GetMetadataCollection(fileInfo, subFileTuples, parseExceptions);
|
GetRawFaceEncoding(exifDirectory);
|
||||||
// static Dictionary<string, MetadataExtractorDirectory> GetMetadataCollection(FileInfo fileInfo, List<Tuple<string, DateTime>> subFileTuples, List<string> parseExceptions) =>
|
|
||||||
// Metadata.GetMetadataCollection(fileInfo, subFileTuples, parseExceptions);
|
internal string? TestStatic_GetOutputResolution(ExifDirectory? exifDirectory) =>
|
||||||
|
GetOutputResolution(exifDirectory);
|
||||||
|
|
||||||
|
internal static FaceFile? TestStatic_GetFaceFile(ExifDirectory? exifDirectory) =>
|
||||||
|
GetFaceFile(exifDirectory);
|
||||||
|
|
||||||
|
internal FaceEncoding? TestStatic_GetFaceEncoding(ExifDirectory? exifDirectory) =>
|
||||||
|
GetFaceEncoding(exifDirectory);
|
||||||
|
|
||||||
|
internal double? TestStatic_GetDistance(double originLatitude, double originLongitude, double destinationLatitude, double destinationLongitude, int decimalPlaces = 1, DistanceUnit distanceUnit = DistanceUnit.Miles) =>
|
||||||
|
GetDistance(originLatitude, originLongitude, destinationLatitude, destinationLongitude, decimalPlaces, distanceUnit);
|
||||||
|
|
||||||
}
|
}
|
@ -68,28 +68,54 @@
|
|||||||
"ResultSingleton": "{}",
|
"ResultSingleton": "{}",
|
||||||
"RootDirectory": "D:/Images",
|
"RootDirectory": "D:/Images",
|
||||||
"IgnoreExtensions": [
|
"IgnoreExtensions": [
|
||||||
|
".ffs_db",
|
||||||
|
".FFS_DB",
|
||||||
".gif",
|
".gif",
|
||||||
".GIF",
|
".GIF",
|
||||||
|
".heic",
|
||||||
|
".HEIC",
|
||||||
|
".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": [
|
||||||
|
".avif",
|
||||||
".bmp",
|
".bmp",
|
||||||
".BMP",
|
|
||||||
".gif",
|
".gif",
|
||||||
".GIF",
|
".heic",
|
||||||
|
".insp",
|
||||||
|
".jp2",
|
||||||
|
".jpe",
|
||||||
".jpeg",
|
".jpeg",
|
||||||
".JPEG",
|
|
||||||
".jpg",
|
".jpg",
|
||||||
".JPG",
|
".jxl",
|
||||||
".png",
|
".png",
|
||||||
".PNG",
|
".psd",
|
||||||
".tiff",
|
".raw",
|
||||||
".TIFF",
|
".rw2",
|
||||||
|
".svg",
|
||||||
".tif",
|
".tif",
|
||||||
".TIF"
|
".tiff",
|
||||||
|
".webp"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,28 +67,54 @@
|
|||||||
"ResultSingleton": "{}",
|
"ResultSingleton": "{}",
|
||||||
"RootDirectory": "D:/Images",
|
"RootDirectory": "D:/Images",
|
||||||
"IgnoreExtensions": [
|
"IgnoreExtensions": [
|
||||||
|
".ffs_db",
|
||||||
|
".FFS_DB",
|
||||||
".gif",
|
".gif",
|
||||||
".GIF",
|
".GIF",
|
||||||
|
".heic",
|
||||||
|
".HEIC",
|
||||||
|
".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": [
|
||||||
|
".avif",
|
||||||
".bmp",
|
".bmp",
|
||||||
".BMP",
|
|
||||||
".gif",
|
".gif",
|
||||||
".GIF",
|
".heic",
|
||||||
|
".insp",
|
||||||
|
".jp2",
|
||||||
|
".jpe",
|
||||||
".jpeg",
|
".jpeg",
|
||||||
".JPEG",
|
|
||||||
".jpg",
|
".jpg",
|
||||||
".JPG",
|
".jxl",
|
||||||
".png",
|
".png",
|
||||||
".PNG",
|
".psd",
|
||||||
".tiff",
|
".raw",
|
||||||
".TIFF",
|
".rw2",
|
||||||
|
".svg",
|
||||||
".tif",
|
".tif",
|
||||||
".TIF"
|
".tiff",
|
||||||
|
".webp"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,12 +60,34 @@
|
|||||||
"PropertiesChangedForProperty": false,
|
"PropertiesChangedForProperty": false,
|
||||||
"RootDirectory": "C:/Tmp/Phares/Pictures",
|
"RootDirectory": "C:/Tmp/Phares/Pictures",
|
||||||
"IgnoreExtensions": [
|
"IgnoreExtensions": [
|
||||||
|
".ffs_db",
|
||||||
|
".FFS_DB",
|
||||||
".gif",
|
".gif",
|
||||||
".GIF",
|
".GIF",
|
||||||
|
".heic",
|
||||||
|
".HEIC",
|
||||||
|
".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": [
|
||||||
@ -95,20 +117,24 @@
|
|||||||
"September"
|
"September"
|
||||||
],
|
],
|
||||||
"ValidImageFormatExtensions": [
|
"ValidImageFormatExtensions": [
|
||||||
|
".avif",
|
||||||
".bmp",
|
".bmp",
|
||||||
".BMP",
|
|
||||||
".gif",
|
".gif",
|
||||||
".GIF",
|
".heic",
|
||||||
|
".insp",
|
||||||
|
".jp2",
|
||||||
|
".jpe",
|
||||||
".jpeg",
|
".jpeg",
|
||||||
".JPEG",
|
|
||||||
".jpg",
|
".jpg",
|
||||||
".JPG",
|
".jxl",
|
||||||
".png",
|
".png",
|
||||||
".PNG",
|
".psd",
|
||||||
".tiff",
|
".raw",
|
||||||
".TIFF",
|
".rw2",
|
||||||
|
".svg",
|
||||||
".tif",
|
".tif",
|
||||||
".TIF"
|
".tiff",
|
||||||
|
".webp"
|
||||||
],
|
],
|
||||||
"VerifyToSeason": [
|
"VerifyToSeason": [
|
||||||
". 2000",
|
". 2000",
|
||||||
|
@ -9,7 +9,6 @@ public class Configuration
|
|||||||
|
|
||||||
public string? DateGroup { get; set; }
|
public string? DateGroup { get; set; }
|
||||||
public string? FileNameDirectorySeparator { get; set; }
|
public string? FileNameDirectorySeparator { get; set; }
|
||||||
public bool? ForcePropertyLastWriteTimeToCreationTime { get; set; }
|
|
||||||
public string[]? IgnoreExtensions { get; set; }
|
public string[]? IgnoreExtensions { get; set; }
|
||||||
public string[]? IgnoreRulesKeyWords { get; set; }
|
public string[]? IgnoreRulesKeyWords { get; set; }
|
||||||
public int? IntMinValueLength { get; set; }
|
public int? IntMinValueLength { get; set; }
|
||||||
@ -64,7 +63,6 @@ public class Configuration
|
|||||||
if (configuration is null) throw new NullReferenceException(nameof(configuration));
|
if (configuration is null) throw new NullReferenceException(nameof(configuration));
|
||||||
if (configuration.DateGroup is null) throw new NullReferenceException(nameof(configuration.DateGroup));
|
if (configuration.DateGroup is null) throw new NullReferenceException(nameof(configuration.DateGroup));
|
||||||
if (configuration.FileNameDirectorySeparator is null) throw new NullReferenceException(nameof(configuration.FileNameDirectorySeparator));
|
if (configuration.FileNameDirectorySeparator is null) throw new NullReferenceException(nameof(configuration.FileNameDirectorySeparator));
|
||||||
if (configuration.ForcePropertyLastWriteTimeToCreationTime is null) throw new NullReferenceException(nameof(configuration.ForcePropertyLastWriteTimeToCreationTime));
|
|
||||||
if (configuration.IgnoreExtensions is null) throw new NullReferenceException(nameof(configuration.IgnoreExtensions));
|
if (configuration.IgnoreExtensions is null) throw new NullReferenceException(nameof(configuration.IgnoreExtensions));
|
||||||
if (configuration.IgnoreRulesKeyWords is null) throw new NullReferenceException(nameof(configuration.IgnoreRulesKeyWords));
|
if (configuration.IgnoreRulesKeyWords is null) throw new NullReferenceException(nameof(configuration.IgnoreRulesKeyWords));
|
||||||
if (configuration.IntMinValueLength is null) throw new NullReferenceException(nameof(configuration.IntMinValueLength));
|
if (configuration.IntMinValueLength is null) throw new NullReferenceException(nameof(configuration.IntMinValueLength));
|
||||||
@ -89,33 +87,31 @@ public class Configuration
|
|||||||
if (configuration.ValidImageFormatExtensions is null) throw new NullReferenceException(nameof(configuration.ValidImageFormatExtensions));
|
if (configuration.ValidImageFormatExtensions is null) throw new NullReferenceException(nameof(configuration.ValidImageFormatExtensions));
|
||||||
if (configuration.ValidVideoFormatExtensions is null) throw new NullReferenceException(nameof(configuration.ValidVideoFormatExtensions));
|
if (configuration.ValidVideoFormatExtensions is null) throw new NullReferenceException(nameof(configuration.ValidVideoFormatExtensions));
|
||||||
// if (configuration.VerifyToSeason is null) throw new NullReferenceException(nameof(configuration.VerifyToSeason));
|
// if (configuration.VerifyToSeason is null) throw new NullReferenceException(nameof(configuration.VerifyToSeason));
|
||||||
result = new(configuration.DateGroup,
|
result = new(dateGroup: configuration.DateGroup,
|
||||||
configuration.FileNameDirectorySeparator,
|
fileNameDirectorySeparator: configuration.FileNameDirectorySeparator,
|
||||||
configuration.ForcePropertyLastWriteTimeToCreationTime.Value,
|
ignoreExtensions: configuration.IgnoreExtensions,
|
||||||
configuration.IgnoreExtensions,
|
ignoreRulesKeyWords: configuration.IgnoreRulesKeyWords,
|
||||||
configuration.IgnoreRulesKeyWords,
|
intMinValueLength: configuration.IntMinValueLength.Value,
|
||||||
configuration.IntMinValueLength.Value,
|
maxImagesInDirectoryForTopLevelFirstPass: configuration.MaxImagesInDirectoryForTopLevelFirstPass.Value,
|
||||||
configuration.MaxImagesInDirectoryForTopLevelFirstPass.Value,
|
modelName: configuration.ModelName,
|
||||||
configuration.ModelName,
|
numberOfJitters: configuration.NumberOfJitters,
|
||||||
configuration.NumberOfJitters,
|
numberOfTimesToUpsample: configuration.NumberOfTimesToUpsample,
|
||||||
configuration.NumberOfTimesToUpsample,
|
offset: configuration.Offset.Value,
|
||||||
configuration.Offset.Value,
|
pattern: configuration.Pattern,
|
||||||
configuration.Pattern,
|
personBirthdayFormat: configuration.PersonBirthdayFormat,
|
||||||
configuration.PersonBirthdayFormat,
|
populatePropertyId: configuration.PopulatePropertyId.Value,
|
||||||
configuration.PopulatePropertyId.Value,
|
predictorModelName: configuration.PredictorModelName,
|
||||||
configuration.PredictorModelName,
|
propertyContentCollectionFiles: configuration.PropertyContentCollectionFiles ?? [],
|
||||||
configuration.PropertiesChangedForProperty.Value,
|
resultAllInOne: configuration.ResultAllInOne,
|
||||||
configuration.PropertyContentCollectionFiles ?? [],
|
resultAllInOneSubdirectoryLength: configuration.ResultAllInOneSubdirectoryLength.Value,
|
||||||
configuration.ResultAllInOne,
|
resultCollection: configuration.ResultCollection,
|
||||||
configuration.ResultAllInOneSubdirectoryLength.Value,
|
resultContent: configuration.ResultContent,
|
||||||
configuration.ResultCollection,
|
resultContentCollection: configuration.ResultContentCollection,
|
||||||
configuration.ResultContent,
|
resultSingleton: configuration.ResultSingleton,
|
||||||
configuration.ResultContentCollection,
|
rootDirectory: Path.GetFullPath(configuration.RootDirectory),
|
||||||
configuration.ResultSingleton,
|
validImageFormatExtensions: configuration.ValidImageFormatExtensions,
|
||||||
Path.GetFullPath(configuration.RootDirectory),
|
validVideoFormatExtensions: configuration.ValidVideoFormatExtensions,
|
||||||
configuration.ValidImageFormatExtensions,
|
verifyToSeason: configuration.VerifyToSeason ?? []);
|
||||||
configuration.ValidVideoFormatExtensions,
|
|
||||||
configuration.VerifyToSeason ?? []);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ public class Configuration : Shared.Models.Properties.IPropertyConfiguration
|
|||||||
|
|
||||||
public string DateGroup { init; get; }
|
public string DateGroup { init; get; }
|
||||||
public string FileNameDirectorySeparator { init; get; }
|
public string FileNameDirectorySeparator { init; get; }
|
||||||
public bool ForcePropertyLastWriteTimeToCreationTime { init; get; }
|
|
||||||
public string[] IgnoreExtensions { init; get; }
|
public string[] IgnoreExtensions { init; get; }
|
||||||
public string[] IgnoreRulesKeyWords { init; get; }
|
public string[] IgnoreRulesKeyWords { init; get; }
|
||||||
public int IntMinValueLength { init; get; }
|
public int IntMinValueLength { init; get; }
|
||||||
@ -25,7 +24,6 @@ public class Configuration : Shared.Models.Properties.IPropertyConfiguration
|
|||||||
public string PersonBirthdayFormat { init; get; }
|
public string PersonBirthdayFormat { init; get; }
|
||||||
public bool PopulatePropertyId { init; get; }
|
public bool PopulatePropertyId { init; get; }
|
||||||
public string? PredictorModelName { init; get; }
|
public string? PredictorModelName { init; get; }
|
||||||
public bool PropertiesChangedForProperty { init; get; }
|
|
||||||
public string[] PropertyContentCollectionFiles { init; get; }
|
public string[] PropertyContentCollectionFiles { init; get; }
|
||||||
public string ResultAllInOne { init; get; }
|
public string ResultAllInOne { init; get; }
|
||||||
public int ResultAllInOneSubdirectoryLength { init; get; }
|
public int ResultAllInOneSubdirectoryLength { init; get; }
|
||||||
@ -39,7 +37,6 @@ public class Configuration : Shared.Models.Properties.IPropertyConfiguration
|
|||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public Configuration(string dateGroup,
|
public Configuration(string dateGroup,
|
||||||
string fileNameDirectorySeparator,
|
string fileNameDirectorySeparator,
|
||||||
bool forcePropertyLastWriteTimeToCreationTime,
|
|
||||||
string[] ignoreExtensions,
|
string[] ignoreExtensions,
|
||||||
string[] ignoreRulesKeyWords,
|
string[] ignoreRulesKeyWords,
|
||||||
int intMinValueLength,
|
int intMinValueLength,
|
||||||
@ -52,7 +49,6 @@ public class Configuration : Shared.Models.Properties.IPropertyConfiguration
|
|||||||
string personBirthdayFormat,
|
string personBirthdayFormat,
|
||||||
bool populatePropertyId,
|
bool populatePropertyId,
|
||||||
string? predictorModelName,
|
string? predictorModelName,
|
||||||
bool propertiesChangedForProperty,
|
|
||||||
string[] propertyContentCollectionFiles,
|
string[] propertyContentCollectionFiles,
|
||||||
string resultAllInOne,
|
string resultAllInOne,
|
||||||
int resultAllInOneSubdirectoryLength,
|
int resultAllInOneSubdirectoryLength,
|
||||||
@ -67,7 +63,6 @@ public class Configuration : Shared.Models.Properties.IPropertyConfiguration
|
|||||||
{
|
{
|
||||||
DateGroup = dateGroup;
|
DateGroup = dateGroup;
|
||||||
FileNameDirectorySeparator = fileNameDirectorySeparator;
|
FileNameDirectorySeparator = fileNameDirectorySeparator;
|
||||||
ForcePropertyLastWriteTimeToCreationTime = forcePropertyLastWriteTimeToCreationTime;
|
|
||||||
IgnoreExtensions = ignoreExtensions;
|
IgnoreExtensions = ignoreExtensions;
|
||||||
IgnoreRulesKeyWords = ignoreRulesKeyWords;
|
IgnoreRulesKeyWords = ignoreRulesKeyWords;
|
||||||
IntMinValueLength = intMinValueLength;
|
IntMinValueLength = intMinValueLength;
|
||||||
@ -80,7 +75,6 @@ public class Configuration : Shared.Models.Properties.IPropertyConfiguration
|
|||||||
PersonBirthdayFormat = personBirthdayFormat;
|
PersonBirthdayFormat = personBirthdayFormat;
|
||||||
PredictorModelName = predictorModelName;
|
PredictorModelName = predictorModelName;
|
||||||
PopulatePropertyId = populatePropertyId;
|
PopulatePropertyId = populatePropertyId;
|
||||||
PropertiesChangedForProperty = propertiesChangedForProperty;
|
|
||||||
PropertyContentCollectionFiles = propertyContentCollectionFiles;
|
PropertyContentCollectionFiles = propertyContentCollectionFiles;
|
||||||
ResultAllInOne = resultAllInOne;
|
ResultAllInOne = resultAllInOne;
|
||||||
ResultAllInOneSubdirectoryLength = resultAllInOneSubdirectoryLength;
|
ResultAllInOneSubdirectoryLength = resultAllInOneSubdirectoryLength;
|
||||||
|
44
Rename/.vscode/appsettings.example.json
vendored
44
Rename/.vscode/appsettings.example.json
vendored
@ -82,28 +82,54 @@
|
|||||||
"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",
|
||||||
|
".heic",
|
||||||
|
".HEIC",
|
||||||
|
".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": [
|
||||||
|
".avif",
|
||||||
".bmp",
|
".bmp",
|
||||||
".BMP",
|
|
||||||
".gif",
|
".gif",
|
||||||
".GIF",
|
".heic",
|
||||||
|
".insp",
|
||||||
|
".jp2",
|
||||||
|
".jpe",
|
||||||
".jpeg",
|
".jpeg",
|
||||||
".JPEG",
|
|
||||||
".jpg",
|
".jpg",
|
||||||
".JPG",
|
".jxl",
|
||||||
".png",
|
".png",
|
||||||
".PNG",
|
".psd",
|
||||||
".tiff",
|
".raw",
|
||||||
".TIFF",
|
".rw2",
|
||||||
|
".svg",
|
||||||
".tif",
|
".tif",
|
||||||
".TIF"
|
".tiff",
|
||||||
|
".webp"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -85,7 +85,7 @@ public class Rename
|
|||||||
const bool useCeilingAverage = false;
|
const bool useCeilingAverage = false;
|
||||||
const string directorySearchFilter = "*";
|
const string directorySearchFilter = "*";
|
||||||
List<string> distinctDirectories = [];
|
List<string> distinctDirectories = [];
|
||||||
B_Metadata metadata = new(_PropertyConfiguration);
|
A_Metadata metadata = new(_PropertyConfiguration);
|
||||||
List<(FileHolder, string, string)> toDoCollection = [];
|
List<(FileHolder, string, string)> toDoCollection = [];
|
||||||
List<(FileHolder, string)> verifiedToDoCollection = [];
|
List<(FileHolder, string)> verifiedToDoCollection = [];
|
||||||
ProgressBarOptions options = new() { ProgressCharacter = '─', ProgressBarOnBottom = true, DisableBottomPercentage = true };
|
ProgressBarOptions options = new() { ProgressCharacter = '─', ProgressBarOnBottom = true, DisableBottomPercentage = true };
|
||||||
@ -209,7 +209,7 @@ public class Rename
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Record> GetRecords(B_Metadata metadata, int offset, ProgressBar progressBar, string[] files)
|
private List<Record> GetRecords(A_Metadata metadata, int offset, ProgressBar progressBar, string[] files)
|
||||||
{
|
{
|
||||||
List<Record> results = [];
|
List<Record> results = [];
|
||||||
int? id;
|
int? id;
|
||||||
|
@ -195,7 +195,7 @@ public class C_Resize
|
|||||||
{
|
{
|
||||||
Dictionary<string, int[]>? results;
|
Dictionary<string, int[]>? results;
|
||||||
string json;
|
string json;
|
||||||
string[] changesFrom = [nameof(A_Property), nameof(B_Metadata)];
|
string[] changesFrom = [nameof(A_Metadata)];
|
||||||
List<DateTime> dateTimes = (from l in subFileTuples where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
List<DateTime> dateTimes = (from l in subFileTuples where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
||||||
CombinedEnumAndIndex cei = Shared.Models.Stateless.Methods.IPath.GetCombinedEnumAndIndex(_PropertyConfiguration, filePath);
|
CombinedEnumAndIndex cei = Shared.Models.Stateless.Methods.IPath.GetCombinedEnumAndIndex(_PropertyConfiguration, filePath);
|
||||||
string fileName = $"{mappingFromItem.FilePath.NameWithoutExtension}{mappingFromItem.FilePath.ExtensionLowered}.json";
|
string fileName = $"{mappingFromItem.FilePath.NameWithoutExtension}{mappingFromItem.FilePath.ExtensionLowered}.json";
|
||||||
@ -353,7 +353,7 @@ public class C_Resize
|
|||||||
int outputResolutionHeight = resize[_OutputResolutionHeightIndex];
|
int outputResolutionHeight = resize[_OutputResolutionHeightIndex];
|
||||||
int outputResolutionOrientation = resize[_OutputResolutionOrientationIndex];
|
int outputResolutionOrientation = resize[_OutputResolutionOrientationIndex];
|
||||||
int[] originalCollection = outputResolutionToResize[_Original];
|
int[] originalCollection = outputResolutionToResize[_Original];
|
||||||
string[] changesFrom = [nameof(A_Property), nameof(B_Metadata), nameof(C_Resize)];
|
string[] changesFrom = [nameof(A_Metadata), nameof(C_Resize)];
|
||||||
List<DateTime> dateTimes = (from l in subFileTuples where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
List<DateTime> dateTimes = (from l in subFileTuples where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
||||||
if (_OverrideForResizeImages)
|
if (_OverrideForResizeImages)
|
||||||
check = true;
|
check = true;
|
||||||
|
@ -64,7 +64,7 @@ public class SetCreatedDate
|
|||||||
{ }
|
{ }
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Record> GetRecords(ProgressBar progressBar, ASCIIEncoding asciiEncoding, B_Metadata metadata, string[] files)
|
private List<Record> GetRecords(ProgressBar progressBar, ASCIIEncoding asciiEncoding, A_Metadata metadata, string[] files)
|
||||||
{
|
{
|
||||||
List<Record> results = [];
|
List<Record> results = [];
|
||||||
int? id;
|
int? id;
|
||||||
@ -101,9 +101,9 @@ public class SetCreatedDate
|
|||||||
int minutes;
|
int minutes;
|
||||||
Record[] records;
|
Record[] records;
|
||||||
List<Record> unordered;
|
List<Record> unordered;
|
||||||
ASCIIEncoding asciiEncoding = new();
|
|
||||||
B_Metadata metadata = new(_PropertyConfiguration);
|
|
||||||
List<Record[]> collections = [];
|
List<Record[]> collections = [];
|
||||||
|
ASCIIEncoding asciiEncoding = new();
|
||||||
|
A_Metadata metadata = new(_PropertyConfiguration);
|
||||||
foreach (string[] files in filesCollection)
|
foreach (string[] files in filesCollection)
|
||||||
{
|
{
|
||||||
minutes = 0;
|
minutes = 0;
|
||||||
|
@ -69,28 +69,54 @@
|
|||||||
"ResultSingleton": "{}",
|
"ResultSingleton": "{}",
|
||||||
"RootDirectory": "D:/Images",
|
"RootDirectory": "D:/Images",
|
||||||
"IgnoreExtensions": [
|
"IgnoreExtensions": [
|
||||||
|
".ffs_db",
|
||||||
|
".FFS_DB",
|
||||||
".gif",
|
".gif",
|
||||||
".GIF",
|
".GIF",
|
||||||
|
".heic",
|
||||||
|
".HEIC",
|
||||||
|
".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": [
|
||||||
|
".avif",
|
||||||
".bmp",
|
".bmp",
|
||||||
".BMP",
|
|
||||||
".gif",
|
".gif",
|
||||||
".GIF",
|
".heic",
|
||||||
|
".insp",
|
||||||
|
".jp2",
|
||||||
|
".jpe",
|
||||||
".jpeg",
|
".jpeg",
|
||||||
".JPEG",
|
|
||||||
".jpg",
|
".jpg",
|
||||||
".JPG",
|
".jxl",
|
||||||
".png",
|
".png",
|
||||||
".PNG",
|
".psd",
|
||||||
".tiff",
|
".raw",
|
||||||
".TIFF",
|
".rw2",
|
||||||
|
".svg",
|
||||||
".tif",
|
".tif",
|
||||||
".TIF"
|
".tiff",
|
||||||
|
".webp"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ public interface IPropertyConfiguration
|
|||||||
public string[] IgnoreRulesKeyWords { init; get; }
|
public string[] IgnoreRulesKeyWords { init; get; }
|
||||||
public int IntMinValueLength { init; get; }
|
public int IntMinValueLength { init; get; }
|
||||||
public string PersonBirthdayFormat { init; get; }
|
public string PersonBirthdayFormat { init; get; }
|
||||||
public bool PropertiesChangedForProperty { init; get; }
|
|
||||||
public string[] PropertyContentCollectionFiles { init; get; }
|
public string[] PropertyContentCollectionFiles { init; get; }
|
||||||
public string ResultAllInOne { init; get; }
|
public string ResultAllInOne { init; get; }
|
||||||
public int ResultAllInOneSubdirectoryLength { init; get; }
|
public int ResultAllInOneSubdirectoryLength { init; get; }
|
||||||
|
@ -5,7 +5,8 @@ public interface IDlibDotNet
|
|||||||
|
|
||||||
void Tick();
|
void Tick();
|
||||||
long Ticks { get; }
|
long Ticks { get; }
|
||||||
(string, string) GetResultsFullGroupDirectories();
|
int? CurrentTick { get; }
|
||||||
|
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);
|
||||||
|
|
||||||
|
@ -19,6 +19,9 @@ public interface IId
|
|||||||
public static bool IsOffsetDeterministicHashCode(IPropertyConfiguration propertyConfiguration) =>
|
public static bool IsOffsetDeterministicHashCode(IPropertyConfiguration propertyConfiguration) =>
|
||||||
propertyConfiguration.Offset == DeterministicHashCode;
|
propertyConfiguration.Offset == DeterministicHashCode;
|
||||||
|
|
||||||
|
public static string GetIntelligentId(IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
|
||||||
|
Id.GetIntelligentId(propertyConfiguration, filePath);
|
||||||
|
|
||||||
public static byte GetHasDateTimeOriginal(IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
|
public static byte GetHasDateTimeOriginal(IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
|
||||||
Id.GetHasDateTimeOriginal(propertyConfiguration, filePath);
|
Id.GetHasDateTimeOriginal(propertyConfiguration, filePath);
|
||||||
|
|
||||||
@ -31,16 +34,19 @@ public interface IId
|
|||||||
public static bool NameWithoutExtensionIsIntelligentIdFormat(IPropertyConfiguration propertyConfiguration, string fileNameFirstSegment) =>
|
public static bool NameWithoutExtensionIsIntelligentIdFormat(IPropertyConfiguration propertyConfiguration, string fileNameFirstSegment) =>
|
||||||
fileNameFirstSegment.Length - 1 == propertyConfiguration.IntMinValueLength && fileNameFirstSegment[^1] is '0' or '1' or '2' or '3' or '4' or '5' or '6' or '7' or '8' or '9' && fileNameFirstSegment.All(char.IsNumber);
|
fileNameFirstSegment.Length - 1 == propertyConfiguration.IntMinValueLength && fileNameFirstSegment[^1] is '0' or '1' or '2' or '3' or '4' or '5' or '6' or '7' or '8' or '9' && fileNameFirstSegment.All(char.IsNumber);
|
||||||
|
|
||||||
public static string GetIntelligentId(IPropertyConfiguration propertyConfiguration, long id, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal) =>
|
public static string? GetPaddedId(IPropertyConfiguration propertyConfiguration, FilePath filePath, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index) =>
|
||||||
Id.GetIntelligentId(propertyConfiguration, id, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal);
|
Id.GetPaddedId(propertyConfiguration, filePath, hasIgnoreKeyword, hasDateTimeOriginal, index);
|
||||||
|
|
||||||
public static bool NameWithoutExtensionIsPaddedIntelligentIdFormat(IPropertyConfiguration propertyConfiguration, int sortOrderOnlyLengthIndex, string fileNameFirstSegment) =>
|
public static bool NameWithoutExtensionIsPaddedIntelligentIdFormat(IPropertyConfiguration propertyConfiguration, int sortOrderOnlyLengthIndex, string fileNameFirstSegment) =>
|
||||||
fileNameFirstSegment.Length == propertyConfiguration.IntMinValueLength + sortOrderOnlyLengthIndex + 1
|
fileNameFirstSegment.Length == propertyConfiguration.IntMinValueLength + sortOrderOnlyLengthIndex + 1
|
||||||
&& fileNameFirstSegment[^1] is '0' or '1' or '2' or '3' or '4' or '5' or '6' or '7' or '8' or '9'
|
&& fileNameFirstSegment[^1] is '0' or '1' or '2' or '3' or '4' or '5' or '6' or '7' or '8' or '9'
|
||||||
&& fileNameFirstSegment.All(char.IsNumber);
|
&& fileNameFirstSegment.All(char.IsNumber);
|
||||||
|
|
||||||
public static string GetPaddedId(IPropertyConfiguration propertyConfiguration, int id, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index) =>
|
public static string? GetPaddedId(IPropertyConfiguration propertyConfiguration, int id, string nameWithoutExtension, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index) =>
|
||||||
Id.GetPaddedId(propertyConfiguration, id, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal, index);
|
Id.GetPaddedId(propertyConfiguration, id, nameWithoutExtension, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal, index);
|
||||||
|
|
||||||
|
public static string GetPaddedId(IPropertyConfiguration propertyConfiguration, FilePath filePath, int? index) =>
|
||||||
|
Id.GetPaddedId(propertyConfiguration, filePath, index);
|
||||||
|
|
||||||
internal int TestStatic_GetDeterministicHashCode(byte[] value) =>
|
internal int TestStatic_GetDeterministicHashCode(byte[] value) =>
|
||||||
GetDeterministicHashCode(value);
|
GetDeterministicHashCode(value);
|
||||||
@ -51,9 +57,15 @@ public interface IId
|
|||||||
internal int TestStatic_GetId(IPropertyConfiguration propertyConfiguration, string intelligentId) =>
|
internal int TestStatic_GetId(IPropertyConfiguration propertyConfiguration, string intelligentId) =>
|
||||||
GetId(propertyConfiguration, intelligentId);
|
GetId(propertyConfiguration, intelligentId);
|
||||||
|
|
||||||
|
internal string TestStatic_GetIntelligentId(IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
|
||||||
|
GetIntelligentId(propertyConfiguration, filePath);
|
||||||
|
|
||||||
internal byte TestStatic_GetHasDateTimeOriginal(IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
|
internal byte TestStatic_GetHasDateTimeOriginal(IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
|
||||||
GetHasDateTimeOriginal(propertyConfiguration, filePath);
|
GetHasDateTimeOriginal(propertyConfiguration, filePath);
|
||||||
|
|
||||||
|
internal string TestStatic_GetPaddedId(IPropertyConfiguration propertyConfiguration, FilePath filePath, int? index) =>
|
||||||
|
GetPaddedId(propertyConfiguration, filePath, index);
|
||||||
|
|
||||||
internal byte TestStatic_GetMissingDateTimeOriginal(IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
|
internal byte TestStatic_GetMissingDateTimeOriginal(IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
|
||||||
GetMissingDateTimeOriginal(propertyConfiguration, filePath);
|
GetMissingDateTimeOriginal(propertyConfiguration, filePath);
|
||||||
|
|
||||||
@ -63,13 +75,13 @@ public interface IId
|
|||||||
internal bool TestStatic_NameWithoutExtensionIsIntelligentIdFormat(IPropertyConfiguration propertyConfiguration, string fileNameFirstSegment) =>
|
internal bool TestStatic_NameWithoutExtensionIsIntelligentIdFormat(IPropertyConfiguration propertyConfiguration, string fileNameFirstSegment) =>
|
||||||
NameWithoutExtensionIsIntelligentIdFormat(propertyConfiguration, fileNameFirstSegment);
|
NameWithoutExtensionIsIntelligentIdFormat(propertyConfiguration, fileNameFirstSegment);
|
||||||
|
|
||||||
internal string TestStatic_GetIntelligentId(IPropertyConfiguration propertyConfiguration, long id, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal) =>
|
internal string? TestStatic_GetPaddedId(IPropertyConfiguration propertyConfiguration, FilePath filePath, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index) =>
|
||||||
GetIntelligentId(propertyConfiguration, id, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal);
|
GetPaddedId(propertyConfiguration, filePath, hasIgnoreKeyword, hasDateTimeOriginal, index);
|
||||||
|
|
||||||
internal bool TestStatic_NameWithoutExtensionIsPaddedIntelligentIdFormat(IPropertyConfiguration propertyConfiguration, int sortOrderOnlyLengthIndex, string fileNameFirstSegment) =>
|
internal bool TestStatic_NameWithoutExtensionIsPaddedIntelligentIdFormat(IPropertyConfiguration propertyConfiguration, int sortOrderOnlyLengthIndex, string fileNameFirstSegment) =>
|
||||||
NameWithoutExtensionIsPaddedIntelligentIdFormat(propertyConfiguration, sortOrderOnlyLengthIndex, fileNameFirstSegment);
|
NameWithoutExtensionIsPaddedIntelligentIdFormat(propertyConfiguration, sortOrderOnlyLengthIndex, fileNameFirstSegment);
|
||||||
|
|
||||||
internal string TestStatic_GetPaddedId(IPropertyConfiguration propertyConfiguration, int id, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index) =>
|
internal string? TestStatic_GetPaddedId(IPropertyConfiguration propertyConfiguration, int id, string nameWithoutExtension, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index) =>
|
||||||
GetPaddedId(propertyConfiguration, id, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal, index);
|
GetPaddedId(propertyConfiguration, id, nameWithoutExtension, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal, index);
|
||||||
|
|
||||||
}
|
}
|
@ -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,
|
||||||
|
@ -24,9 +24,6 @@ public interface IPath
|
|||||||
public static void MakeHiddenIfAllItemsAreHidden(string rootDirectory) =>
|
public static void MakeHiddenIfAllItemsAreHidden(string rootDirectory) =>
|
||||||
XPath.MakeHiddenIfAllItemsAreHidden(rootDirectory);
|
XPath.MakeHiddenIfAllItemsAreHidden(rootDirectory);
|
||||||
|
|
||||||
public static void CreateDirectories(ReadOnlyCollection<string> directories) =>
|
|
||||||
XPath.CreateDirectories(directories);
|
|
||||||
|
|
||||||
public static void ChangeDateForEmptyDirectories(string rootDirectory, long ticks) =>
|
public static void ChangeDateForEmptyDirectories(string rootDirectory, long ticks) =>
|
||||||
XPath.ChangeDateForEmptyDirectories(rootDirectory, ticks);
|
XPath.ChangeDateForEmptyDirectories(rootDirectory, ticks);
|
||||||
|
|
||||||
@ -68,9 +65,6 @@ public interface IPath
|
|||||||
internal void TestStatic_MakeHiddenIfAllItemsAreHidden(string rootDirectory) =>
|
internal void TestStatic_MakeHiddenIfAllItemsAreHidden(string rootDirectory) =>
|
||||||
MakeHiddenIfAllItemsAreHidden(rootDirectory);
|
MakeHiddenIfAllItemsAreHidden(rootDirectory);
|
||||||
|
|
||||||
internal void TestStatic_CreateDirectories(ReadOnlyCollection<string> directories) =>
|
|
||||||
CreateDirectories(directories);
|
|
||||||
|
|
||||||
internal void TestStatic_ChangeDateForEmptyDirectories(string rootDirectory, long ticks) =>
|
internal void TestStatic_ChangeDateForEmptyDirectories(string rootDirectory, long ticks) =>
|
||||||
ChangeDateForEmptyDirectories(rootDirectory, ticks);
|
ChangeDateForEmptyDirectories(rootDirectory, ticks);
|
||||||
|
|
||||||
|
@ -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,26 @@ 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 string GetExtension(string nameWithoutExtension, string extensionLowered) =>
|
||||||
|
extensionLowered is not ".xmp" and not ".json" ? extensionLowered : Path.GetExtension(nameWithoutExtension);
|
||||||
|
|
||||||
|
private static string GetExtension(FilePath filePath) =>
|
||||||
|
GetExtension(filePath.NameWithoutExtension, filePath.ExtensionLowered);
|
||||||
|
|
||||||
|
private static bool IsIgnoreOrValidVideoFormatExtension(IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
|
||||||
|
IsIgnoreOrValidVideoFormatExtension(propertyConfiguration, GetExtension(filePath));
|
||||||
|
|
||||||
|
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 +64,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 +77,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 nameWithoutExtension, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal)
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
StringBuilder stringBuilder = new();
|
StringBuilder stringBuilder = new();
|
||||||
@ -79,18 +93,20 @@ internal abstract class Id
|
|||||||
}
|
}
|
||||||
else if (id > -1)
|
else if (id > -1)
|
||||||
{
|
{
|
||||||
if (!propertyConfiguration.ValidVideoFormatExtensions.Contains(extensionLowered))
|
string checkExtension = GetExtension(nameWithoutExtension, extensionLowered);
|
||||||
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? 8 : hasDateTimeOriginal.Value ? 9 : 7;
|
if (IsIgnoreOrValidVideoFormatExtension(propertyConfiguration, checkExtension))
|
||||||
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))
|
string checkExtension = GetExtension(nameWithoutExtension, extensionLowered);
|
||||||
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? 2 : hasDateTimeOriginal.Value ? 1 : 3;
|
if (IsIgnoreOrValidVideoFormatExtension(propertyConfiguration, checkExtension))
|
||||||
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,14 +117,51 @@ 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 GetIntelligentId(IPropertyConfiguration propertyConfiguration, FilePath filePath) =>
|
||||||
|
filePath.Id is null ? throw new Exception() : GetIntelligentId(propertyConfiguration, filePath.Id.Value, filePath.NameWithoutExtension, filePath.ExtensionLowered, filePath.HasIgnoreKeyword, filePath.HasDateTimeOriginal);
|
||||||
|
|
||||||
|
internal static string GetPaddedId(IPropertyConfiguration propertyConfiguration, FilePath filePath, int? index)
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
if (propertyConfiguration.Offset < 0)
|
if (propertyConfiguration.Offset < 0)
|
||||||
result = Guid.NewGuid().ToString();
|
result = Guid.NewGuid().ToString();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string intelligentId = GetIntelligentId(propertyConfiguration, id, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal);
|
string intelligentId = GetIntelligentId(propertyConfiguration, filePath);
|
||||||
|
int check = GetId(propertyConfiguration, intelligentId);
|
||||||
|
if (filePath.Id is not null && check != filePath.Id.Value)
|
||||||
|
throw new NotSupportedException();
|
||||||
|
result = index is null || propertyConfiguration.Offset == IId.DeterministicHashCode ? intelligentId : $"{propertyConfiguration.Offset + index}{intelligentId}";
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static string? GetPaddedId(IPropertyConfiguration propertyConfiguration, FilePath filePath, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index)
|
||||||
|
{
|
||||||
|
string? result;
|
||||||
|
if (filePath.Id is null)
|
||||||
|
result = null;
|
||||||
|
else if (propertyConfiguration.Offset < 0)
|
||||||
|
result = Guid.NewGuid().ToString();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string intelligentId = GetIntelligentId(propertyConfiguration, filePath.Id.Value, filePath.NameWithoutExtension, filePath.ExtensionLowered, hasIgnoreKeyword, hasDateTimeOriginal);
|
||||||
|
int check = GetId(propertyConfiguration, intelligentId);
|
||||||
|
if (filePath.Id is not null && check != filePath.Id.Value)
|
||||||
|
throw new NotSupportedException();
|
||||||
|
result = index is null || propertyConfiguration.Offset == IId.DeterministicHashCode ? intelligentId : $"{propertyConfiguration.Offset + index}{intelligentId}";
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static string GetPaddedId(IPropertyConfiguration propertyConfiguration, int id, string nameWithoutExtension, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index)
|
||||||
|
{
|
||||||
|
string result;
|
||||||
|
if (propertyConfiguration.Offset < 0)
|
||||||
|
result = Guid.NewGuid().ToString();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string intelligentId = GetIntelligentId(propertyConfiguration, id, nameWithoutExtension, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal);
|
||||||
int check = GetId(propertyConfiguration, intelligentId);
|
int check = GetId(propertyConfiguration, intelligentId);
|
||||||
if (check != id)
|
if (check != id)
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
|
@ -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
|
||||||
{
|
{
|
||||||
|
@ -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;
|
||||||
|
|
||||||
@ -302,7 +303,7 @@ internal abstract partial class XDirectory
|
|||||||
internal static (string[], List<(FilePath, string)>) GetToDoCollection(Properties.IPropertyConfiguration propertyConfiguration, bool copyDuplicates, bool ifCanUseId, ReadOnlyCollection<ReadOnlyCollection<FilePath>> filePathsCollection, ReadOnlyDictionary<byte, ReadOnlyCollection<string>> fileGroups, ReadOnlyDictionary<int, ExifDirectory>? exifDirectoriesById, Action? tick)
|
internal static (string[], List<(FilePath, string)>) GetToDoCollection(Properties.IPropertyConfiguration propertyConfiguration, bool copyDuplicates, bool ifCanUseId, ReadOnlyCollection<ReadOnlyCollection<FilePath>> filePathsCollection, ReadOnlyDictionary<byte, ReadOnlyCollection<string>> fileGroups, ReadOnlyDictionary<int, ExifDirectory>? exifDirectoriesById, Action? tick)
|
||||||
{
|
{
|
||||||
List<(FilePath, string)> results = [];
|
List<(FilePath, string)> results = [];
|
||||||
string paddedId;
|
string? paddedId;
|
||||||
string checkFile;
|
string checkFile;
|
||||||
string directory;
|
string directory;
|
||||||
FilePath filePath;
|
FilePath filePath;
|
||||||
@ -353,10 +354,7 @@ internal abstract partial class XDirectory
|
|||||||
{ }
|
{ }
|
||||||
}
|
}
|
||||||
if (exifDirectoriesById is null || !exifDirectoriesById.TryGetValue(filePath.Id.Value, out exifDirectory))
|
if (exifDirectoriesById is null || !exifDirectoriesById.TryGetValue(filePath.Id.Value, out exifDirectory))
|
||||||
{
|
paddedId = IId.GetPaddedId(propertyConfiguration, filePath, i);
|
||||||
hasIgnoreKeyword = filePath.HasIgnoreKeyword;
|
|
||||||
hasDateTimeOriginal = filePath.HasDateTimeOriginal;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dateTime = IDate.GetDateTimeOriginal(exifDirectory);
|
dateTime = IDate.GetDateTimeOriginal(exifDirectory);
|
||||||
@ -365,8 +363,8 @@ internal abstract partial class XDirectory
|
|||||||
continue;
|
continue;
|
||||||
keywords = MetaBase.GetKeywords(exifDirectory?.ExifBaseDirectories);
|
keywords = MetaBase.GetKeywords(exifDirectory?.ExifBaseDirectories);
|
||||||
hasIgnoreKeyword = propertyConfiguration.IgnoreRulesKeyWords.Any(keywords.Contains);
|
hasIgnoreKeyword = propertyConfiguration.IgnoreRulesKeyWords.Any(keywords.Contains);
|
||||||
|
paddedId = IId.GetPaddedId(propertyConfiguration, filePath, hasIgnoreKeyword, hasDateTimeOriginal, i);
|
||||||
}
|
}
|
||||||
paddedId = IId.GetPaddedId(propertyConfiguration, filePath.Id.Value, filePath.ExtensionLowered, hasIgnoreKeyword, hasDateTimeOriginal, i);
|
|
||||||
paddedIdFile = Path.Combine(filePath.DirectoryFullPath, $"{paddedId}{filePath.ExtensionLowered}");
|
paddedIdFile = Path.Combine(filePath.DirectoryFullPath, $"{paddedId}{filePath.ExtensionLowered}");
|
||||||
if (!File.Exists(paddedIdFile))
|
if (!File.Exists(paddedIdFile))
|
||||||
{
|
{
|
||||||
@ -384,15 +382,20 @@ 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);
|
||||||
if (!isOffsetDeterministicHashCode)
|
if (!isOffsetDeterministicHashCode)
|
||||||
checkFile = Path.Combine(directory, $"{intelligentId}{filePath.ExtensionLowered}");
|
checkFile = Path.Combine(directory, $"{intelligentId}{filePath.ExtensionLowered}");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (filePath.DirectoryFullPath is null)
|
if (filePath.DirectoryFullPath is null)
|
||||||
continue;
|
continue;
|
||||||
paddedId = IId.GetPaddedId(propertyConfiguration, filePath.Id.Value, filePath.ExtensionLowered, filePath.HasIgnoreKeyword, filePath.HasDateTimeOriginal, i);
|
paddedId = IId.GetPaddedId(propertyConfiguration, filePath, i);
|
||||||
paddedIdFile = Path.Combine(filePath.DirectoryFullPath, $"{paddedId}{filePath.ExtensionLowered}");
|
paddedIdFile = Path.Combine(filePath.DirectoryFullPath, $"{paddedId}{filePath.ExtensionLowered}");
|
||||||
if (File.Exists(paddedIdFile))
|
if (File.Exists(paddedIdFile))
|
||||||
continue;
|
continue;
|
||||||
|
@ -233,20 +233,6 @@ internal abstract class XPath
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void CreateDirectories(ReadOnlyCollection<string> directories)
|
|
||||||
{
|
|
||||||
string checkDirectory;
|
|
||||||
foreach (string directory in directories)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < 101; i++)
|
|
||||||
{
|
|
||||||
checkDirectory = Path.Combine(directory, i.ToString("000"));
|
|
||||||
if (!Directory.Exists(checkDirectory))
|
|
||||||
_ = Directory.CreateDirectory(checkDirectory);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static void ChangeDateForEmptyDirectories(string rootDirectory, long ticks)
|
internal static void ChangeDateForEmptyDirectories(string rootDirectory, long ticks)
|
||||||
{
|
{
|
||||||
DateTime dateTime = new(ticks);
|
DateTime dateTime = new(ticks);
|
||||||
|
@ -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);
|
||||||
|
@ -59,46 +59,46 @@ public partial class UnitTestHardCoded
|
|||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
id = 748161839;
|
id = 748161839;
|
||||||
string imageTrueTruePositive = IId.GetPaddedId(_PropertyConfiguration, id, ".jpg", hasIgnoreKeyword: true, hasDateTimeOriginal: true, index: null);
|
string? imageTrueTruePositive = IId.GetPaddedId(_PropertyConfiguration, id, string.Empty, ".jpg", hasIgnoreKeyword: true, hasDateTimeOriginal: true, index: null);
|
||||||
Assert.AreEqual("816184700398", imageTrueTruePositive);
|
Assert.AreEqual("816184700398", imageTrueTruePositive);
|
||||||
string imageTrueFalsePositive = IId.GetPaddedId(_PropertyConfiguration, id, ".jpg", hasIgnoreKeyword: true, hasDateTimeOriginal: false, index: null);
|
string? imageTrueFalsePositive = IId.GetPaddedId(_PropertyConfiguration, id, string.Empty, ".jpg", hasIgnoreKeyword: true, hasDateTimeOriginal: false, index: null);
|
||||||
Assert.AreEqual("816184700398", imageTrueFalsePositive);
|
Assert.AreEqual("816184700398", imageTrueFalsePositive);
|
||||||
string imageFalseFalsePositive = IId.GetPaddedId(_PropertyConfiguration, id, ".jpg", hasIgnoreKeyword: false, hasDateTimeOriginal: false, index: null);
|
string? imageFalseFalsePositive = IId.GetPaddedId(_PropertyConfiguration, id, string.Empty, ".jpg", hasIgnoreKeyword: false, hasDateTimeOriginal: false, index: null);
|
||||||
Assert.AreEqual("816184700397", imageFalseFalsePositive);
|
Assert.AreEqual("816184700397", imageFalseFalsePositive);
|
||||||
string imageFalseTruePositive = IId.GetPaddedId(_PropertyConfiguration, id, ".jpg", hasIgnoreKeyword: false, hasDateTimeOriginal: true, index: null);
|
string? imageFalseTruePositive = IId.GetPaddedId(_PropertyConfiguration, id, string.Empty, ".jpg", hasIgnoreKeyword: false, hasDateTimeOriginal: true, index: null);
|
||||||
Assert.AreEqual("816184700399", imageFalseTruePositive);
|
Assert.AreEqual("816184700399", imageFalseTruePositive);
|
||||||
try
|
try
|
||||||
{ string videoTrueTruePositive = IId.GetPaddedId(_PropertyConfiguration, id, ".mov", hasIgnoreKeyword: true, hasDateTimeOriginal: true, index: null); }
|
{ string? videoTrueTruePositive = IId.GetPaddedId(_PropertyConfiguration, id, string.Empty, ".mov", hasIgnoreKeyword: true, hasDateTimeOriginal: true, index: null); }
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{ }
|
{ }
|
||||||
try
|
try
|
||||||
{ string videoTrueFalsePositive = IId.GetPaddedId(_PropertyConfiguration, id, ".mov", hasIgnoreKeyword: true, hasDateTimeOriginal: false, index: null); }
|
{ string? videoTrueFalsePositive = IId.GetPaddedId(_PropertyConfiguration, id, string.Empty, ".mov", hasIgnoreKeyword: true, hasDateTimeOriginal: false, index: null); }
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{ }
|
{ }
|
||||||
string videoFalseFalsePositive = IId.GetPaddedId(_PropertyConfiguration, id, ".mov", hasIgnoreKeyword: false, hasDateTimeOriginal: false, index: null);
|
string? videoFalseFalsePositive = IId.GetPaddedId(_PropertyConfiguration, id, string.Empty, ".mov", hasIgnoreKeyword: false, hasDateTimeOriginal: false, index: null);
|
||||||
Assert.AreEqual("816184700395", videoFalseFalsePositive);
|
Assert.AreEqual("816184700395", videoFalseFalsePositive);
|
||||||
string videoFalseTruePositive = IId.GetPaddedId(_PropertyConfiguration, id, ".mov", hasIgnoreKeyword: false, hasDateTimeOriginal: true, index: null);
|
string? videoFalseTruePositive = IId.GetPaddedId(_PropertyConfiguration, id, string.Empty, ".mov", hasIgnoreKeyword: false, hasDateTimeOriginal: true, index: null);
|
||||||
Assert.AreEqual("816184700396", videoFalseTruePositive);
|
Assert.AreEqual("816184700396", videoFalseTruePositive);
|
||||||
id = -748161839;
|
id = -748161839;
|
||||||
string imageTrueTrueNegative = IId.GetPaddedId(_PropertyConfiguration, id, ".jpg", hasIgnoreKeyword: true, hasDateTimeOriginal: true, index: null);
|
string? imageTrueTrueNegative = IId.GetPaddedId(_PropertyConfiguration, id, string.Empty, ".jpg", hasIgnoreKeyword: true, hasDateTimeOriginal: true, index: null);
|
||||||
Assert.AreEqual("816184700392", imageTrueTrueNegative);
|
Assert.AreEqual("816184700392", imageTrueTrueNegative);
|
||||||
string imageTrueFalseNegative = IId.GetPaddedId(_PropertyConfiguration, id, ".jpg", hasIgnoreKeyword: true, hasDateTimeOriginal: false, index: null);
|
string? imageTrueFalseNegative = IId.GetPaddedId(_PropertyConfiguration, id, string.Empty, ".jpg", hasIgnoreKeyword: true, hasDateTimeOriginal: false, index: null);
|
||||||
Assert.AreEqual("816184700392", imageTrueFalseNegative);
|
Assert.AreEqual("816184700392", imageTrueFalseNegative);
|
||||||
string imageFalseFalseNegative = IId.GetPaddedId(_PropertyConfiguration, id, ".jpg", hasIgnoreKeyword: false, hasDateTimeOriginal: false, index: null);
|
string? imageFalseFalseNegative = IId.GetPaddedId(_PropertyConfiguration, id, string.Empty, ".jpg", hasIgnoreKeyword: false, hasDateTimeOriginal: false, index: null);
|
||||||
Assert.AreEqual("816184700393", imageFalseFalseNegative);
|
Assert.AreEqual("816184700393", imageFalseFalseNegative);
|
||||||
string imageFalseTrueNegative = IId.GetPaddedId(_PropertyConfiguration, id, ".jpg", hasIgnoreKeyword: false, hasDateTimeOriginal: true, index: null);
|
string? imageFalseTrueNegative = IId.GetPaddedId(_PropertyConfiguration, id, string.Empty, ".jpg", hasIgnoreKeyword: false, hasDateTimeOriginal: true, index: null);
|
||||||
Assert.AreEqual("816184700391", imageFalseTrueNegative);
|
Assert.AreEqual("816184700391", imageFalseTrueNegative);
|
||||||
try
|
try
|
||||||
{ string videoTrueTrueNegative = IId.GetPaddedId(_PropertyConfiguration, id, ".mov", hasIgnoreKeyword: true, hasDateTimeOriginal: true, index: null); }
|
{ string? videoTrueTrueNegative = IId.GetPaddedId(_PropertyConfiguration, id, string.Empty, ".mov", hasIgnoreKeyword: true, hasDateTimeOriginal: true, index: null); }
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{ }
|
{ }
|
||||||
try
|
try
|
||||||
{ string videoTrueFalseNegative = IId.GetPaddedId(_PropertyConfiguration, id, ".mov", hasIgnoreKeyword: true, hasDateTimeOriginal: false, index: null); }
|
{ string? videoTrueFalseNegative = IId.GetPaddedId(_PropertyConfiguration, id, string.Empty, ".mov", hasIgnoreKeyword: true, hasDateTimeOriginal: false, index: null); }
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{ }
|
{ }
|
||||||
string videoFalseFalseNegative = IId.GetPaddedId(_PropertyConfiguration, id, ".mov", hasIgnoreKeyword: false, hasDateTimeOriginal: false, index: null);
|
string? videoFalseFalseNegative = IId.GetPaddedId(_PropertyConfiguration, id, string.Empty, ".mov", hasIgnoreKeyword: false, hasDateTimeOriginal: false, index: null);
|
||||||
Assert.AreEqual("816184700390", videoFalseFalseNegative);
|
Assert.AreEqual("816184700390", videoFalseFalseNegative);
|
||||||
string videoFalseTrueNegative = IId.GetPaddedId(_PropertyConfiguration, id, ".mov", hasIgnoreKeyword: false, hasDateTimeOriginal: true, index: null);
|
string? videoFalseTrueNegative = IId.GetPaddedId(_PropertyConfiguration, id, string.Empty, ".mov", hasIgnoreKeyword: false, hasDateTimeOriginal: true, index: null);
|
||||||
Assert.AreEqual("816184700394", videoFalseTrueNegative);
|
Assert.AreEqual("816184700394", videoFalseTrueNegative);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
@ -87,26 +87,21 @@ public class UnitTestResize
|
|||||||
string sourceFileName = "105131603001106320328.jpg";
|
string sourceFileName = "105131603001106320328.jpg";
|
||||||
string sourceDirectoryName = "Mike iCloud Have Date Taken 2022 !9";
|
string sourceDirectoryName = "Mike iCloud Have Date Taken 2022 !9";
|
||||||
Item item;
|
Item item;
|
||||||
bool reverse = false;
|
|
||||||
bool isArchive = false;
|
bool isArchive = false;
|
||||||
FileHolder resizedFileHolder;
|
FileHolder resizedFileHolder;
|
||||||
long ticks = DateTime.Now.Ticks;
|
long ticks = DateTime.Now.Ticks;
|
||||||
List<string> parseExceptions = [];
|
List<string> parseExceptions = [];
|
||||||
|
string[] changesFrom = [nameof(A_Metadata)];
|
||||||
const bool isValidImageFormatExtension = true;
|
const bool isValidImageFormatExtension = true;
|
||||||
List<Tuple<string, DateTime>> subFileTuples = [];
|
List<Tuple<string, DateTime>> subFileTuples = [];
|
||||||
int length = _PropertyConfiguration.RootDirectory.Length;
|
int length = _PropertyConfiguration.RootDirectory.Length;
|
||||||
string[] changesFrom = [nameof(A_Property)];
|
|
||||||
string outputResolution = _Configuration.OutputResolutions[0];
|
string outputResolution = _Configuration.OutputResolutions[0];
|
||||||
|
string aResultsFullGroupDirectory = GetResultsFullGroupDirectories();
|
||||||
bool outputResolutionHasNumber = outputResolution.Any(char.IsNumber);
|
bool outputResolutionHasNumber = outputResolution.Any(char.IsNumber);
|
||||||
(string cResultsFullGroupDirectory, _, _) = GetResultsFullGroupDirectories(outputResolution);
|
(string cResultsFullGroupDirectory, _, _) = GetResultsFullGroupDirectories(outputResolution);
|
||||||
(string aResultsFullGroupDirectory, string bResultsFullGroupDirectory) = GetResultsFullGroupDirectories();
|
|
||||||
Shared.Models.Methods.IBlurHasher blurHasher = new BlurHash.Models.C2_BlurHasher(_PropertyConfiguration);
|
Shared.Models.Methods.IBlurHasher blurHasher = new BlurHash.Models.C2_BlurHasher(_PropertyConfiguration);
|
||||||
A_Property propertyLogic = GetPropertyLogic(reverse, aResultsFullGroupDirectory);
|
|
||||||
string aPropertySingletonDirectory = Path.Combine(aResultsFullGroupDirectory, "{}");
|
|
||||||
if (!Directory.Exists(aPropertySingletonDirectory))
|
|
||||||
_ = Directory.CreateDirectory(aPropertySingletonDirectory);
|
|
||||||
(ImageCodecInfo imageCodecInfo, EncoderParameters encoderParameters, string filenameExtension) = C_Resize.GetTuple(_Configuration.OutputExtension, _Configuration.OutputQuality);
|
(ImageCodecInfo imageCodecInfo, EncoderParameters encoderParameters, string filenameExtension) = C_Resize.GetTuple(_Configuration.OutputExtension, _Configuration.OutputQuality);
|
||||||
B_Metadata metadata = new(null, _PropertyConfiguration, _Configuration.ForceMetadataLastWriteTimeToCreationTime, _Configuration.PropertiesChangedForMetadata, ticks, bResultsFullGroupDirectory);
|
A_Metadata metadata = new(null, _PropertyConfiguration, _Configuration.ForceMetadataLastWriteTimeToCreationTime, _Configuration.PropertiesChangedForMetadata, ticks, aResultsFullGroupDirectory);
|
||||||
_ = metadata.ToString();
|
_ = metadata.ToString();
|
||||||
C_Resize resize = new(_PropertyConfiguration, _Configuration.ForceResizeLastWriteTimeToCreationTime, _Configuration.OverrideForResizeImages, _Configuration.PropertiesChangedForResize, _Configuration.ValidResolutions, imageCodecInfo, encoderParameters, filenameExtension);
|
C_Resize resize = new(_PropertyConfiguration, _Configuration.ForceResizeLastWriteTimeToCreationTime, _Configuration.OverrideForResizeImages, _Configuration.PropertiesChangedForResize, _Configuration.ValidResolutions, imageCodecInfo, encoderParameters, filenameExtension);
|
||||||
_ = resize.ToString();
|
_ = resize.ToString();
|
||||||
@ -119,8 +114,6 @@ public class UnitTestResize
|
|||||||
Assert.IsNotNull(filePath.Id);
|
Assert.IsNotNull(filePath.Id);
|
||||||
string relativePath = IPath.GetRelativePath(fileHolder.FullName, length);
|
string relativePath = IPath.GetRelativePath(fileHolder.FullName, length);
|
||||||
ExifDirectory? exifDirectory = Metadata.Models.Stateless.Methods.IMetadata.GetExifDirectory(filePath);
|
ExifDirectory? exifDirectory = Metadata.Models.Stateless.Methods.IMetadata.GetExifDirectory(filePath);
|
||||||
string propertyLogicSourceDirectory = Path.GetFullPath(Path.Combine(aPropertySingletonDirectory, sourceDirectoryName));
|
|
||||||
propertyLogic.SetAngleBracketCollection(aResultsFullGroupDirectory, propertyLogicSourceDirectory);
|
|
||||||
if (outputResolutionHasNumber)
|
if (outputResolutionHasNumber)
|
||||||
resize.SetAngleBracketCollection(cResultsFullGroupDirectory, sourceDirectory);
|
resize.SetAngleBracketCollection(cResultsFullGroupDirectory, sourceDirectory);
|
||||||
resize.Update(cResultsFullGroupDirectory);
|
resize.Update(cResultsFullGroupDirectory);
|
||||||
@ -144,23 +137,16 @@ public class UnitTestResize
|
|||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
private (string, string) GetResultsFullGroupDirectories()
|
private string GetResultsFullGroupDirectories()
|
||||||
{
|
{
|
||||||
string aResultsFullGroupDirectory = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
|
string result = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
|
||||||
_PropertyConfiguration,
|
_Configuration.PropertyConfiguration,
|
||||||
nameof(A_Property),
|
nameof(A_Metadata),
|
||||||
string.Empty,
|
string.Empty,
|
||||||
includeResizeGroup: false,
|
includeResizeGroup: false,
|
||||||
includeModel: false,
|
includeModel: false,
|
||||||
includePredictorModel: false);
|
includePredictorModel: false);
|
||||||
string bResultsFullGroupDirectory = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
|
return new(result);
|
||||||
_PropertyConfiguration,
|
|
||||||
nameof(B_Metadata),
|
|
||||||
string.Empty,
|
|
||||||
includeResizeGroup: false,
|
|
||||||
includeModel: false,
|
|
||||||
includePredictorModel: false);
|
|
||||||
return new(aResultsFullGroupDirectory, bResultsFullGroupDirectory);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private (string, string, string) GetResultsFullGroupDirectories(string outputResolution)
|
private (string, string, string) GetResultsFullGroupDirectories(string outputResolution)
|
||||||
@ -177,13 +163,4 @@ public class UnitTestResize
|
|||||||
return new(cResultsFullGroupDirectory, dResultsFullGroupDirectory, d2ResultsFullGroupDirectory);
|
return new(cResultsFullGroupDirectory, dResultsFullGroupDirectory, d2ResultsFullGroupDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
private A_Property GetPropertyLogic(bool reverse, string aResultsFullGroupDirectory)
|
|
||||||
{
|
|
||||||
A_Property result;
|
|
||||||
if (_Configuration?.PropertyConfiguration is null)
|
|
||||||
throw new NullReferenceException(nameof(_PropertyConfiguration));
|
|
||||||
result = new(_AppSettings.MaxDegreeOfParallelism, _PropertyConfiguration, _Configuration.OutputExtension, reverse, aResultsFullGroupDirectory);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -68,26 +68,21 @@ public class UnitTestFace
|
|||||||
string sourceFileName = "100000507001158650387.jpg";
|
string sourceFileName = "100000507001158650387.jpg";
|
||||||
string sourceDirectoryName = "Facebook/2023.2 Summer Facebook";
|
string sourceDirectoryName = "Facebook/2023.2 Summer Facebook";
|
||||||
Item item;
|
Item item;
|
||||||
bool reverse = false;
|
|
||||||
bool isArchive = false;
|
bool isArchive = false;
|
||||||
FileHolder resizedFileHolder;
|
FileHolder resizedFileHolder;
|
||||||
long ticks = DateTime.Now.Ticks;
|
long ticks = DateTime.Now.Ticks;
|
||||||
List<string> parseExceptions = [];
|
List<string> parseExceptions = [];
|
||||||
|
string[] changesFrom = [nameof(A_Metadata)];
|
||||||
const bool isValidImageFormatExtension = true;
|
const bool isValidImageFormatExtension = true;
|
||||||
List<Tuple<string, DateTime>> subFileTuples = [];
|
List<Tuple<string, DateTime>> subFileTuples = [];
|
||||||
int length = _PropertyConfiguration.RootDirectory.Length;
|
int length = _PropertyConfiguration.RootDirectory.Length;
|
||||||
string[] changesFrom = [nameof(A_Property)];
|
|
||||||
string outputResolution = _Configuration.OutputResolutions[0];
|
string outputResolution = _Configuration.OutputResolutions[0];
|
||||||
|
string aResultsFullGroupDirectory = GetResultsFullGroupDirectories();
|
||||||
bool outputResolutionHasNumber = outputResolution.Any(char.IsNumber);
|
bool outputResolutionHasNumber = outputResolution.Any(char.IsNumber);
|
||||||
(string cResultsFullGroupDirectory, _, _) = GetResultsFullGroupDirectories(outputResolution);
|
(string cResultsFullGroupDirectory, _, _) = GetResultsFullGroupDirectories(outputResolution);
|
||||||
(string aResultsFullGroupDirectory, string bResultsFullGroupDirectory) = GetResultsFullGroupDirectories();
|
|
||||||
Shared.Models.Methods.IBlurHasher blurHasher = new BlurHash.Models.C2_BlurHasher(_PropertyConfiguration);
|
Shared.Models.Methods.IBlurHasher blurHasher = new BlurHash.Models.C2_BlurHasher(_PropertyConfiguration);
|
||||||
A_Property propertyLogic = GetPropertyLogic(reverse, aResultsFullGroupDirectory);
|
|
||||||
string aPropertySingletonDirectory = Path.Combine(aResultsFullGroupDirectory, "{}");
|
|
||||||
if (!Directory.Exists(aPropertySingletonDirectory))
|
|
||||||
_ = Directory.CreateDirectory(aPropertySingletonDirectory);
|
|
||||||
(ImageCodecInfo imageCodecInfo, EncoderParameters encoderParameters, string filenameExtension) = C_Resize.GetTuple(_Configuration.OutputExtension, _Configuration.OutputQuality);
|
(ImageCodecInfo imageCodecInfo, EncoderParameters encoderParameters, string filenameExtension) = C_Resize.GetTuple(_Configuration.OutputExtension, _Configuration.OutputQuality);
|
||||||
B_Metadata metadata = new(null, _PropertyConfiguration, _Configuration.ForceMetadataLastWriteTimeToCreationTime, _Configuration.PropertiesChangedForMetadata, ticks, bResultsFullGroupDirectory);
|
A_Metadata metadata = new(null, _PropertyConfiguration, _Configuration.ForceMetadataLastWriteTimeToCreationTime, _Configuration.PropertiesChangedForMetadata, ticks, aResultsFullGroupDirectory);
|
||||||
_ = metadata.ToString();
|
_ = metadata.ToString();
|
||||||
C_Resize resize = new(_PropertyConfiguration, _Configuration.ForceResizeLastWriteTimeToCreationTime, _Configuration.OverrideForResizeImages, _Configuration.PropertiesChangedForResize, _Configuration.ValidResolutions, imageCodecInfo, encoderParameters, filenameExtension);
|
C_Resize resize = new(_PropertyConfiguration, _Configuration.ForceResizeLastWriteTimeToCreationTime, _Configuration.OverrideForResizeImages, _Configuration.PropertiesChangedForResize, _Configuration.ValidResolutions, imageCodecInfo, encoderParameters, filenameExtension);
|
||||||
_ = resize.ToString();
|
_ = resize.ToString();
|
||||||
@ -100,8 +95,6 @@ public class UnitTestFace
|
|||||||
Assert.IsNotNull(filePath.Id);
|
Assert.IsNotNull(filePath.Id);
|
||||||
string relativePath = IPath.GetRelativePath(fileHolder.FullName, length);
|
string relativePath = IPath.GetRelativePath(fileHolder.FullName, length);
|
||||||
ExifDirectory? exifDirectory = Metadata.Models.Stateless.Methods.IMetadata.GetExifDirectory(filePath);
|
ExifDirectory? exifDirectory = Metadata.Models.Stateless.Methods.IMetadata.GetExifDirectory(filePath);
|
||||||
string propertyLogicSourceDirectory = Path.GetFullPath(Path.Combine(aPropertySingletonDirectory, sourceDirectoryName));
|
|
||||||
propertyLogic.SetAngleBracketCollection(aResultsFullGroupDirectory, propertyLogicSourceDirectory);
|
|
||||||
if (outputResolutionHasNumber)
|
if (outputResolutionHasNumber)
|
||||||
resize.SetAngleBracketCollection(cResultsFullGroupDirectory, sourceDirectory);
|
resize.SetAngleBracketCollection(cResultsFullGroupDirectory, sourceDirectory);
|
||||||
resize.Update(cResultsFullGroupDirectory);
|
resize.Update(cResultsFullGroupDirectory);
|
||||||
@ -134,23 +127,16 @@ public class UnitTestFace
|
|||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
private (string, string) GetResultsFullGroupDirectories()
|
private string GetResultsFullGroupDirectories()
|
||||||
{
|
{
|
||||||
string aResultsFullGroupDirectory = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
|
string result = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
|
||||||
_PropertyConfiguration,
|
_Configuration.PropertyConfiguration,
|
||||||
nameof(A_Property),
|
nameof(A_Metadata),
|
||||||
string.Empty,
|
string.Empty,
|
||||||
includeResizeGroup: false,
|
includeResizeGroup: false,
|
||||||
includeModel: false,
|
includeModel: false,
|
||||||
includePredictorModel: false);
|
includePredictorModel: false);
|
||||||
string bResultsFullGroupDirectory = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
|
return new(result);
|
||||||
_PropertyConfiguration,
|
|
||||||
nameof(B_Metadata),
|
|
||||||
string.Empty,
|
|
||||||
includeResizeGroup: false,
|
|
||||||
includeModel: false,
|
|
||||||
includePredictorModel: false);
|
|
||||||
return new(aResultsFullGroupDirectory, bResultsFullGroupDirectory);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private (string, string, string) GetResultsFullGroupDirectories(string outputResolution)
|
private (string, string, string) GetResultsFullGroupDirectories(string outputResolution)
|
||||||
@ -167,15 +153,6 @@ public class UnitTestFace
|
|||||||
return new(cResultsFullGroupDirectory, dResultsFullGroupDirectory, d2ResultsFullGroupDirectory);
|
return new(cResultsFullGroupDirectory, dResultsFullGroupDirectory, d2ResultsFullGroupDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
private A_Property GetPropertyLogic(bool reverse, string aResultsFullGroupDirectory)
|
|
||||||
{
|
|
||||||
A_Property result;
|
|
||||||
if (_Configuration?.PropertyConfiguration is null)
|
|
||||||
throw new NullReferenceException(nameof(_PropertyConfiguration));
|
|
||||||
result = new(_AppSettings.MaxDegreeOfParallelism, _PropertyConfiguration, _Configuration.OutputExtension, reverse, aResultsFullGroupDirectory);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static (Model model, PredictorModel predictorModel, ModelParameter modelParameter) GetModel(Models.Configuration configuration)
|
private static (Model model, PredictorModel predictorModel, ModelParameter modelParameter) GetModel(Models.Configuration configuration)
|
||||||
{
|
{
|
||||||
(Model, PredictorModel, ModelParameter) result;
|
(Model, PredictorModel, ModelParameter) result;
|
||||||
|
Reference in New Issue
Block a user