Any
MoveToDecade
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
@ -18,7 +19,7 @@ public class F_PhotoPrism
|
||||
{
|
||||
string json = File.ReadAllText(fileName);
|
||||
JsonElement[]? jsonElements = JsonSerializer.Deserialize<JsonElement[]>(json);
|
||||
if (jsonElements is null || !jsonElements.Any())
|
||||
if (jsonElements is null || jsonElements.Length == 0)
|
||||
results = Array.Empty<JsonProperty>();
|
||||
else
|
||||
{
|
||||
@ -37,7 +38,7 @@ public class F_PhotoPrism
|
||||
Marker[]? results;
|
||||
string file = Path.Combine(fPhotoPrismSingletonDirectory, "markers.json");
|
||||
JsonProperty[] jsonProperties = GetJsonProperty(file);
|
||||
if (!jsonProperties.Any())
|
||||
if (jsonProperties.Length == 0)
|
||||
results = null;
|
||||
else
|
||||
results = JsonSerializer.Deserialize<Marker[]>(jsonProperties.Last().Value);
|
||||
@ -79,7 +80,7 @@ public class F_PhotoPrism
|
||||
List<Shared.Models.DatabaseFile>? results;
|
||||
string file = Path.Combine(fPhotoPrismSingletonDirectory, "files.json");
|
||||
JsonProperty[] jsonProperties = GetJsonProperty(file);
|
||||
if (!jsonProperties.Any())
|
||||
if (jsonProperties.Length == 0)
|
||||
results = null;
|
||||
else
|
||||
{
|
||||
@ -140,7 +141,7 @@ public class F_PhotoPrism
|
||||
return results;
|
||||
}
|
||||
|
||||
private static void PopulateSubjects(string mappingDefaultName, string personBirthdayFormat, List<string> subjects, StringBuilder stringBuilder, PersonContainer[] personContainers, (MappingFromPhotoPrism MappingFromPhotoPrism, Shared.Models.Marker Marker, float Percent)[] sortedCollection)
|
||||
private static void PopulateSubjects(string mappingDefaultName, string personBirthdayFormat, List<string> subjects, StringBuilder stringBuilder, ReadOnlyCollection<PersonContainer> personContainers, (MappingFromPhotoPrism MappingFromPhotoPrism, Shared.Models.Marker Marker, float Percent)[] sortedCollection)
|
||||
{
|
||||
long? personKey;
|
||||
const int zero = 0;
|
||||
@ -150,7 +151,7 @@ public class F_PhotoPrism
|
||||
{
|
||||
foreach (PersonContainer personContainer in personContainers)
|
||||
{
|
||||
if (personContainer.Key is null || personContainer.Birthdays is null || !personContainer.Birthdays.Any())
|
||||
if (personContainer.Key is null || personContainer.Birthdays is null || personContainer.Birthdays.Length == 0)
|
||||
continue;
|
||||
if (IPerson.IsDefaultName(mappingDefaultName, personContainer.DisplayDirectoryName))
|
||||
continue;
|
||||
@ -181,11 +182,11 @@ public class F_PhotoPrism
|
||||
List<string> subjects = new();
|
||||
DateTime dateTime = new(ticks);
|
||||
int dlibLocationWholePercentages;
|
||||
PersonContainer[]? personContainers;
|
||||
StringBuilder stringBuilder = new();
|
||||
RectangleF? dlibPercentagesRectangle;
|
||||
ReadOnlyCollection<PersonContainer>? personContainers;
|
||||
float rectangleIntersectMinimum = rectangleIntersectMinimums.Min();
|
||||
Dictionary<int, PersonContainer[]>? wholePercentagesToPersonContainers;
|
||||
ReadOnlyDictionary<int, ReadOnlyCollection<PersonContainer>>? wholePercentagesToPersonContainers;
|
||||
(MappingFromPhotoPrism MappingFromPhotoPrism, Shared.Models.Marker Marker, float Percent)[] sortedCollection;
|
||||
List<(MappingFromPhotoPrism MappingFromPhotoPrism, Shared.Models.Marker Marker, float Percent)> collection = new();
|
||||
foreach (Face face in distinctFilteredFaces)
|
||||
@ -220,12 +221,12 @@ public class F_PhotoPrism
|
||||
collection.Add(new(mappingFromPhotoPrism, marker, percent.Value));
|
||||
}
|
||||
}
|
||||
if (!collection.Any())
|
||||
if (collection.Count == 0)
|
||||
continue;
|
||||
sortedCollection = collection.OrderByDescending(l => l.Percent).ToArray();
|
||||
PopulateSubjects(mappingDefaultName, personBirthdayFormat, subjects, stringBuilder, personContainers, sortedCollection);
|
||||
}
|
||||
if (subjects.Any())
|
||||
if (subjects.Count > 0)
|
||||
{
|
||||
directory = Path.Combine(fPhotoPrismContentDirectory, dateTime.ToString("yyyy-MM-dd"));
|
||||
if (!Directory.Exists(directory))
|
||||
|
Reference in New Issue
Block a user