Removed time-span and directory-dictionary

This commit is contained in:
2025-10-22 18:54:05 -07:00
parent 2b13c8c198
commit 69285cac1c
3 changed files with 2 additions and 15 deletions

View File

@ -44,7 +44,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="CliWrap" Version="3.8.2" />
<PackageReference Include="runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="8.0.12" />
<PackageReference Include="runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="9.0.10" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />

View File

@ -7,7 +7,6 @@ namespace View_by_Distance.Rename.Models;
public record RenameSettings(string Company,
string DefaultMaker,
Dictionary<string, string?> DirectoryDictionary,
string? FirstPassFile,
bool ForceNewId,
bool InPlace,

View File

@ -273,7 +273,6 @@ public partial class Rename : IRename, IDisposable
{
List<FirstPass> results = [];
int index = -1;
TimeSpan timeSpan;
foreach (KeyValuePair<string, List<FileHolder>> keyValuePair in keyValuePairs)
{
index += 1;
@ -287,9 +286,6 @@ public partial class Rename : IRename, IDisposable
if (keyValuePair.Value.Count > 2)
throw new NotSupportedException("Too many sidecar files!");
SetFirstPassCollection(logger, appSettings, rename, ids, metadata, index, keyValuePair, results);
timeSpan = new(DateTime.Now.Ticks - rename.Ticks);
if (timeSpan.TotalMilliseconds > appSettings.RenameSettings.MaxMilliSecondsPerCall)
break;
}
return results;
}
@ -643,7 +639,6 @@ public partial class Rename : IRename, IDisposable
{
if (record.ExifDirectory.FilePath.FullName[..2] != directoryInfo.FullName[..2])
isWrongYear = null;
string directoryName;
string tfw = GetTFW(record, isWrongYear);
string? maker = IMetaBase.GetMaker(record.ExifDirectory);
string rootDirectory = appSettings.ResultSettings.RootDirectory;
@ -652,14 +647,7 @@ public partial class Rename : IRename, IDisposable
string? splat = checkDirectoryName.Length > 3 && checkDirectoryName[^3..][1] == '!' ? checkDirectoryName[^3..] : null;
string contains = record.ExifDirectory.FilePath.Id is null || ids.Contains(record.ExifDirectory.FilePath.Id.Value) ? "_ Exists _" : "_ New-Destination _";
string makerSplit = string.IsNullOrEmpty(maker) ? string.IsNullOrEmpty(appSettings.RenameSettings.DefaultMaker) ? string.Empty : appSettings.RenameSettings.DefaultMaker : $" {maker.Split(' ')[0]}";
if (!string.IsNullOrEmpty(splat) || isWrongYear is null || isWrongYear.Value || appSettings.RenameSettings.DirectoryDictionary.Count < 2)
directoryName = GetDirectoryName(year, tfw, segments[0], splat, seasonValue, seasonName, makerSplit);
else
{
directoryName = record.DateTime.ToString("yyyy-MM-dd");
if (appSettings.RenameSettings.DirectoryDictionary.TryGetValue(directoryName, out string? value) && !string.IsNullOrEmpty(value))
directoryName = value;
}
string directoryName = GetDirectoryName(year, tfw, segments[0], splat, seasonValue, seasonName, makerSplit);
result = Path.GetFullPath(Path.Combine(rootDirectory, contains, directoryName));
}
}