Try when running synchronously
This commit is contained in:
Mike Phares 2024-05-19 22:30:33 -07:00
parent c838848129
commit cd88e340a3
4 changed files with 15 additions and 9 deletions

View File

@ -119,7 +119,7 @@ dotnet_diagnostic.IDE0048.severity = error # Parentheses preferences (IDE0047 an
dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049) dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049)
dotnet_diagnostic.IDE0051.severity = error # Private member '' is unused [, ] dotnet_diagnostic.IDE0051.severity = error # Private member '' is unused [, ]
dotnet_diagnostic.IDE0060.severity = warning # IDE0060: Remove unused parameter dotnet_diagnostic.IDE0060.severity = warning # IDE0060: Remove unused parameter
dotnet_diagnostic.IDE0130.severity = error # Namespace does not match folder structure (IDE0130) dotnet_diagnostic.IDE0130.severity = none # Namespace does not match folder structure (IDE0130)
dotnet_diagnostic.IDE0230.severity = warning # IDE0230: Use UTF-8 string literal dotnet_diagnostic.IDE0230.severity = warning # IDE0230: Use UTF-8 string literal
dotnet_diagnostic.IDE0290.severity = error # Use primary constructor [Distance]csharp(IDE0290) dotnet_diagnostic.IDE0290.severity = error # Use primary constructor [Distance]csharp(IDE0290)
dotnet_diagnostic.IDE0300.severity = error # IDE0300: Collection initialization can be simplified dotnet_diagnostic.IDE0300.severity = error # IDE0300: Collection initialization can be simplified

View File

@ -47,9 +47,9 @@ internal abstract class GPS
Math.Asin(Math.Min(1, Math.Asin(Math.Min(1,
Math.Sqrt( Math.Sqrt(
Math.Pow(Math.Sin(DiffRadian(originLatitude, destinationLatitude) / 2.0), 2.0) + Math.Pow(Math.Sin(DiffRadian(originLatitude, destinationLatitude) / 2.0), 2.0) +
Math.Cos(ToRadian(originLatitude)) * Math.Cos(ToRadian(destinationLatitude)) * (Math.Cos(ToRadian(originLatitude)) * Math.Cos(ToRadian(destinationLatitude)) *
Math.Pow(Math.Sin(DiffRadian(originLongitude, destinationLongitude) / 2.0), Math.Pow(Math.Sin(DiffRadian(originLongitude, destinationLongitude) / 2.0),
2.0)))), decimalPlaces); 2.0))))), decimalPlaces);
} }
private static double ParseValueFromDmsString(string value) private static double ParseValueFromDmsString(string value)

View File

