LookForAbandoned,
DateTimeOriginalThenMinimumDateTime and IsNotUniqueAndNeedsReview
This commit is contained in:
@ -7,31 +7,31 @@ public record class FaceDistance : Properties.IFaceDistance
|
||||
{
|
||||
|
||||
public int? ConfidencePercent { init; get; }
|
||||
public DateTime DateTimeOriginalThenMinimumDateTime { init; get; }
|
||||
public object? Encoding { init; get; }
|
||||
public int Id { init; get; }
|
||||
public bool? IsWrongYear { init; get; }
|
||||
public double? Length { init; get; }
|
||||
public DateTime? MinimumDateTime { init; get; }
|
||||
public int? NormalizedRectangle { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public FaceDistance(int? confidencePercent, object? encoding, int id, bool? isWrongYear, double? length, DateTime? minimumDateTime, int? normalizedRectangle)
|
||||
public FaceDistance(int? confidencePercent, DateTime dateTimeOriginalThenMinimumDateTime, object? encoding, int id, bool? isWrongYear, double? length, int? normalizedRectangle)
|
||||
{
|
||||
ConfidencePercent = confidencePercent;
|
||||
DateTimeOriginalThenMinimumDateTime = dateTimeOriginalThenMinimumDateTime;
|
||||
Encoding = encoding;
|
||||
Id = id;
|
||||
IsWrongYear = isWrongYear;
|
||||
Length = length;
|
||||
MinimumDateTime = minimumDateTime;
|
||||
NormalizedRectangle = normalizedRectangle;
|
||||
}
|
||||
|
||||
public FaceDistance(int? confidencePercent, object? encoding, int id, bool? isWrongYear, DateTime? minimumDateTime, int? normalizedRectangle) :
|
||||
this(confidencePercent, encoding, id, isWrongYear, null, minimumDateTime, normalizedRectangle)
|
||||
public FaceDistance(int? confidencePercent, DateTime dateTimeOriginalThenMinimumDateTime, object? encoding, int id, bool? isWrongYear, int? normalizedRectangle) :
|
||||
this(confidencePercent, dateTimeOriginalThenMinimumDateTime, encoding, id, isWrongYear, null, normalizedRectangle)
|
||||
{ }
|
||||
|
||||
public FaceDistance(FaceDistance faceDistance, double length) :
|
||||
this(faceDistance.ConfidencePercent, null, faceDistance.Id, faceDistance.IsWrongYear, length, faceDistance.MinimumDateTime, faceDistance.NormalizedRectangle)
|
||||
this(faceDistance.ConfidencePercent, faceDistance.DateTimeOriginalThenMinimumDateTime, null, faceDistance.Id, faceDistance.IsWrongYear, length, faceDistance.NormalizedRectangle)
|
||||
{ }
|
||||
|
||||
public FaceDistance(object encoding) => Encoding = encoding;
|
||||
|
@ -1,3 +1,3 @@
|
||||
namespace View_by_Distance.Shared.Models;
|
||||
|
||||
public record FilePair(string Path, bool IsUnique, List<string> Collection, string? Match) { }
|
||||
public record FilePair(string Path, bool IsUnique, bool? IsNotUniqueAndNeedsReview, List<string> Collection, string? Match) { }
|
@ -9,7 +9,8 @@ public class Item : Properties.IItem
|
||||
protected List<Face> _Faces;
|
||||
protected readonly bool? _FileSizeChanged;
|
||||
protected readonly FileHolder _ImageFileHolder;
|
||||
protected bool? _IsUniqueFileName;
|
||||
protected bool? _IsNotUniqueAndNeedsReview;
|
||||
protected bool _IsUniqueFileName;
|
||||
protected bool _IsValidImageFormatExtension;
|
||||
protected bool? _LastWriteTimeChanged;
|
||||
protected bool? _Moved;
|
||||
@ -20,7 +21,8 @@ public class Item : Properties.IItem
|
||||
public List<Face> Faces => _Faces;
|
||||
public bool? FileSizeChanged => _FileSizeChanged;
|
||||
public FileHolder ImageFileHolder => _ImageFileHolder;
|
||||
public bool? IsUniqueFileName => _IsUniqueFileName;
|
||||
public bool? IsNotUniqueAndNeedsReview => _IsNotUniqueAndNeedsReview;
|
||||
public bool IsUniqueFileName => _IsUniqueFileName;
|
||||
public bool IsValidImageFormatExtension => _IsValidImageFormatExtension;
|
||||
public bool? LastWriteTimeChanged => _LastWriteTimeChanged;
|
||||
public bool? Moved => _Moved;
|
||||
@ -30,11 +32,12 @@ public class Item : Properties.IItem
|
||||
public FileHolder SourceDirectoryFileHolder => _SourceDirectoryFileHolder;
|
||||
|
||||
[JsonConstructor]
|
||||
public Item(List<Face> faces, bool? fileSizeChanged, FileHolder imageFileHolder, bool? isUniqueFileName, bool isValidImageFormatExtension, bool? lastWriteTimeChanged, bool? moved, Property? property, string relativePath, FileHolder? resizedFileHolder, FileHolder sourceDirectoryFileHolder)
|
||||
public Item(List<Face> faces, bool? fileSizeChanged, FileHolder imageFileHolder, bool? isNotUniqueAndNeedsReview, bool isUniqueFileName, bool isValidImageFormatExtension, bool? lastWriteTimeChanged, bool? moved, Property? property, string relativePath, FileHolder? resizedFileHolder, FileHolder sourceDirectoryFileHolder)
|
||||
{
|
||||
_Faces = faces;
|
||||
_FileSizeChanged = fileSizeChanged;
|
||||
_ImageFileHolder = imageFileHolder;
|
||||
_IsNotUniqueAndNeedsReview = isNotUniqueAndNeedsReview;
|
||||
_IsUniqueFileName = isUniqueFileName;
|
||||
_IsValidImageFormatExtension = isValidImageFormatExtension;
|
||||
_LastWriteTimeChanged = lastWriteTimeChanged;
|
||||
@ -45,8 +48,8 @@ public class Item : Properties.IItem
|
||||
_SourceDirectoryFileHolder = sourceDirectoryFileHolder;
|
||||
}
|
||||
|
||||
public Item(FileHolder sourceDirectoryFileHolder, string relativePath, FileHolder imageFileInfo, bool? isUniqueFileName, bool isValidImageFormatExtension, Property? property, bool? abandoned, bool? fileSizeChanged, bool? lastWriteTimeChanged) :
|
||||
this(new(), fileSizeChanged, imageFileInfo, isUniqueFileName, isValidImageFormatExtension, lastWriteTimeChanged, null, property, relativePath, null, sourceDirectoryFileHolder)
|
||||
public Item(FileHolder sourceDirectoryFileHolder, string relativePath, FileHolder imageFileInfo, bool? isNotUniqueAndNeedsReview, bool isUniqueFileName, bool isValidImageFormatExtension, Property? property, bool? abandoned, bool? fileSizeChanged, bool? lastWriteTimeChanged) :
|
||||
this(new(), fileSizeChanged, imageFileInfo, isNotUniqueAndNeedsReview, isUniqueFileName, isValidImageFormatExtension, lastWriteTimeChanged, null, property, relativePath, null, sourceDirectoryFileHolder)
|
||||
{
|
||||
if (relativePath.EndsWith(".json"))
|
||||
throw new ArgumentException("Can not be a *.json file!");
|
||||
@ -55,7 +58,7 @@ public class Item : Properties.IItem
|
||||
}
|
||||
|
||||
public Item(FileHolder sourceDirectoryFileHolder, string relativePath, bool isValidImageFormatExtension) :
|
||||
this(sourceDirectoryFileHolder, relativePath, sourceDirectoryFileHolder, null, isValidImageFormatExtension, null, null, null, null)
|
||||
this(sourceDirectoryFileHolder, relativePath, sourceDirectoryFileHolder, null, false, isValidImageFormatExtension, null, null, null, null)
|
||||
{ }
|
||||
|
||||
public override string ToString()
|
||||
|
@ -3,142 +3,6 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace View_by_Distance.Shared.Models;
|
||||
|
||||
public class MappingFromItem : Properties.IMappingFromItem
|
||||
{
|
||||
|
||||
public DateTime[] ContainerDateTimes { init; get; }
|
||||
public int Id { init; get; }
|
||||
public FileHolder ImageFileHolder { init; get; }
|
||||
public bool? IsWrongYear { init; get; }
|
||||
public DateTime MinimumDateTime { init; get; }
|
||||
public string RelativePath { init; get; }
|
||||
public FileHolder ResizedFileHolder { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public MappingFromItem(DateTime[] containerDateTimes, int id, FileHolder imageFileHolder, bool? isWrongYear, DateTime minimumDateTime, string relativePath, FileHolder resizedFileHolder)
|
||||
{
|
||||
ContainerDateTimes = containerDateTimes;
|
||||
Id = id;
|
||||
ImageFileHolder = imageFileHolder;
|
||||
IsWrongYear = isWrongYear;
|
||||
MinimumDateTime = minimumDateTime;
|
||||
RelativePath = relativePath;
|
||||
ResizedFileHolder = resizedFileHolder;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static MappingFromItem GetMappingFromItem(DateTime[] containerDateTimes, Item item, FileHolder? resizedFileHolder)
|
||||
{
|
||||
MappingFromItem result;
|
||||
bool? isWrongYear;
|
||||
DateTime minimumDateTime;
|
||||
if (item.Property?.Id is null)
|
||||
throw new NotSupportedException();
|
||||
if (resizedFileHolder is null)
|
||||
throw new NotSupportedException();
|
||||
minimumDateTime = Stateless.Methods.IProperty.GetMinimumDateTime(item.Property);
|
||||
(isWrongYear, _) = item.Property.IsWrongYear(item.ImageFileHolder, minimumDateTime);
|
||||
result = new(containerDateTimes, item.Property.Id.Value, item.ImageFileHolder, isWrongYear, minimumDateTime, item.RelativePath, resizedFileHolder);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class MappingFromLocation : Properties.IMappingFromLocation
|
||||
{
|
||||
|
||||
public int AreaPermyriad { init; get; }
|
||||
public int ConfidencePercent { init; get; }
|
||||
public string DeterministicHashCodeKey { init; get; }
|
||||
public int NormalizedRectangle { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public MappingFromLocation(int areaPermyriad, int confidencePercent, string deterministicHashCodeKey, int normalizedRectangle)
|
||||
{
|
||||
AreaPermyriad = areaPermyriad;
|
||||
ConfidencePercent = confidencePercent;
|
||||
DeterministicHashCodeKey = deterministicHashCodeKey;
|
||||
NormalizedRectangle = normalizedRectangle;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class MappingFromFilter : Properties.IMappingFromFilter
|
||||
{
|
||||
|
||||
public bool? IsFocusModel { init; get; }
|
||||
public bool? IsFocusRelativePath { init; get; }
|
||||
public bool? IsIgnoreRelativePath { init; get; }
|
||||
public bool? InSkipCollection { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public MappingFromFilter(bool? isFocusModel, bool? isFocusRelativePath, bool? isIgnoreRelativePath, bool? inSkipCollection)
|
||||
{
|
||||
IsFocusModel = isFocusModel;
|
||||
IsFocusRelativePath = isFocusRelativePath;
|
||||
IsIgnoreRelativePath = isIgnoreRelativePath;
|
||||
InSkipCollection = inSkipCollection;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class MappingFromPhotoPrism : Properties.IMappingFromPhotoPrism
|
||||
{
|
||||
|
||||
public DatabaseFile DatabaseFile { init; get; }
|
||||
public List<Marker> Markers { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public MappingFromPhotoPrism(DatabaseFile databaseFile, List<Marker> markers)
|
||||
{
|
||||
DatabaseFile = databaseFile;
|
||||
Markers = markers;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class MappingFromPerson : Properties.IMappingFromPerson
|
||||
{
|
||||
|
||||
public int? ApproximateYears { init; get; }
|
||||
public string DisplayDirectoryName { init; get; }
|
||||
public PersonBirthday PersonBirthday { init; get; }
|
||||
public string SegmentB { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public MappingFromPerson(int? approximateYears, string displayDirectoryName, PersonBirthday personBirthday, string segmentB)
|
||||
{
|
||||
ApproximateYears = approximateYears;
|
||||
DisplayDirectoryName = displayDirectoryName;
|
||||
PersonBirthday = personBirthday;
|
||||
SegmentB = segmentB;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class Mapping : Properties.IMapping
|
||||
{
|
||||
|
||||
|
29
Shared/Models/MappingFromFilter.cs
Normal file
29
Shared/Models/MappingFromFilter.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace View_by_Distance.Shared.Models;
|
||||
|
||||
public class MappingFromFilter : Properties.IMappingFromFilter
|
||||
{
|
||||
|
||||
public bool? IsFocusModel { init; get; }
|
||||
public bool? IsFocusRelativePath { init; get; }
|
||||
public bool? IsIgnoreRelativePath { init; get; }
|
||||
public bool? InSkipCollection { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public MappingFromFilter(bool? isFocusModel, bool? isFocusRelativePath, bool? isIgnoreRelativePath, bool? inSkipCollection)
|
||||
{
|
||||
IsFocusModel = isFocusModel;
|
||||
IsFocusRelativePath = isFocusRelativePath;
|
||||
IsIgnoreRelativePath = isIgnoreRelativePath;
|
||||
InSkipCollection = inSkipCollection;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
58
Shared/Models/MappingFromItem.cs
Normal file
58
Shared/Models/MappingFromItem.cs
Normal file
@ -0,0 +1,58 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace View_by_Distance.Shared.Models;
|
||||
|
||||
public class MappingFromItem : Properties.IMappingFromItem
|
||||
{
|
||||
|
||||
public DateTime[] ContainerDateTimes { init; get; }
|
||||
public DateTime? DateTimeDigitized { init; get; }
|
||||
public DateTime? DateTimeOriginal { init; get; }
|
||||
public int Id { init; get; }
|
||||
public FileHolder ImageFileHolder { init; get; }
|
||||
public bool? IsWrongYear { init; get; }
|
||||
public DateTime MinimumDateTime { init; get; }
|
||||
public string? Model { init; get; }
|
||||
public string RelativePath { init; get; }
|
||||
public FileHolder ResizedFileHolder { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public MappingFromItem(DateTime[] containerDateTimes, DateTime? dateTimeDigitized, DateTime? dateTimeOriginal, int id, FileHolder imageFileHolder, bool? isWrongYear, DateTime minimumDateTime, string? model, string relativePath, FileHolder resizedFileHolder)
|
||||
{
|
||||
ContainerDateTimes = containerDateTimes;
|
||||
DateTimeDigitized = dateTimeDigitized;
|
||||
DateTimeOriginal = dateTimeOriginal;
|
||||
Id = id;
|
||||
ImageFileHolder = imageFileHolder;
|
||||
IsWrongYear = isWrongYear;
|
||||
MinimumDateTime = minimumDateTime;
|
||||
Model = model;
|
||||
RelativePath = relativePath;
|
||||
ResizedFileHolder = resizedFileHolder;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
public DateTime GetDateTimeOriginalThenMinimumDateTime() =>
|
||||
DateTimeOriginal is not null ? DateTimeOriginal.Value : MinimumDateTime;
|
||||
|
||||
internal static MappingFromItem GetMappingFromItem(DateTime[] containerDateTimes, Item item, FileHolder? resizedFileHolder)
|
||||
{
|
||||
MappingFromItem result;
|
||||
if (item.Property?.Id is null)
|
||||
throw new NotSupportedException();
|
||||
if (resizedFileHolder is null)
|
||||
throw new NotSupportedException();
|
||||
List<DateTime> dateTimes = item.Property.GetDateTimes();
|
||||
DateTime minimumDateTime = Stateless.Methods.IProperty.GetMinimumDateTime(item.Property);
|
||||
(bool? isWrongYear, _) = Stateless.Methods.IProperty.IsWrongYear(item.ImageFileHolder, item.Property.DateTimeOriginal, dateTimes);
|
||||
result = new(containerDateTimes, item.Property.DateTimeDigitized, item.Property.DateTimeOriginal, item.Property.Id.Value, item.ImageFileHolder, isWrongYear, minimumDateTime, item.Property.Model, item.RelativePath, resizedFileHolder);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
29
Shared/Models/MappingFromLocation.cs
Normal file
29
Shared/Models/MappingFromLocation.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace View_by_Distance.Shared.Models;
|
||||
|
||||
public class MappingFromLocation : Properties.IMappingFromLocation
|
||||
{
|
||||
|
||||
public int AreaPermyriad { init; get; }
|
||||
public int ConfidencePercent { init; get; }
|
||||
public string DeterministicHashCodeKey { init; get; }
|
||||
public int NormalizedRectangle { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public MappingFromLocation(int areaPermyriad, int confidencePercent, string deterministicHashCodeKey, int normalizedRectangle)
|
||||
{
|
||||
AreaPermyriad = areaPermyriad;
|
||||
ConfidencePercent = confidencePercent;
|
||||
DeterministicHashCodeKey = deterministicHashCodeKey;
|
||||
NormalizedRectangle = normalizedRectangle;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
29
Shared/Models/MappingFromPerson.cs
Normal file
29
Shared/Models/MappingFromPerson.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace View_by_Distance.Shared.Models;
|
||||
|
||||
public class MappingFromPerson : Properties.IMappingFromPerson
|
||||
{
|
||||
|
||||
public int? ApproximateYears { init; get; }
|
||||
public string DisplayDirectoryName { init; get; }
|
||||
public PersonBirthday PersonBirthday { init; get; }
|
||||
public string SegmentB { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public MappingFromPerson(int? approximateYears, string displayDirectoryName, PersonBirthday personBirthday, string segmentB)
|
||||
{
|
||||
ApproximateYears = approximateYears;
|
||||
DisplayDirectoryName = displayDirectoryName;
|
||||
PersonBirthday = personBirthday;
|
||||
SegmentB = segmentB;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
18
Shared/Models/MappingFromPhotoPrism.cs
Normal file
18
Shared/Models/MappingFromPhotoPrism.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace View_by_Distance.Shared.Models;
|
||||
|
||||
public class MappingFromPhotoPrism : Properties.IMappingFromPhotoPrism
|
||||
{
|
||||
|
||||
public DatabaseFile DatabaseFile { init; get; }
|
||||
public List<Marker> Markers { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public MappingFromPhotoPrism(DatabaseFile databaseFile, List<Marker> markers)
|
||||
{
|
||||
DatabaseFile = databaseFile;
|
||||
Markers = markers;
|
||||
}
|
||||
|
||||
}
|
@ -4,11 +4,11 @@ public interface IFaceDistance
|
||||
{
|
||||
|
||||
public int? ConfidencePercent { init; get; }
|
||||
public DateTime DateTimeOriginalThenMinimumDateTime { init; get; }
|
||||
public object? Encoding { init; get; }
|
||||
public int Id { init; get; }
|
||||
public bool? IsWrongYear { init; get; }
|
||||
public double? Length { init; get; }
|
||||
public DateTime? MinimumDateTime { init; get; }
|
||||
public int? NormalizedRectangle { init; get; }
|
||||
|
||||
}
|
@ -6,7 +6,8 @@ public interface IItem
|
||||
public bool? FileSizeChanged { get; }
|
||||
public List<Face> Faces { get; }
|
||||
public FileHolder ImageFileHolder { get; }
|
||||
public bool? IsUniqueFileName { get; }
|
||||
public bool? IsNotUniqueAndNeedsReview { get; }
|
||||
public bool IsUniqueFileName { get; }
|
||||
public bool IsValidImageFormatExtension { get; }
|
||||
public bool? Moved { get; }
|
||||
public Property? Property { get; }
|
||||
|
@ -1,56 +1,5 @@
|
||||
namespace View_by_Distance.Shared.Models.Properties;
|
||||
|
||||
public interface IMappingFromItem
|
||||
{
|
||||
|
||||
public DateTime[] ContainerDateTimes { init; get; }
|
||||
public int Id { init; get; }
|
||||
public FileHolder ImageFileHolder { init; get; }
|
||||
public bool? IsWrongYear { init; get; }
|
||||
public DateTime MinimumDateTime { init; get; }
|
||||
public string RelativePath { init; get; }
|
||||
public FileHolder ResizedFileHolder { init; get; }
|
||||
|
||||
}
|
||||
|
||||
public interface IMappingFromFilter
|
||||
{
|
||||
|
||||
public bool? IsFocusModel { init; get; }
|
||||
public bool? IsFocusRelativePath { init; get; }
|
||||
public bool? IsIgnoreRelativePath { init; get; }
|
||||
public bool? InSkipCollection { init; get; }
|
||||
|
||||
}
|
||||
|
||||
public interface IMappingFromLocation
|
||||
{
|
||||
|
||||
public int AreaPermyriad { init; get; }
|
||||
public int ConfidencePercent { init; get; }
|
||||
public string DeterministicHashCodeKey { init; get; }
|
||||
public int NormalizedRectangle { init; get; }
|
||||
|
||||
}
|
||||
|
||||
public interface IMappingFromPhotoPrism
|
||||
{
|
||||
|
||||
public DatabaseFile DatabaseFile { init; get; }
|
||||
public List<Marker> Markers { init; get; }
|
||||
|
||||
}
|
||||
|
||||
public interface IMappingFromPerson
|
||||
{
|
||||
|
||||
public int? ApproximateYears { init; get; }
|
||||
public string DisplayDirectoryName { init; get; }
|
||||
public PersonBirthday PersonBirthday { init; get; }
|
||||
public string SegmentB { init; get; }
|
||||
|
||||
}
|
||||
|
||||
public interface IMapping
|
||||
{
|
||||
|
||||
|
11
Shared/Models/Properties/IMappingFromFilter.cs
Normal file
11
Shared/Models/Properties/IMappingFromFilter.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace View_by_Distance.Shared.Models.Properties;
|
||||
|
||||
public interface IMappingFromFilter
|
||||
{
|
||||
|
||||
public bool? IsFocusModel { init; get; }
|
||||
public bool? IsFocusRelativePath { init; get; }
|
||||
public bool? IsIgnoreRelativePath { init; get; }
|
||||
public bool? InSkipCollection { init; get; }
|
||||
|
||||
}
|
17
Shared/Models/Properties/IMappingFromItem.cs
Normal file
17
Shared/Models/Properties/IMappingFromItem.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace View_by_Distance.Shared.Models.Properties;
|
||||
|
||||
public interface IMappingFromItem
|
||||
{
|
||||
|
||||
public DateTime[] ContainerDateTimes { init; get; }
|
||||
public DateTime? DateTimeDigitized { init; get; }
|
||||
public DateTime? DateTimeOriginal { init; get; }
|
||||
public int Id { init; get; }
|
||||
public FileHolder ImageFileHolder { init; get; }
|
||||
public bool? IsWrongYear { init; get; }
|
||||
public DateTime MinimumDateTime { init; get; }
|
||||
public string? Model { init; get; }
|
||||
public string RelativePath { init; get; }
|
||||
public FileHolder ResizedFileHolder { init; get; }
|
||||
|
||||
}
|
11
Shared/Models/Properties/IMappingFromLocation.cs
Normal file
11
Shared/Models/Properties/IMappingFromLocation.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace View_by_Distance.Shared.Models.Properties;
|
||||
|
||||
public interface IMappingFromLocation
|
||||
{
|
||||
|
||||
public int AreaPermyriad { init; get; }
|
||||
public int ConfidencePercent { init; get; }
|
||||
public string DeterministicHashCodeKey { init; get; }
|
||||
public int NormalizedRectangle { init; get; }
|
||||
|
||||
}
|
11
Shared/Models/Properties/IMappingFromPerson.cs
Normal file
11
Shared/Models/Properties/IMappingFromPerson.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace View_by_Distance.Shared.Models.Properties;
|
||||
|
||||
public interface IMappingFromPerson
|
||||
{
|
||||
|
||||
public int? ApproximateYears { init; get; }
|
||||
public string DisplayDirectoryName { init; get; }
|
||||
public PersonBirthday PersonBirthday { init; get; }
|
||||
public string SegmentB { init; get; }
|
||||
|
||||
}
|
9
Shared/Models/Properties/IMappingFromPhotoPrism.cs
Normal file
9
Shared/Models/Properties/IMappingFromPhotoPrism.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace View_by_Distance.Shared.Models.Properties;
|
||||
|
||||
public interface IMappingFromPhotoPrism
|
||||
{
|
||||
|
||||
public DatabaseFile DatabaseFile { init; get; }
|
||||
public List<Marker> Markers { init; get; }
|
||||
|
||||
}
|
@ -3,19 +3,19 @@ namespace View_by_Distance.Shared.Models.Properties;
|
||||
public interface IProperty
|
||||
{
|
||||
|
||||
public DateTime CreationTime { get; }
|
||||
public DateTime? DateTime { get; }
|
||||
public DateTime? DateTimeDigitized { get; }
|
||||
public DateTime? DateTimeFromName { get; }
|
||||
public DateTime? DateTimeOriginal { get; }
|
||||
public long FileSize { get; }
|
||||
public DateTime? GPSDateStamp { get; }
|
||||
public int? Height { get; }
|
||||
public int? Id { get; }
|
||||
public DateTime LastWriteTime { get; }
|
||||
public string Make { get; }
|
||||
public string Model { get; }
|
||||
public string Orientation { get; }
|
||||
public int? Width { get; }
|
||||
public DateTime CreationTime { init; get; }
|
||||
public DateTime? DateTime { init; get; }
|
||||
public DateTime? DateTimeDigitized { init; get; }
|
||||
public DateTime? DateTimeFromName { init; get; }
|
||||
public DateTime? DateTimeOriginal { init; get; }
|
||||
public long FileSize { init; get; }
|
||||
public DateTime? GPSDateStamp { init; get; }
|
||||
public int? Height { init; get; }
|
||||
public int? Id { init; get; }
|
||||
public DateTime LastWriteTime { init; get; }
|
||||
public string? Make { init; get; }
|
||||
public string? Model { init; get; }
|
||||
public string? Orientation { init; get; }
|
||||
public int? Width { init; get; }
|
||||
|
||||
}
|
@ -13,7 +13,6 @@ public interface IPropertyConfiguration
|
||||
public string ResultContent { init; get; }
|
||||
public string ResultSingleton { init; get; }
|
||||
public string[] ValidImageFormatExtensions { init; get; }
|
||||
public string[] VerifyToSeason { init; get; }
|
||||
public string? ModelName { get; }
|
||||
public int? NumberOfJitters { get; }
|
||||
public int? NumberOfTimesToUpsample { get; }
|
||||
|
@ -6,52 +6,38 @@ namespace View_by_Distance.Shared.Models;
|
||||
public class Property : Properties.IProperty
|
||||
{
|
||||
|
||||
protected DateTime _CreationTime;
|
||||
protected DateTime? _DateTime;
|
||||
protected DateTime? _DateTimeDigitized;
|
||||
protected DateTime? _DateTimeFromName;
|
||||
protected DateTime? _DateTimeOriginal;
|
||||
protected long _FileSize;
|
||||
protected DateTime? _GPSDateStamp;
|
||||
protected int? _Height;
|
||||
protected int? _Id;
|
||||
protected DateTime _LastWriteTime;
|
||||
protected string _Make;
|
||||
protected string _Model;
|
||||
protected string _Orientation;
|
||||
protected int? _Width;
|
||||
public DateTime CreationTime => _CreationTime;
|
||||
public DateTime? DateTime => _DateTime;
|
||||
public DateTime? DateTimeDigitized => _DateTimeDigitized;
|
||||
public DateTime? DateTimeFromName => _DateTimeFromName;
|
||||
public DateTime? DateTimeOriginal => _DateTimeOriginal;
|
||||
public long FileSize => _FileSize;
|
||||
public DateTime? GPSDateStamp => _GPSDateStamp;
|
||||
public int? Height => _Height;
|
||||
public int? Id => _Id;
|
||||
public DateTime LastWriteTime => _LastWriteTime;
|
||||
public string Make => _Make;
|
||||
public string Model => _Model;
|
||||
public string Orientation => _Orientation;
|
||||
public int? Width => _Width;
|
||||
public DateTime CreationTime { init; get; }
|
||||
public DateTime? DateTime { init; get; }
|
||||
public DateTime? DateTimeDigitized { init; get; }
|
||||
public DateTime? DateTimeFromName { init; get; }
|
||||
public DateTime? DateTimeOriginal { init; get; }
|
||||
public long FileSize { init; get; }
|
||||
public DateTime? GPSDateStamp { init; get; }
|
||||
public int? Height { init; get; }
|
||||
public int? Id { init; get; }
|
||||
public DateTime LastWriteTime { init; get; }
|
||||
public string? Make { init; get; }
|
||||
public string? Model { init; get; }
|
||||
public string? Orientation { init; get; }
|
||||
public int? Width { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public Property(DateTime creationTime, DateTime? dateTime, DateTime? dateTimeDigitized, DateTime? dateTimeFromName, DateTime? dateTimeOriginal, long fileSize, DateTime? gpsDateStamp, int? height, int? id, DateTime lastWriteTime, string make, string model, string orientation, int? width)
|
||||
public Property(DateTime creationTime, DateTime? dateTime, DateTime? dateTimeDigitized, DateTime? dateTimeFromName, DateTime? dateTimeOriginal, long fileSize, DateTime? gpsDateStamp, int? height, int? id, DateTime lastWriteTime, string? make, string? model, string? orientation, int? width)
|
||||
{
|
||||
_DateTimeFromName = dateTimeFromName;
|
||||
_CreationTime = creationTime;
|
||||
_DateTime = dateTime;
|
||||
_DateTimeDigitized = dateTimeDigitized;
|
||||
_DateTimeOriginal = dateTimeOriginal;
|
||||
_FileSize = fileSize;
|
||||
_GPSDateStamp = gpsDateStamp;
|
||||
_Height = height;
|
||||
_Id = id;
|
||||
_LastWriteTime = lastWriteTime;
|
||||
_Make = make;
|
||||
_Model = model;
|
||||
_Orientation = orientation;
|
||||
_Width = width;
|
||||
DateTimeFromName = dateTimeFromName;
|
||||
CreationTime = creationTime;
|
||||
DateTime = dateTime;
|
||||
DateTimeDigitized = dateTimeDigitized;
|
||||
DateTimeOriginal = dateTimeOriginal;
|
||||
FileSize = fileSize;
|
||||
GPSDateStamp = gpsDateStamp;
|
||||
Height = height;
|
||||
Id = id;
|
||||
LastWriteTime = lastWriteTime;
|
||||
Make = make;
|
||||
Model = model;
|
||||
Orientation = orientation;
|
||||
Width = width;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@ -60,38 +46,6 @@ public class Property : Properties.IProperty
|
||||
return result;
|
||||
} // ...
|
||||
|
||||
public List<DateTime> GetDateTimes() => Stateless.Methods.Property.GetDateTimes(_CreationTime, _LastWriteTime, _DateTime, _DateTimeDigitized, _DateTimeFromName, _DateTimeOriginal, _GPSDateStamp);
|
||||
|
||||
public (bool?, string[]) IsWrongYear(FileHolder fileHolder, DateTime? minimumDateTime)
|
||||
{
|
||||
string[] results = Array.Empty<string>();
|
||||
bool? result = null;
|
||||
string year;
|
||||
string directoryName;
|
||||
string[] directorySegments;
|
||||
string? check = Path.GetFullPath(fileHolder.FullName);
|
||||
string? pathRoot = Path.GetPathRoot(fileHolder.FullName);
|
||||
if (string.IsNullOrEmpty(pathRoot))
|
||||
throw new Exception();
|
||||
if (minimumDateTime.HasValue)
|
||||
year = minimumDateTime.Value.ToString("yyyy");
|
||||
else
|
||||
{
|
||||
List<DateTime> dateTimes = GetDateTimes();
|
||||
year = dateTimes.Min().ToString("yyyy");
|
||||
}
|
||||
for (int i = 0; i < int.MaxValue; i++)
|
||||
{
|
||||
check = Path.GetDirectoryName(check);
|
||||
if (string.IsNullOrEmpty(check) || check == pathRoot)
|
||||
break;
|
||||
directoryName = Path.GetFileName(check);
|
||||
directorySegments = directoryName.Split(' ');
|
||||
(result, results) = Stateless.Methods.Property.IsWrongYear(directorySegments, year);
|
||||
if (result.HasValue)
|
||||
break;
|
||||
}
|
||||
return new(result, results);
|
||||
}
|
||||
public List<DateTime> GetDateTimes() => Stateless.Methods.Property.GetDateTimes(CreationTime, LastWriteTime, DateTime, DateTimeDigitized, DateTimeFromName, DateTimeOriginal, GPSDateStamp);
|
||||
|
||||
}
|
@ -144,7 +144,7 @@ internal abstract class Container
|
||||
File.SetCreationTime(sourceDirectoryFileHolder.FullName, imageFileInfo.LastWriteTime.Value);
|
||||
File.SetLastWriteTime(sourceDirectoryFileHolder.FullName, sourceDirectoryFileHolder.LastWriteTime.Value);
|
||||
}
|
||||
Models.Item item = new(sourceDirectoryFileHolder, relativePath, imageFileInfo, filePair.IsUnique, isValidImageFormatExtension, property, abandoned, fileSizeChanged, lastWriteTimeChanged);
|
||||
Models.Item item = new(sourceDirectoryFileHolder, relativePath, imageFileInfo, filePair.IsNotUniqueAndNeedsReview, filePair.IsUnique, isValidImageFormatExtension, property, abandoned, fileSizeChanged, lastWriteTimeChanged);
|
||||
lock (results)
|
||||
results.Add(new(filePair.Path, imageFileInfo.DirectoryName, filePair.IsUnique, filePair.Collection, item));
|
||||
}
|
||||
|
@ -11,11 +11,6 @@ public interface IProperty
|
||||
static int GetDeterministicHashCode(byte[] value) =>
|
||||
Property.GetDeterministicHashCode(value);
|
||||
|
||||
int TestStatic_GetDeterministicHashCode(string value) =>
|
||||
GetDeterministicHashCode(value);
|
||||
static int GetDeterministicHashCode(string value) =>
|
||||
Property.GetDeterministicHashCode(value);
|
||||
|
||||
DateTime TestStatic_GetDateTime(Models.Property? property) =>
|
||||
GetDateTime(property);
|
||||
static DateTime GetDateTime(Models.Property? property) =>
|
||||
@ -46,6 +41,11 @@ public interface IProperty
|
||||
static (bool?, string[]) IsWrongYear(string[] segments, string year) =>
|
||||
Property.IsWrongYear(segments, year);
|
||||
|
||||
(bool?, string[]) TestStatic_IsWrongYear(Models.FileHolder fileHolder, DateTime? dateTimeOriginal, List<DateTime> dateTimes) =>
|
||||
IsWrongYear(fileHolder, dateTimeOriginal, dateTimes);
|
||||
static (bool?, string[]) IsWrongYear(Models.FileHolder fileHolder, DateTime? dateTimeOriginal, List<DateTime> dateTimes) =>
|
||||
Property.IsWrongYear(fileHolder, dateTimeOriginal, dateTimes);
|
||||
|
||||
(DateTime?[], int?, string?) TestStatic_Get(Models.FileHolder fileHolder, bool isIgnoreExtension, bool isValidImageFormatExtension) =>
|
||||
Get(fileHolder, isIgnoreExtension, isValidImageFormatExtension);
|
||||
static (DateTime?[], int?, string?) Get(Models.FileHolder fileHolder, bool isIgnoreExtension, bool isValidImageFormatExtension) =>
|
||||
|
@ -42,25 +42,6 @@ internal abstract class Property
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static int GetDeterministicHashCode(string value)
|
||||
{
|
||||
int result;
|
||||
unchecked
|
||||
{
|
||||
int hash1 = (5381 << 16) + 5381;
|
||||
int hash2 = hash1;
|
||||
for (int i = 0; i < value.Length; i += 2)
|
||||
{
|
||||
hash1 = ((hash1 << 5) + hash1) ^ value[i];
|
||||
if (i == value.Length - 1)
|
||||
break;
|
||||
hash2 = ((hash2 << 5) + hash2) ^ value[i + 1];
|
||||
}
|
||||
result = hash1 + (hash2 * 1566083941);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static (bool?, string[]) IsWrongYear(string[] segments, string year)
|
||||
{
|
||||
bool? result;
|
||||
@ -92,6 +73,45 @@ internal abstract class Property
|
||||
return new(result, results);
|
||||
}
|
||||
|
||||
internal static (bool?, string[]) IsWrongYear(Models.FileHolder fileHolder, DateTime? dateTimeOriginal, List<DateTime> dateTimes)
|
||||
{
|
||||
string[] results = Array.Empty<string>();
|
||||
bool? result = null;
|
||||
string year;
|
||||
string directoryName;
|
||||
string[] directorySegments;
|
||||
List<DateTime> collection = new();
|
||||
string? check = Path.GetFullPath(fileHolder.FullName);
|
||||
string? pathRoot = Path.GetPathRoot(fileHolder.FullName);
|
||||
if (string.IsNullOrEmpty(pathRoot))
|
||||
throw new Exception();
|
||||
if (dateTimeOriginal is not null)
|
||||
collection.Add(dateTimeOriginal.Value);
|
||||
else
|
||||
{
|
||||
foreach (DateTime dateTime in dateTimes)
|
||||
collection.Add(dateTime);
|
||||
}
|
||||
foreach (DateTime dateTime in collection)
|
||||
{
|
||||
year = dateTime.ToString("yyyy");
|
||||
for (int i = 0; i < int.MaxValue; i++)
|
||||
{
|
||||
check = Path.GetDirectoryName(check);
|
||||
if (string.IsNullOrEmpty(check) || check == pathRoot)
|
||||
break;
|
||||
directoryName = Path.GetFileName(check);
|
||||
directorySegments = directoryName.Split(' ');
|
||||
(result, results) = IsWrongYear(directorySegments, year);
|
||||
if (result is not null)
|
||||
break;
|
||||
}
|
||||
if (result is not null && result.Value)
|
||||
break;
|
||||
}
|
||||
return new(result, results);
|
||||
}
|
||||
|
||||
internal static DateTime? GetDateTimeFromName(Models.FileHolder fileHolder)
|
||||
{
|
||||
DateTime? result = null;
|
||||
|
@ -10,10 +10,7 @@ internal abstract class Sorting
|
||||
throw new NotSupportedException();
|
||||
if (faceDistanceLength.NormalizedRectangle is null)
|
||||
throw new NotSupportedException();
|
||||
if (faceDistanceEncoding.MinimumDateTime is null || faceDistanceLength.MinimumDateTime is null)
|
||||
throw new NotSupportedException();
|
||||
long ticks = faceDistanceEncoding.MinimumDateTime.Value.Ticks;
|
||||
TimeSpan timeSpan = new(faceDistanceLength.MinimumDateTime.Value.Ticks - ticks);
|
||||
TimeSpan timeSpan = new(faceDistanceLength.DateTimeOriginalThenMinimumDateTime.Ticks - faceDistanceEncoding.DateTimeOriginalThenMinimumDateTime.Ticks);
|
||||
bool older = timeSpan.TotalMilliseconds < 0;
|
||||
int daysDelta = (int)Math.Round(Math.Abs(timeSpan.TotalDays), 0);
|
||||
int distancePermyriad = (int)(faceDistanceLength.Length.Value / rangeDistanceTolerance * faceDistancePermyriad);
|
||||
|
@ -95,9 +95,9 @@ internal abstract partial class XDirectory
|
||||
return renameCollection.Count;
|
||||
}
|
||||
|
||||
private static void IsNotUniqueLoop(string file, List<string> collection)
|
||||
private static bool GetIsNotUniqueAndNeedsReview(string file, List<string> collection)
|
||||
{
|
||||
TimeSpan timeSpan;
|
||||
bool result = false;
|
||||
FileInfo possibleFileInfo;
|
||||
FileInfo fileInfo = new(file);
|
||||
foreach (string possible in collection)
|
||||
@ -105,18 +105,14 @@ internal abstract partial class XDirectory
|
||||
if (possible == file)
|
||||
continue;
|
||||
possibleFileInfo = new(possible);
|
||||
if (possibleFileInfo.LastWriteTime != fileInfo.LastWriteTime)
|
||||
File.SetLastWriteTime(file, new DateTime[] { possibleFileInfo.LastWriteTime, fileInfo.LastWriteTime }.Max());
|
||||
if (possibleFileInfo.LastWriteTime == fileInfo.LastWriteTime && possibleFileInfo.Length == fileInfo.Length)
|
||||
continue;
|
||||
timeSpan = new(possibleFileInfo.LastWriteTime.Ticks - fileInfo.LastWriteTime.Ticks);
|
||||
if (possibleFileInfo.Length != fileInfo.Length)
|
||||
throw new Exception(Path.GetFileNameWithoutExtension(file));
|
||||
if (timeSpan.TotalMinutes < 61)
|
||||
{
|
||||
File.SetLastWriteTime(file, new DateTime[] { possibleFileInfo.LastWriteTime, fileInfo.LastWriteTime }.Min());
|
||||
continue;
|
||||
}
|
||||
throw new Exception(Path.GetFileNameWithoutExtension(file));
|
||||
if (!result)
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static string? GetMatch(string file, List<string> collection)
|
||||
@ -148,28 +144,30 @@ internal abstract partial class XDirectory
|
||||
string fileName;
|
||||
bool uniqueFileName;
|
||||
List<string>? collection;
|
||||
bool? isNotUniqueAndNeedsReview;
|
||||
foreach (string[] files in filesCollection)
|
||||
{
|
||||
foreach (string file in files)
|
||||
{
|
||||
isNotUniqueAndNeedsReview = null;
|
||||
fileName = Path.GetFileName(file);
|
||||
if (!fileNamesToFiles.TryGetValue(fileName, out collection))
|
||||
throw new Exception();
|
||||
uniqueFileName = collection.Count == 1;
|
||||
if (!uniqueFileName)
|
||||
IsNotUniqueLoop(file, collection);
|
||||
isNotUniqueAndNeedsReview = GetIsNotUniqueAndNeedsReview(file, collection);
|
||||
if (!compareFileNamesToFiles.TryGetValue(string.Concat(fileName, extension), out collection))
|
||||
results.Add(new(file, uniqueFileName, new(), null));
|
||||
results.Add(new(file, uniqueFileName, isNotUniqueAndNeedsReview, new(), null));
|
||||
else
|
||||
{
|
||||
if (!collection.Any())
|
||||
results.Add(new(file, uniqueFileName, collection, null));
|
||||
results.Add(new(file, uniqueFileName, isNotUniqueAndNeedsReview, collection, null));
|
||||
else if (uniqueFileName && collection.Count == 1)
|
||||
results.Add(new(file, uniqueFileName, collection, collection.First()));
|
||||
results.Add(new(file, uniqueFileName, isNotUniqueAndNeedsReview, collection, collection.First()));
|
||||
else
|
||||
{
|
||||
match = GetMatch(file, collection);
|
||||
results.Add(new(file, uniqueFileName, collection, match));
|
||||
results.Add(new(file, uniqueFileName, isNotUniqueAndNeedsReview, collection, match));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user