This commit is contained in:
2023-10-15 09:51:56 -07:00
parent 2cd2c2b434
commit cd5ab223c9
75 changed files with 895 additions and 722 deletions

View File

@ -1,7 +1,7 @@
---
type: "Kanban"
created: "2023-08-23T22:44:24.920Z"
updated: "2023-09-30T02:39:33.671Z"
type: Kanban
created: '2023-08-23T22:44:24.920Z'
updated: '2023-09-30T02:39:33.671Z'
startedColumns:
- 'In Progress'
completedColumns:
@ -42,9 +42,11 @@ taskTemplate: '^+^_${overdue ? ''^R'' : ''''}${name}^: ${relations ? (''\n^-^/^g
- [verify-camera-model-still-works](tasks/verify-camera-model-still-works.md)
- [run-limiting-on-days](tasks/run-limiting-on-days.md)
- [merge-kristy-files](tasks/merge-kristy-files.md)
- [limit-amazon-sync](tasks/limit-amazon-sync.md)
## Done
- [sftp-sync](tasks/sftp-sync.md)
- [eof-error](tasks/eof-error.md)
- [shrink-percent](tasks/shrink-percent.md)
- [setup-photo-prism-again-in-wsl-docker](tasks/setup-photo-prism-again-in-wsl-docker.md)

View File

@ -0,0 +1,14 @@
---
created: 2023-10-14T22:34:13.711Z
updated: 2023-10-15T08:07:29.699Z
assigned: ""
progress: 0
tags: []
started: 2023-10-14T00:00:00.000Z
---
# Limit Amazon Sync
Don't sync using ValidKeyWordsToIgnoreInRandom
https://github.com/trevorhobenshield/amazon_photos#installation

View File

@ -0,0 +1,11 @@
---
created: 2023-10-14T22:29:10.180Z
updated: 2023-10-14T22:29:16.518Z
assigned: ""
progress: 0
tags: []
started: 2023-10-14T22:29:10.181Z
completed: 2023-10-14T22:29:16.518Z
---
# SFTP Sync

View File

@ -5,6 +5,7 @@ public interface IPropertyConfiguration
public string DateGroup { init; get; }
public string[] IgnoreExtensions { init; get; }
public string[] IgnoreRulesKeyWords { init; get; }
public string PersonBirthdayFormat { init; get; }
public bool PropertiesChangedForProperty { init; get; }
public string[] PropertyContentCollectionFiles { init; get; }
@ -17,6 +18,7 @@ public interface IPropertyConfiguration
public string? ModelName { get; }
public int? NumberOfJitters { get; }
public int? NumberOfTimesToUpsample { get; }
public int Offset { init; get; }
public string? PredictorModelName { get; }
public string RootDirectory { get; }

View File

@ -11,4 +11,4 @@ public record Relation(int DistancePermyriad, string File)
return result;
}
}
}

View File

@ -12,4 +12,4 @@ public record RelationContainer(FileHolder FileHolder, ReadOnlyCollection<Relati
return result;
}
}
}

View File

@ -3,13 +3,10 @@ namespace View_by_Distance.Shared.Models.Stateless.Methods;
public interface IDirectory
{
static int GetOffset() =>
1000000;
int TestStatic_GetSortOrderOnlyLengthIndex() =>
GetSortOrderOnlyLengthIndex();
static int GetSortOrderOnlyLengthIndex() =>
GetOffset().ToString().Length + 3;
short TestStatic_GetSortOrderOnlyLengthIndex(int offset) =>
GetSortOrderOnlyLengthIndex(offset);
static short GetSortOrderOnlyLengthIndex(int offset) =>
(short)(offset.ToString().Length + 3);
char TestStatic_GetDirectory(string fileName) =>
GetDirectory(fileName);
@ -84,14 +81,14 @@ public interface IDirectory
static List<string> CopyOrMove(List<(Models.FileHolder, string?, string)> toDoCollection, bool move, bool moveBack, Action? tick) =>
XDirectory.CopyOrMove(toDoCollection, move, moveBack, tick);
(bool, int?) TestStatic_GetId(int sortOrderOnlyLengthIndex, Models.FileHolder fileHolder) =>
(bool, int?) TestStatic_GetId(short sortOrderOnlyLengthIndex, Models.FileHolder fileHolder) =>
GetId(sortOrderOnlyLengthIndex, fileHolder);
static (bool, int?) GetId(int sortOrderOnlyLengthIndex, Models.FileHolder fileHolder) =>
static (bool, int?) GetId(short sortOrderOnlyLengthIndex, Models.FileHolder fileHolder) =>
XDirectory.GetId(sortOrderOnlyLengthIndex, fileHolder);
(bool, int?) TestStatic_GetId(Models.FileHolder fileHolder) =>
GetId(fileHolder);
static (bool, int?) GetId(Models.FileHolder fileHolder) =>
XDirectory.GetId(GetSortOrderOnlyLengthIndex(), fileHolder);
(bool, int?) TestStatic_GetId(int offset, Models.FileHolder fileHolder) =>
GetId(offset, fileHolder);
static (bool, int?) GetId(int offset, Models.FileHolder fileHolder) =>
XDirectory.GetId(GetSortOrderOnlyLengthIndex(offset), fileHolder);
}

View File

@ -281,7 +281,7 @@ internal abstract partial class XDirectory
}
}
internal static (bool, int?) GetId(int sortOrderOnlyLengthIndex, Models.FileHolder fileHolder)
internal static (bool, int?) GetId(short sortOrderOnlyLengthIndex, Models.FileHolder fileHolder)
{
int? id;
short? multiplier;
@ -319,13 +319,13 @@ internal abstract partial class XDirectory
return (nameWithoutExtensionIsIdFormat, id);
}
private static SortedRecord[] GetSortedRecords(List<string[]> filesCollection)
private static SortedRecord[] GetSortedRecords(int offset, List<string[]> filesCollection)
{
List<SortedRecord> results = new();
int? id;
Models.FileHolder fileHolder;
bool nameWithoutExtensionIsIdFormat;
int sortOrderOnlyLengthIndex = IDirectory.GetSortOrderOnlyLengthIndex();
short sortOrderOnlyLengthIndex = IDirectory.GetSortOrderOnlyLengthIndex(offset);
foreach (string[] files in filesCollection)
{
foreach (string file in files)
@ -357,10 +357,9 @@ internal abstract partial class XDirectory
Models.FileHolder fileHolder;
List<int> distinctIds = new();
List<string> distinct = new();
int offset = IDirectory.GetOffset();
List<string> distinctDirectories = new();
int intMinValueLength = int.MinValue.ToString().Length;
SortedRecord[] sortedRecords = GetSortedRecords(filesCollection);
SortedRecord[] sortedRecords = GetSortedRecords(propertyConfiguration.Offset, filesCollection);
string? alternateResultAllInOne = !propertyConfiguration.ResultAllInOne.Contains(' ') ? null : propertyConfiguration.ResultAllInOne.Replace(' ', '-');
for (int i = 0; i < sortedRecords.Length; i++)
{
@ -390,7 +389,7 @@ internal abstract partial class XDirectory
}
if (ifCanUseId && sortedRecord.NameWithoutExtensionIsIdFormat && sortedRecord.Id is not null && fileHolder.DirectoryName is not null)
{
paddedId = IDirectory.GetPaddedId(intMinValueLength, offset + i, sortedRecord.Id.Value);
paddedId = IDirectory.GetPaddedId(intMinValueLength, propertyConfiguration.Offset + i, sortedRecord.Id.Value);
paddedIdFile = Path.Combine(fileHolder.DirectoryName, $"{paddedId}{fileHolder.ExtensionLowered}");
if (!File.Exists(paddedIdFile))
{
@ -462,9 +461,9 @@ internal abstract partial class XDirectory
foreach ((Models.FileHolder fileHolder, string? alternateFile, string to) in toDoCollection)
{
tick?.Invoke();
if (alternateFile is not null)
_ = XPath.WriteAllText(alternateFile, fileHolder.FullName, updateDateWhenMatches: false, compareBeforeWrite: true, updateToWhenMatches: null);
fileInfo = new(to);
if (!fileInfo.Exists && alternateFile is not null)
_ = XPath.WriteAllText(alternateFile, fileHolder.FullName, updateDateWhenMatches: false, compareBeforeWrite: true, updateToWhenMatches: null);
if (fileInfo.Exists)
{
if (fileHolder.Length != fileInfo.Length || fileHolder.LastWriteTime != fileInfo.LastWriteTime)

View File

@ -286,8 +286,9 @@ internal abstract class XPath
internal static Dictionary<string, string[]> GetKeyValuePairs(IPropertyConfiguration propertyConfiguration, string? resultsFullGroupDirectory, string[]? directories)
{
Dictionary<string, string[]> results = new();
int converted = int.Parse($"1{new string('0', propertyConfiguration.ResultAllInOneSubdirectoryLength)}");
string directory;
string checkDirectory;
int converted = int.Parse($"1{new string('0', propertyConfiguration.ResultAllInOneSubdirectoryLength)}");
int plusOne = converted + 1;
List<string> collection = new();
if (directories is not null)
@ -308,10 +309,11 @@ internal abstract class XPath
}
else
{
directory = Path.Combine(resultsFullGroupDirectory, key, propertyConfiguration.ResultAllInOne);
if (i == converted)
checkDirectory = Path.GetFullPath(Path.Combine(resultsFullGroupDirectory, key, propertyConfiguration.ResultAllInOne, new('-', propertyConfiguration.ResultAllInOneSubdirectoryLength)));
checkDirectory = Path.GetFullPath(Path.Combine(directory, new('-', propertyConfiguration.ResultAllInOneSubdirectoryLength)));
else
checkDirectory = Path.GetFullPath(Path.Combine(resultsFullGroupDirectory, key, propertyConfiguration.ResultAllInOne, i.ToString().PadLeft(propertyConfiguration.ResultAllInOneSubdirectoryLength, '0')));
checkDirectory = Path.GetFullPath(Path.Combine(directory, i.ToString().PadLeft(propertyConfiguration.ResultAllInOneSubdirectoryLength, '0')));
}
if (!Directory.Exists(checkDirectory))
_ = Directory.CreateDirectory(checkDirectory);