Work with video
This commit is contained in:
@ -27,6 +27,7 @@ internal abstract class MapLogic
|
||||
internal record PersonKeyFormattedIdThenWholePercentages(string PersonKeyFormatted,
|
||||
string? PersonDisplayDirectoryName,
|
||||
bool? IsDefault,
|
||||
int? LinksCount,
|
||||
FilePath MappedFaceFilePath,
|
||||
int Id,
|
||||
int WholePercentages);
|
||||
@ -298,13 +299,14 @@ internal abstract class MapLogic
|
||||
return results;
|
||||
}
|
||||
|
||||
private static Dictionary<int, Dictionary<int, List<PersonContainer>>> GetAll(Configuration configuration, ReadOnlyDictionary<string, PersonContainer> personKeyFormattedToPersonContainer, ReadOnlyCollection<PersonKeyFormattedIdThenWholePercentages> personKeyFormattedIdThenWholePercentagesCollection)
|
||||
private static Dictionary<int, Dictionary<int, List<PersonContainer>>> GetAll(Configuration configuration, Dictionary<int, List<(string, int)>> skipCollection, ReadOnlyDictionary<string, PersonContainer> personKeyFormattedToPersonContainer, ReadOnlyCollection<PersonKeyFormattedIdThenWholePercentages> personKeyFormattedIdThenWholePercentagesCollection)
|
||||
{
|
||||
Dictionary<int, Dictionary<int, List<PersonContainer>>> results = [];
|
||||
PersonBirthday? personBirthday;
|
||||
PersonContainer? personContainer;
|
||||
List<PersonContainer>? personContainers;
|
||||
Dictionary<int, List<PersonContainer>>? idTo;
|
||||
int? linkedAlphaCheck = string.IsNullOrEmpty(configuration.LinkedAlpha) ? null : configuration.LinkedAlpha[0] - 65;
|
||||
if (personKeyFormattedIdThenWholePercentagesCollection.Count > 0)
|
||||
{
|
||||
foreach (PersonKeyFormattedIdThenWholePercentages personKeyFormattedIdThenWholePercentages in personKeyFormattedIdThenWholePercentagesCollection)
|
||||
@ -312,6 +314,13 @@ internal abstract class MapLogic
|
||||
personBirthday = IPersonBirthday.GetPersonBirthday(configuration.PersonBirthdayFormat, personKeyFormattedIdThenWholePercentages.PersonKeyFormatted);
|
||||
if (personBirthday is null)
|
||||
throw new Exception();
|
||||
if (linkedAlphaCheck is not null && personKeyFormattedIdThenWholePercentages.LinksCount is not null && personKeyFormattedIdThenWholePercentages.LinksCount.Value < linkedAlphaCheck.Value)
|
||||
{
|
||||
if (!skipCollection.ContainsKey(personKeyFormattedIdThenWholePercentages.Id))
|
||||
skipCollection.Add(personKeyFormattedIdThenWholePercentages.Id, []);
|
||||
skipCollection[personKeyFormattedIdThenWholePercentages.Id].Add((personKeyFormattedIdThenWholePercentages.MappedFaceFilePath.FullName, personKeyFormattedIdThenWholePercentages.WholePercentages));
|
||||
continue;
|
||||
}
|
||||
if (!personKeyFormattedToPersonContainer.TryGetValue(personKeyFormattedIdThenWholePercentages.PersonKeyFormatted, out personContainer))
|
||||
throw new Exception();
|
||||
if (!results.TryGetValue(personKeyFormattedIdThenWholePercentages.Id, out idTo))
|
||||
@ -457,7 +466,7 @@ internal abstract class MapLogic
|
||||
}
|
||||
if (!filePath.Name.EndsWith(".dup") && !filePath.Name.EndsWith(".unk") && !filePath.Name.EndsWith(".abd"))
|
||||
continue;
|
||||
if (!File.Exists(filePath.Name))
|
||||
if (!File.Exists(filePath.FullName))
|
||||
continue;
|
||||
checkFile = filePath.FullName[..^4];
|
||||
if (File.Exists(checkFile))
|
||||
@ -470,7 +479,7 @@ internal abstract class MapLogic
|
||||
return results;
|
||||
}
|
||||
|
||||
private static void ParallelFor(Shared.Models.Properties.IPropertyConfiguration propertyConfiguration, Configuration configuration, Dictionary<int, List<(string, int)>> skipCollection, List<LocationContainer> locationContainers, MappedFile mappedFile)
|
||||
private static void ParallelFor(Shared.Models.Properties.IPropertyConfiguration propertyConfiguration, Configuration configuration, ReadOnlyDictionary<int, List<(string, int)>> skipCollection, List<LocationContainer> locationContainers, MappedFile mappedFile)
|
||||
{
|
||||
int? id;
|
||||
string checkFile;
|
||||
@ -502,7 +511,7 @@ internal abstract class MapLogic
|
||||
}
|
||||
if (wholePercentages is null)
|
||||
return;
|
||||
if (string.IsNullOrEmpty(configuration.LocationContainerDebugDirectory) && skipCollection.TryGetValue(id.Value, out wholePercentagesCollection))
|
||||
if (configuration.LinkedAlpha is null && string.IsNullOrEmpty(configuration.LocationContainerDebugDirectory) && skipCollection.TryGetValue(id.Value, out wholePercentagesCollection))
|
||||
{
|
||||
fileMatches = (from l in wholePercentagesCollection where l.WholePercentages == wholePercentages select l.File).ToArray();
|
||||
foreach (string fileMatch in fileMatches)
|
||||
@ -734,11 +743,11 @@ internal abstract class MapLogic
|
||||
}
|
||||
}
|
||||
|
||||
internal static ReadOnlyDictionary<int, ReadOnlyDictionary<int, ReadOnlyCollection<PersonContainer>>> GetIdThenWholePercentagesToPersonContainers(Configuration configuration, ReadOnlyDictionary<string, PersonContainer> personKeyFormattedToPersonContainer, ReadOnlyCollection<PersonKeyFormattedIdThenWholePercentages> personKeyFormattedIdThenWholePercentagesCollection)
|
||||
internal static ReadOnlyDictionary<int, ReadOnlyDictionary<int, ReadOnlyCollection<PersonContainer>>> GetIdThenWholePercentagesToPersonContainers(Configuration configuration, Dictionary<int, List<(string, int)>> skipCollection, ReadOnlyDictionary<string, PersonContainer> personKeyFormattedToPersonContainer, ReadOnlyCollection<PersonKeyFormattedIdThenWholePercentages> personKeyFormattedIdThenWholePercentagesCollection)
|
||||
{
|
||||
ReadOnlyDictionary<int, ReadOnlyDictionary<int, ReadOnlyCollection<PersonContainer>>> results;
|
||||
Dictionary<int, Dictionary<int, List<PersonContainer>>> idThenWholePercentagesToPersonContainerCollection;
|
||||
idThenWholePercentagesToPersonContainerCollection = GetAll(configuration, personKeyFormattedToPersonContainer, personKeyFormattedIdThenWholePercentagesCollection);
|
||||
idThenWholePercentagesToPersonContainerCollection = GetAll(configuration, skipCollection, personKeyFormattedToPersonContainer, personKeyFormattedIdThenWholePercentagesCollection);
|
||||
results = GetReadOnly(idThenWholePercentagesToPersonContainerCollection);
|
||||
return results;
|
||||
}
|
||||
@ -766,7 +775,7 @@ internal abstract class MapLogic
|
||||
wholePercentagesCollection = idToWholePercentagesCollection[record.MappedFaceFilePath.Id.Value];
|
||||
wholePercentagesCollection.Add(wholePercentages.Value);
|
||||
idToWholePercentagesCollection[record.MappedFaceFilePath.Id.Value].Add(wholePercentages.Value);
|
||||
results.Add(new(record.PersonKeyFormatted, record.PersonDisplayDirectoryName, record.IsDefault, record.MappedFaceFilePath, record.MappedFaceFilePath.Id.Value, wholePercentages.Value));
|
||||
results.Add(new(record.PersonKeyFormatted, record.PersonDisplayDirectoryName, record.IsDefault, record.LinksCount, record.MappedFaceFilePath, record.MappedFaceFilePath.Id.Value, wholePercentages.Value));
|
||||
}
|
||||
return new(results);
|
||||
}
|
||||
@ -890,7 +899,7 @@ internal abstract class MapLogic
|
||||
}
|
||||
}
|
||||
|
||||
internal static List<LocationContainer> GetLocationContainers(int maxDegreeOfParallelism, Shared.Models.Properties.IPropertyConfiguration propertyConfiguration, Configuration configuration, long ticks, ReadOnlyCollection<PersonContainer> personContainers, Dictionary<int, List<(string, int)>> skipCollection, List<Record> records)
|
||||
internal static List<LocationContainer> GetLocationContainers(int maxDegreeOfParallelism, Shared.Models.Properties.IPropertyConfiguration propertyConfiguration, Configuration configuration, long ticks, ReadOnlyCollection<PersonContainer> personContainers, ReadOnlyDictionary<int, List<(string, int)>> skipCollection, List<Record> records)
|
||||
{
|
||||
List<LocationContainer> results = [];
|
||||
List<MappedFile> mappedFiles = GetMappedFiles(propertyConfiguration, configuration, personContainers, records);
|
||||
|
Reference in New Issue
Block a user