@ -46,7 +46,7 @@ internal static class Get
string key = $"{Path.Combine(fileHolder.DirectoryName ?? throw new NotSupportedException(), fileHolder.NameWithoutExtension)}"; string key = $"{Path.Combine(fileHolder.DirectoryName ?? throw new NotSupportedException(), fileHolder.NameWithoutExtension)}";
if (distinct.Contains(key)) if (distinct.Contains(key))
throw new NotSupportedException("Turn off parallelism when sidecar files are present!"); throw new NotSupportedException("Turn off parallelism when sidecar files are present!");
if (!renameConfiguration.SkipIdFiles || filePath.Id is null || !filePath.IsIntelligentIdFormat && filePath.SortOrder is not null) if (!renameConfiguration.SkipIdFiles || filePath.Id is null || (!filePath.IsIntelligentIdFormat && filePath.SortOrder is not null))
{ {
if (filePath.Id is not null) if (filePath.Id is not null)
{ {

View File

@ -140,7 +140,7 @@ public partial class Rename : IRename, IDisposable
} }
} }
private static List<RecordA> GetRecordACollection(IRename rename, RenameConfiguration renameConfiguration, IEnumerable<string> files, A_Metadata metadata) private static List<RecordA> GetRecordACollection(ILogger<Program>? logger, IRename rename, RenameConfiguration renameConfiguration, IEnumerable<string> files, A_Metadata metadata)
{ {
List<RecordA> results = []; List<RecordA> results = [];
int index = -1; int index = -1;
@ -192,7 +192,13 @@ public partial class Rename : IRename, IDisposable
continue; continue;
sidecarFiles.Add(keyValuePair.Value[i]); sidecarFiles.Add(keyValuePair.Value[i]);
} }
(fileInfo, exifDirectory) = metadata.GetMetadataCollection(renameConfiguration.MetadataConfiguration, filePath, deterministicHashCode); try
{ (fileInfo, exifDirectory) = metadata.GetMetadataCollection(renameConfiguration.MetadataConfiguration, filePath, deterministicHashCode); }
catch (Exception)
{
logger?.LogWarning("<{filePath}>", filePath.FullName);
continue;
}
results.Add(new(exifDirectory, fileInfo, filePath, new(sidecarFiles))); results.Add(new(exifDirectory, fileInfo, filePath, new(sidecarFiles)));
if (ffmpegFiles is not null) if (ffmpegFiles is not null)
{ {
@ -223,7 +229,7 @@ public partial class Rename : IRename, IDisposable
return new(results); return new(results);
} }
private ReadOnlyCollection<RecordB> GetRecordBCollection(IRename rename, AppSettings appSettings, RenameConfiguration renameConfiguration, DirectoryInfo directoryInfo) private ReadOnlyCollection<RecordB> GetRecordBCollection(ILogger<Program>? logger, IRename rename, AppSettings appSettings, RenameConfiguration renameConfiguration, DirectoryInfo directoryInfo)
{ {
ReadOnlyCollection<RecordB> results; ReadOnlyCollection<RecordB> results;
List<RecordA> recordACollection = []; List<RecordA> recordACollection = [];
@ -233,7 +239,7 @@ public partial class Rename : IRename, IDisposable
int filesCount = appSettingsMaxDegreeOfParallelism == 1 ? files.Count() : 123000; int filesCount = appSettingsMaxDegreeOfParallelism == 1 ? files.Count() : 123000;
_ProgressBar = new(filesCount, "EnumerateFiles load", new ProgressBarOptions() { ProgressCharacter = '─', ProgressBarOnBottom = true, DisableBottomPercentage = true }); _ProgressBar = new(filesCount, "EnumerateFiles load", new ProgressBarOptions() { ProgressCharacter = '─', ProgressBarOnBottom = true, DisableBottomPercentage = true });
if (appSettingsMaxDegreeOfParallelism == 1) if (appSettingsMaxDegreeOfParallelism == 1)
recordACollection.AddRange(GetRecordACollection(rename, renameConfiguration, files, metadata)); recordACollection.AddRange(GetRecordACollection(logger, rename, renameConfiguration, files, metadata));
else else
{ {
List<string> distinct = []; List<string> distinct = [];
@ -455,7 +461,7 @@ public partial class Rename : IRename, IDisposable
throw new Exception($"Invalid {nameof(renameConfiguration.RelativePropertyCollectionFile)}"); throw new Exception($"Invalid {nameof(renameConfiguration.RelativePropertyCollectionFile)}");
DirectoryInfo directoryInfo = new(Path.GetFullPath(renameConfiguration.MetadataConfiguration.ResultConfiguration.RootDirectory)); DirectoryInfo directoryInfo = new(Path.GetFullPath(renameConfiguration.MetadataConfiguration.ResultConfiguration.RootDirectory));
logger?.LogInformation("{Ticks} {RootDirectory}", ticks, directoryInfo.FullName); logger?.LogInformation("{Ticks} {RootDirectory}", ticks, directoryInfo.FullName);
ReadOnlyCollection<RecordB> recordBCollection = GetRecordBCollection(rename, appSettings, renameConfiguration, directoryInfo); ReadOnlyCollection<RecordB> recordBCollection = GetRecordBCollection(logger, rename, appSettings, renameConfiguration, directoryInfo);
SaveIdentifiersToDisk(ticks, renameConfiguration, aMetadataCollectionDirectory, recordBCollection); SaveIdentifiersToDisk(ticks, renameConfiguration, aMetadataCollectionDirectory, recordBCollection);
if (!renameConfiguration.OnlySaveIdentifiersToDisk) if (!renameConfiguration.OnlySaveIdentifiersToDisk)
{ {