Compare commits
3 Commits
8.0.118.14
...
07-27-a
Author | SHA1 | Date | |
---|---|---|---|
d06d417475 | |||
abeb1892df | |||
ebc1cf49f5 |
134
.vscode/launch.json
vendored
134
.vscode/launch.json
vendored
@ -1,56 +1,82 @@
|
|||||||
{
|
{
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "Compare",
|
"name": "Compare",
|
||||||
"type": "coreclr",
|
"type": "coreclr",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"preLaunchTask": "Build-Compare",
|
"preLaunchTask": "Build-Compare",
|
||||||
"program": "${workspaceFolder}/Compare/bin/Debug/net9.0/win-x64/AA.Compare.dll",
|
"program": "${workspaceFolder}/Compare/bin/Debug/net9.0/win-x64/AA.Compare.dll",
|
||||||
"args": [
|
"args": [
|
||||||
"s"
|
"s"
|
||||||
],
|
],
|
||||||
"env": {
|
"env": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
},
|
},
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
"requireExactSource": false
|
"requireExactSource": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Rename",
|
"name": "Rename",
|
||||||
"type": "coreclr",
|
"type": "coreclr",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"preLaunchTask": "Build-Rename",
|
"preLaunchTask": "Build-Rename",
|
||||||
"program": "${workspaceFolder}/Rename/bin/Debug/net9.0/win-x64/AA.Rename.dll",
|
"program": "${workspaceFolder}/Rename/bin/Debug/net9.0/win-x64/AA.Rename.dll",
|
||||||
"args": [
|
"args": [
|
||||||
"s"
|
"s"
|
||||||
],
|
],
|
||||||
"env": {
|
"env": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
},
|
},
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
"requireExactSource": false
|
"requireExactSource": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Windows",
|
"name": "Windows",
|
||||||
"type": "coreclr",
|
"type": "coreclr",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"preLaunchTask": "Build-Windows",
|
"preLaunchTask": "Build-Windows",
|
||||||
"program": "${workspaceFolder}/Windows/bin/Debug/net9.0/win-x64/AA.Windows.dll",
|
"program": "${workspaceFolder}/Windows/bin/Debug/net9.0/win-x64/AA.Windows.dll",
|
||||||
"args": [
|
"args": [
|
||||||
"s"
|
"s"
|
||||||
],
|
],
|
||||||
"env": {
|
"env": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
},
|
},
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
"requireExactSource": false
|
"requireExactSource": false
|
||||||
}
|
},
|
||||||
]
|
{
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "node Launch Current Opened File",
|
||||||
|
"program": "${file}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bun",
|
||||||
|
"internalConsoleOptions": "neverOpen",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Debug File",
|
||||||
|
"program": "${file}",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"stopOnEntry": false,
|
||||||
|
"watchMode": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bun",
|
||||||
|
"internalConsoleOptions": "neverOpen",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Run File",
|
||||||
|
"program": "${file}",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"noDebug": true,
|
||||||
|
"watchMode": false
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
4
.vscode/mklink.md
vendored
4
.vscode/mklink.md
vendored
@ -40,3 +40,7 @@ mklink /J "L:\Git\AA\Windows\.vscode\.iCloudPhotos2025" "D:\7-Question\iCloud Ph
|
|||||||
{ "label": "Build-Rename", "command": "dotnet", "type": "process", "args": [ "build", "${workspaceFolder}/Rename/AA.Rename.csproj", "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary" ], "problemMatcher": "$msCompile" },
|
{ "label": "Build-Rename", "command": "dotnet", "type": "process", "args": [ "build", "${workspaceFolder}/Rename/AA.Rename.csproj", "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary" ], "problemMatcher": "$msCompile" },
|
||||||
{ "label": "Build-Shared", "command": "dotnet", "type": "process", "args": [ "build", "${workspaceFolder}/Shared/AA.Shared.csproj", "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary" ], "problemMatcher": "$msCompile" },
|
{ "label": "Build-Shared", "command": "dotnet", "type": "process", "args": [ "build", "${workspaceFolder}/Shared/AA.Shared.csproj", "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary" ], "problemMatcher": "$msCompile" },
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```bash 1753233168670 = 638888299686700000 = 2025-3.Summer = Tue Jul 22 2025 18:12:48 GMT-0700 (Mountain Standard Time)
|
||||||
|
mklink /J "L:\Git\AA\.vscode\helper\.638443643487798783" "D:\5-Other-Small\DigiKam\0113C7C3FED381A-hidden-c\638443643487798783"
|
||||||
|
```
|
||||||
|
@ -36,8 +36,6 @@ public class A_Metadata
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ResultSingletonFileGroups = new(results);
|
_ResultSingletonFileGroups = new(results);
|
||||||
ReadOnlyCollection<string> directories = new([Path.Combine(aResultsFullGroupDirectory, resultSettings.ResultSingleton)]);
|
|
||||||
IPath.CreateDirectories(directories);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public (MinimumYearAndPathCombined, ExifDirectory) GetMetadataCollection(ResultSettings resultSettings, MetadataSettings metadataSettings, FilePath filePath)
|
public (MinimumYearAndPathCombined, ExifDirectory) GetMetadataCollection(ResultSettings resultSettings, MetadataSettings metadataSettings, FilePath filePath)
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
using CliWrap;
|
using CliWrap;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Phares.Metadata.Models;
|
||||||
|
using Phares.Metadata.Models.Stateless;
|
||||||
|
using Phares.Shared.Models;
|
||||||
|
using Phares.Shared.Models.Stateless;
|
||||||
using ShellProgressBar;
|
using ShellProgressBar;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@ -7,11 +11,7 @@ using System.Drawing;
|
|||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using Phares.Metadata.Models;
|
|
||||||
using Phares.Metadata.Models.Stateless;
|
|
||||||
using View_by_Distance.Rename.Models;
|
using View_by_Distance.Rename.Models;
|
||||||
using Phares.Shared.Models;
|
|
||||||
using Phares.Shared.Models.Stateless;
|
|
||||||
|
|
||||||
namespace View_by_Distance.Rename;
|
namespace View_by_Distance.Rename;
|
||||||
|
|
||||||
@ -403,7 +403,7 @@ public partial class Rename : IRename, IDisposable
|
|||||||
bool hasIgnoreKeyword = appSettings.MetadataSettings.IgnoreRulesKeyWords.Any(keywords.Contains);
|
bool hasIgnoreKeyword = appSettings.MetadataSettings.IgnoreRulesKeyWords.Any(keywords.Contains);
|
||||||
string checkFileExtension = exifDirectory.FilePath.ExtensionLowered == jpeg ? jpg : exifDirectory.FilePath.ExtensionLowered;
|
string checkFileExtension = exifDirectory.FilePath.ExtensionLowered == jpeg ? jpg : exifDirectory.FilePath.ExtensionLowered;
|
||||||
bool hasDateTimeOriginal = dateTime is not null;
|
bool hasDateTimeOriginal = dateTime is not null;
|
||||||
string paddedId = IId.GetPaddedId(appSettings.ResultSettings, appSettings.MetadataSettings, exifDirectory.FilePath.Id.Value, exifDirectory.FilePath.ExtensionLowered, hasIgnoreKeyword, hasDateTimeOriginal, i);
|
string paddedId = IId.GetPaddedId(appSettings.ResultSettings, appSettings.MetadataSettings, exifDirectory.FilePath, hasIgnoreKeyword, hasDateTimeOriginal, i);
|
||||||
string checkDirectory = appSettings.RenameSettings.InPlaceWithOriginalName ? Path.Combine(exifDirectory.FilePath.DirectoryFullPath, exifDirectory.FilePath.FileNameFirstSegment) : exifDirectory.FilePath.DirectoryFullPath;
|
string checkDirectory = appSettings.RenameSettings.InPlaceWithOriginalName ? Path.Combine(exifDirectory.FilePath.DirectoryFullPath, exifDirectory.FilePath.FileNameFirstSegment) : exifDirectory.FilePath.DirectoryFullPath;
|
||||||
string checkFile = Path.Combine(checkDirectory, $"{paddedId}{checkFileExtension}");
|
string checkFile = Path.Combine(checkDirectory, $"{paddedId}{checkFileExtension}");
|
||||||
if (checkFile != exifDirectory.FilePath.FullName)
|
if (checkFile != exifDirectory.FilePath.FullName)
|
||||||
@ -483,7 +483,7 @@ public partial class Rename : IRename, IDisposable
|
|||||||
{
|
{
|
||||||
if (record.ExifDirectory.FilePath.Id is null)
|
if (record.ExifDirectory.FilePath.Id is null)
|
||||||
continue;
|
continue;
|
||||||
paddedId = IId.GetPaddedId(appSettings.ResultSettings, appSettings.MetadataSettings, record.ExifDirectory.FilePath.Id.Value, record.ExifDirectory.FilePath.ExtensionLowered, record.HasIgnoreKeyword, record.HasDateTimeOriginal, index: null);
|
paddedId = IId.GetPaddedId(appSettings.ResultSettings, appSettings.MetadataSettings, record.ExifDirectory.FilePath, record.HasIgnoreKeyword, record.HasDateTimeOriginal, index: null);
|
||||||
identifier = new([], record.HasDateTimeOriginal, record.ExifDirectory.FilePath.Id.Value, record.ExifDirectory.FilePath.Length, paddedId, record.DateTime.Ticks);
|
identifier = new([], record.HasDateTimeOriginal, record.ExifDirectory.FilePath.Id.Value, record.ExifDirectory.FilePath.Length, paddedId, record.DateTime.Ticks);
|
||||||
identifiers.Add(identifier);
|
identifiers.Add(identifier);
|
||||||
}
|
}
|
||||||
@ -523,7 +523,7 @@ public partial class Rename : IRename, IDisposable
|
|||||||
record = sorted[i];
|
record = sorted[i];
|
||||||
if (record.ExifDirectory.FilePath.Id is null)
|
if (record.ExifDirectory.FilePath.Id is null)
|
||||||
continue;
|
continue;
|
||||||
paddedId = IId.GetPaddedId(appSettings.ResultSettings, appSettings.MetadataSettings, record.ExifDirectory.FilePath.Id.Value, record.ExifDirectory.FilePath.ExtensionLowered, record.HasIgnoreKeyword, record.HasDateTimeOriginal, i);
|
paddedId = IId.GetPaddedId(appSettings.ResultSettings, appSettings.MetadataSettings, record.ExifDirectory.FilePath, record.HasIgnoreKeyword, record.HasDateTimeOriginal, i);
|
||||||
checkDirectory = GetCheckDirectory(appSettings, directoryInfo, record, ids, multipleDirectoriesWithFiles, paddedId);
|
checkDirectory = GetCheckDirectory(appSettings, directoryInfo, record, ids, multipleDirectoriesWithFiles, paddedId);
|
||||||
if (string.IsNullOrEmpty(checkDirectory))
|
if (string.IsNullOrEmpty(checkDirectory))
|
||||||
continue;
|
continue;
|
||||||
|
50
Scripts/immich.js
Normal file
50
Scripts/immich.js
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
const axios = require('axios');
|
||||||
|
|
||||||
|
const url = 'https://immich.bchs.duckdns.org';
|
||||||
|
|
||||||
|
let config = {
|
||||||
|
method: 'get',
|
||||||
|
maxBodyLength: Infinity,
|
||||||
|
// url: url + '/api/users',
|
||||||
|
url: url + '/api/assets/f89d0de1-2762-4f9e-b60e-c7eeec93c4e9',
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'x-api-key': 'Pm2CbhJvgStEPAFKRVclW88qrOAy79OeIEcfj3k'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
axios.request(config)
|
||||||
|
.then((response) => {
|
||||||
|
console.log(JSON.stringify(response.data));
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
// let data = JSON.stringify({
|
||||||
|
// "avatar": {
|
||||||
|
// "color": "green"
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
// let configB = {
|
||||||
|
// method: 'put',
|
||||||
|
// maxBodyLength: Infinity,
|
||||||
|
// url: url + '/api/users/me/preferences',
|
||||||
|
// headers: {
|
||||||
|
// 'Content-Type': 'application/json',
|
||||||
|
// 'Accept': 'application/json',
|
||||||
|
// 'x-api-key': 'Pm2CbhJvgStEPAFKRVclW88qrOAy79OeIEcfj3k'
|
||||||
|
// },
|
||||||
|
// data: data
|
||||||
|
// };
|
||||||
|
|
||||||
|
// axios.request(configB)
|
||||||
|
// .then((response) => {
|
||||||
|
// console.log(JSON.stringify(response.data));
|
||||||
|
// })
|
||||||
|
// .catch((error) => {
|
||||||
|
// console.log(error);
|
||||||
|
// });
|
||||||
|
|
36
Scripts/job-search.js
Normal file
36
Scripts/job-search.js
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import year from '../.vscode/helper/year.job.json' with { type: 'json' };
|
||||||
|
import event from '../.vscode/helper/event.job.json' with { type: 'json' };
|
||||||
|
|
||||||
|
let file;
|
||||||
|
let fromYear = [];
|
||||||
|
let fromEvent = [];
|
||||||
|
let fromYearEventPresent = [];
|
||||||
|
let fromEventYearPresent = [];
|
||||||
|
const pathA = 'L:/Git/AA/.vscode/helper/from-year-event-present.json';
|
||||||
|
const pathB = 'L:/Git/AA/.vscode/helper/from-event-year-present.json';
|
||||||
|
|
||||||
|
year.Files.forEach(element => {
|
||||||
|
file = element.RelativePath.split('\\')[1];
|
||||||
|
fromYear.push(file);
|
||||||
|
});
|
||||||
|
|
||||||
|
event.Files.forEach(element => {
|
||||||
|
file = element.RelativePath.split('\\')[1];
|
||||||
|
fromEvent.push(file);
|
||||||
|
if (fromYear.includes(file)){
|
||||||
|
fromYearEventPresent.push(file);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
year.Files.forEach(element => {
|
||||||
|
file = element.RelativePath.split('\\')[1];
|
||||||
|
if (fromEvent.includes(file)){
|
||||||
|
fromEventYearPresent.push(file);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const jsonA = JSON.stringify(fromYearEventPresent);
|
||||||
|
await Bun.write(pathA, jsonA);
|
||||||
|
|
||||||
|
const jsonB = JSON.stringify(fromEventYearPresent);
|
||||||
|
await Bun.write(pathB, jsonB);
|
27
Scripts/people-to-sql.js
Normal file
27
Scripts/people-to-sql.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import people from '../.vscode/helper/.638443643487798783/people.json' with { type: 'json' };
|
||||||
|
|
||||||
|
const pathA = 'L:/Git/AA/.vscode/helper/.638443643487798783/id-name.sql';
|
||||||
|
const pathB = 'L:/Git/AA/.vscode/helper/.638443643487798783/id-name.json';
|
||||||
|
|
||||||
|
let results = [];
|
||||||
|
let name = '';
|
||||||
|
let person = {};
|
||||||
|
let line = '';
|
||||||
|
let lines = [];
|
||||||
|
for (const property in people) {
|
||||||
|
person = people[property];
|
||||||
|
name = person.Name.Suffix == undefined || person.Name.Suffix.length === 0
|
||||||
|
? person.Name.ForwardSlashFull
|
||||||
|
: person.Name.ForwardSlashFull + ' ' + person.Name.Suffix;
|
||||||
|
line = `update Tags set name = '${name}' where name = '${person.Birth.Note}';`
|
||||||
|
lines.push(line);
|
||||||
|
line = `update TagProperties set value = '${name}' where value = '${person.Birth.Note}';`
|
||||||
|
lines.push(line);
|
||||||
|
results.push({ id: person.Birth.Note, name: name });
|
||||||
|
}
|
||||||
|
|
||||||
|
const text = lines.join('\n');
|
||||||
|
await Bun.write(pathA, text);
|
||||||
|
|
||||||
|
const json = JSON.stringify(results);
|
||||||
|
await Bun.write(pathB, json);
|
@ -29,16 +29,19 @@ public interface IId
|
|||||||
public static bool NameWithoutExtensionIsIntelligentIdFormat(MetadataSettings metadataSettings, string fileNameFirstSegment) =>
|
public static bool NameWithoutExtensionIsIntelligentIdFormat(MetadataSettings metadataSettings, string fileNameFirstSegment) =>
|
||||||
fileNameFirstSegment.Length - 1 == metadataSettings.IntMinValueLength && fileNameFirstSegment[^1] is '0' or '1' or '2' or '3' or '4' or '5' or '6' or '7' or '8' or '9' && fileNameFirstSegment.All(char.IsNumber);
|
fileNameFirstSegment.Length - 1 == metadataSettings.IntMinValueLength && fileNameFirstSegment[^1] is '0' or '1' or '2' or '3' or '4' or '5' or '6' or '7' or '8' or '9' && fileNameFirstSegment.All(char.IsNumber);
|
||||||
|
|
||||||
|
public static string GetPaddedId(ResultSettings resultSettings, MetadataSettings metadataSettings, FilePath filePath, int? index) =>
|
||||||
|
Id.GetPaddedId(resultSettings, metadataSettings, filePath, index);
|
||||||
|
|
||||||
public static bool NameWithoutExtensionIsPaddedIntelligentIdFormat(MetadataSettings metadataSettings, int sortOrderOnlyLengthIndex, string fileNameFirstSegment) =>
|
public static bool NameWithoutExtensionIsPaddedIntelligentIdFormat(MetadataSettings metadataSettings, int sortOrderOnlyLengthIndex, string fileNameFirstSegment) =>
|
||||||
fileNameFirstSegment.Length == metadataSettings.IntMinValueLength + sortOrderOnlyLengthIndex + 1
|
fileNameFirstSegment.Length == metadataSettings.IntMinValueLength + sortOrderOnlyLengthIndex + 1
|
||||||
&& fileNameFirstSegment[^1] is '0' or '1' or '2' or '3' or '4' or '5' or '6' or '7' or '8' or '9'
|
&& fileNameFirstSegment[^1] is '0' or '1' or '2' or '3' or '4' or '5' or '6' or '7' or '8' or '9'
|
||||||
&& fileNameFirstSegment.All(char.IsNumber);
|
&& fileNameFirstSegment.All(char.IsNumber);
|
||||||
|
|
||||||
public static string GetIntelligentId(ResultSettings resultSettings, MetadataSettings metadataSettings, long id, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal) =>
|
public static string GetPaddedId(ResultSettings resultSettings, MetadataSettings metadataSettings, FilePath filePath, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index) =>
|
||||||
Id.GetIntelligentId(resultSettings, metadataSettings, id, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal);
|
filePath.Id is null ? throw new Exception() : GetPaddedId(resultSettings, metadataSettings, filePath.Id.Value, filePath.NameWithoutExtension, filePath.ExtensionLowered, hasIgnoreKeyword, hasDateTimeOriginal, index);
|
||||||
|
|
||||||
public static string GetPaddedId(ResultSettings resultSettings, MetadataSettings metadataSettings, int id, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index) =>
|
public static string GetPaddedId(ResultSettings resultSettings, MetadataSettings metadataSettings, int id, string nameWithoutExtension, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index) =>
|
||||||
Id.GetPaddedId(resultSettings, metadataSettings, id, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal, index);
|
Id.GetPaddedId(resultSettings, metadataSettings, id, nameWithoutExtension, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal, index);
|
||||||
|
|
||||||
internal int TestStatic_GetDeterministicHashCode(byte[] value) =>
|
internal int TestStatic_GetDeterministicHashCode(byte[] value) =>
|
||||||
GetDeterministicHashCode(value);
|
GetDeterministicHashCode(value);
|
||||||
@ -61,13 +64,16 @@ public interface IId
|
|||||||
internal bool TestStatic_NameWithoutExtensionIsIntelligentIdFormat(MetadataSettings metadataSettings, string fileNameFirstSegment) =>
|
internal bool TestStatic_NameWithoutExtensionIsIntelligentIdFormat(MetadataSettings metadataSettings, string fileNameFirstSegment) =>
|
||||||
NameWithoutExtensionIsIntelligentIdFormat(metadataSettings, fileNameFirstSegment);
|
NameWithoutExtensionIsIntelligentIdFormat(metadataSettings, fileNameFirstSegment);
|
||||||
|
|
||||||
|
internal string TestStatic_GetPaddedId(ResultSettings resultSettings, MetadataSettings metadataSettings, FilePath filePath, int? index) =>
|
||||||
|
GetPaddedId(resultSettings, metadataSettings, filePath, index);
|
||||||
|
|
||||||
internal bool TestStatic_NameWithoutExtensionIsPaddedIntelligentIdFormat(MetadataSettings metadataSettings, int sortOrderOnlyLengthIndex, string fileNameFirstSegment) =>
|
internal bool TestStatic_NameWithoutExtensionIsPaddedIntelligentIdFormat(MetadataSettings metadataSettings, int sortOrderOnlyLengthIndex, string fileNameFirstSegment) =>
|
||||||
NameWithoutExtensionIsPaddedIntelligentIdFormat(metadataSettings, sortOrderOnlyLengthIndex, fileNameFirstSegment);
|
NameWithoutExtensionIsPaddedIntelligentIdFormat(metadataSettings, sortOrderOnlyLengthIndex, fileNameFirstSegment);
|
||||||
|
|
||||||
internal string TestStatic_GetIntelligentId(ResultSettings resultSettings, MetadataSettings metadataSettings, string extensionLowered, long id, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal) =>
|
internal string TestStatic_GetPaddedId(ResultSettings resultSettings, MetadataSettings metadataSettings, FilePath filePath, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index) =>
|
||||||
GetIntelligentId(resultSettings, metadataSettings, id, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal);
|
GetPaddedId(resultSettings, metadataSettings, filePath, hasIgnoreKeyword, hasDateTimeOriginal, index);
|
||||||
|
|
||||||
internal string TestStatic_GetPaddedId(ResultSettings resultSettings, MetadataSettings metadataSettings, int id, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index) =>
|
internal string TestStatic_GetPaddedId(ResultSettings resultSettings, MetadataSettings metadataSettings, int id, string nameWithoutExtension, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index) =>
|
||||||
GetPaddedId(resultSettings, metadataSettings, id, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal, index);
|
GetPaddedId(resultSettings, metadataSettings, id, nameWithoutExtension, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal, index);
|
||||||
|
|
||||||
}
|
}
|
@ -23,9 +23,6 @@ public interface IPath
|
|||||||
public static void MakeHiddenIfAllItemsAreHidden(string rootDirectory) =>
|
public static void MakeHiddenIfAllItemsAreHidden(string rootDirectory) =>
|
||||||
XPath.MakeHiddenIfAllItemsAreHidden(rootDirectory);
|
XPath.MakeHiddenIfAllItemsAreHidden(rootDirectory);
|
||||||
|
|
||||||
public static void CreateDirectories(ReadOnlyCollection<string> directories) =>
|
|
||||||
XPath.CreateDirectories(directories);
|
|
||||||
|
|
||||||
public static void ChangeDateForEmptyDirectories(string rootDirectory, long ticks) =>
|
public static void ChangeDateForEmptyDirectories(string rootDirectory, long ticks) =>
|
||||||
XPath.ChangeDateForEmptyDirectories(rootDirectory, ticks);
|
XPath.ChangeDateForEmptyDirectories(rootDirectory, ticks);
|
||||||
|
|
||||||
@ -68,9 +65,6 @@ public interface IPath
|
|||||||
internal void TestStatic_MakeHiddenIfAllItemsAreHidden(string rootDirectory) =>
|
internal void TestStatic_MakeHiddenIfAllItemsAreHidden(string rootDirectory) =>
|
||||||
MakeHiddenIfAllItemsAreHidden(rootDirectory);
|
MakeHiddenIfAllItemsAreHidden(rootDirectory);
|
||||||
|
|
||||||
internal void TestStatic_CreateDirectories(ReadOnlyCollection<string> directories) =>
|
|
||||||
CreateDirectories(directories);
|
|
||||||
|
|
||||||
internal void TestStatic_ChangeDateForEmptyDirectories(string rootDirectory, long ticks) =>
|
internal void TestStatic_ChangeDateForEmptyDirectories(string rootDirectory, long ticks) =>
|
||||||
ChangeDateForEmptyDirectories(rootDirectory, ticks);
|
ChangeDateForEmptyDirectories(rootDirectory, ticks);
|
||||||
|
|
||||||
|
@ -30,8 +30,14 @@ internal abstract class Id
|
|||||||
internal static byte GetHasDateTimeOriginal(ResultSettings resultSettings, FilePath filePath) =>
|
internal static byte GetHasDateTimeOriginal(ResultSettings resultSettings, FilePath filePath) =>
|
||||||
(byte)(IsIgnoreOrValidVideoFormatExtension(resultSettings, filePath) ? filePath.Id > -1 ? 6 : 4 : filePath.Id > -1 ? 9 : 1);
|
(byte)(IsIgnoreOrValidVideoFormatExtension(resultSettings, filePath) ? filePath.Id > -1 ? 6 : 4 : filePath.Id > -1 ? 9 : 1);
|
||||||
|
|
||||||
|
private static string GetExtension(string nameWithoutExtension, string extensionLowered) =>
|
||||||
|
extensionLowered is not ".xmp" and not ".json" ? extensionLowered : Path.GetExtension(nameWithoutExtension);
|
||||||
|
|
||||||
|
private static string GetExtension(FilePath filePath) =>
|
||||||
|
GetExtension(filePath.NameWithoutExtension, filePath.ExtensionLowered);
|
||||||
|
|
||||||
private static bool IsIgnoreOrValidVideoFormatExtension(ResultSettings resultSettings, FilePath filePath) =>
|
private static bool IsIgnoreOrValidVideoFormatExtension(ResultSettings resultSettings, FilePath filePath) =>
|
||||||
IsIgnoreOrValidVideoFormatExtension(resultSettings, filePath.ExtensionLowered);
|
IsIgnoreOrValidVideoFormatExtension(resultSettings, GetExtension(filePath));
|
||||||
|
|
||||||
private static bool IsIgnoreOrValidVideoFormatExtension(ResultSettings resultSettings, string extensionLowered) =>
|
private static bool IsIgnoreOrValidVideoFormatExtension(ResultSettings resultSettings, string extensionLowered) =>
|
||||||
resultSettings.IgnoreExtensions.Contains(extensionLowered)
|
resultSettings.IgnoreExtensions.Contains(extensionLowered)
|
||||||
@ -70,9 +76,7 @@ internal abstract class Id
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable IDE0060
|
private static string GetIntelligentId(ResultSettings resultSettings, MetadataSettings metadataSettings, long id, string nameWithoutExtension, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal)
|
||||||
internal static string GetIntelligentId(ResultSettings resultSettings, MetadataSettings metadataSettings, long id, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal)
|
|
||||||
#pragma warning restore IDE0060
|
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
StringBuilder stringBuilder = new();
|
StringBuilder stringBuilder = new();
|
||||||
@ -88,7 +92,8 @@ internal abstract class Id
|
|||||||
}
|
}
|
||||||
else if (id > -1)
|
else if (id > -1)
|
||||||
{
|
{
|
||||||
if (IsIgnoreOrValidVideoFormatExtension(resultSettings, extensionLowered))
|
string checkExtension = GetExtension(nameWithoutExtension, extensionLowered);
|
||||||
|
if (IsIgnoreOrValidVideoFormatExtension(resultSettings, checkExtension))
|
||||||
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? throw new NotImplementedException() : hasDateTimeOriginal.Value ? 6 : 5;
|
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? throw new NotImplementedException() : hasDateTimeOriginal.Value ? 6 : 5;
|
||||||
else
|
else
|
||||||
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? 8 : hasDateTimeOriginal.Value ? 9 : 7;
|
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? 8 : hasDateTimeOriginal.Value ? 9 : 7;
|
||||||
@ -96,7 +101,8 @@ internal abstract class Id
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (IsIgnoreOrValidVideoFormatExtension(resultSettings, extensionLowered))
|
string checkExtension = GetExtension(nameWithoutExtension, extensionLowered);
|
||||||
|
if (IsIgnoreOrValidVideoFormatExtension(resultSettings, checkExtension))
|
||||||
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? throw new NotImplementedException() : hasDateTimeOriginal.Value ? 4 : 0;
|
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? throw new NotImplementedException() : hasDateTimeOriginal.Value ? 4 : 0;
|
||||||
else
|
else
|
||||||
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? 2 : hasDateTimeOriginal.Value ? 1 : 3;
|
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? 2 : hasDateTimeOriginal.Value ? 1 : 3;
|
||||||
@ -110,14 +116,17 @@ internal abstract class Id
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string GetPaddedId(ResultSettings resultSettings, MetadataSettings metadataSettings, int id, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index)
|
private static string GetIntelligentId(ResultSettings resultSettings, MetadataSettings metadataSettings, FilePath filePath) =>
|
||||||
|
filePath.Id is null ? throw new Exception() : GetIntelligentId(resultSettings, metadataSettings, filePath.Id.Value, filePath.NameWithoutExtension, filePath.ExtensionLowered, filePath.HasIgnoreKeyword, filePath.HasDateTimeOriginal);
|
||||||
|
|
||||||
|
internal static string GetPaddedId(ResultSettings resultSettings, MetadataSettings metadataSettings, int id, string nameWithoutExtension, string extensionLowered, bool? hasIgnoreKeyword, bool? hasDateTimeOriginal, int? index)
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
if (metadataSettings.Offset < 0)
|
if (metadataSettings.Offset < 0)
|
||||||
result = Guid.NewGuid().ToString();
|
result = Guid.NewGuid().ToString();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string intelligentId = GetIntelligentId(resultSettings, metadataSettings, id, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal);
|
string intelligentId = GetIntelligentId(resultSettings, metadataSettings, id, nameWithoutExtension, extensionLowered, hasIgnoreKeyword, hasDateTimeOriginal);
|
||||||
int check = GetId(resultSettings, metadataSettings, intelligentId);
|
int check = GetId(resultSettings, metadataSettings, intelligentId);
|
||||||
if (check != id)
|
if (check != id)
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
@ -126,4 +135,20 @@ internal abstract class Id
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static string GetPaddedId(ResultSettings resultSettings, MetadataSettings metadataSettings, FilePath filePath, int? index)
|
||||||
|
{
|
||||||
|
string result;
|
||||||
|
if (metadataSettings.Offset < 0)
|
||||||
|
result = Guid.NewGuid().ToString();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string intelligentId = GetIntelligentId(resultSettings, metadataSettings, filePath);
|
||||||
|
int check = GetId(resultSettings, metadataSettings, intelligentId);
|
||||||
|
if (filePath.Id is not null && check != filePath.Id.Value)
|
||||||
|
throw new NotSupportedException();
|
||||||
|
result = index is null || metadataSettings.Offset == IId.DeterministicHashCode ? intelligentId : $"{metadataSettings.Offset + index}{intelligentId}";
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -202,20 +202,6 @@ internal abstract class XPath
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void CreateDirectories(ReadOnlyCollection<string> directories)
|
|
||||||
{
|
|
||||||
string checkDirectory;
|
|
||||||
foreach (string directory in directories)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < 101; i++)
|
|
||||||
{
|
|
||||||
checkDirectory = Path.Combine(directory, i.ToString("000"));
|
|
||||||
if (!Directory.Exists(checkDirectory))
|
|
||||||
_ = Directory.CreateDirectory(checkDirectory);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static void ChangeDateForEmptyDirectories(string rootDirectory, long ticks)
|
internal static void ChangeDateForEmptyDirectories(string rootDirectory, long ticks)
|
||||||
{
|
{
|
||||||
DateTime dateTime = new(ticks);
|
DateTime dateTime = new(ticks);
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
using CliWrap;
|
using CliWrap;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Phares.Metadata.Models;
|
||||||
|
using Phares.Metadata.Models.Stateless;
|
||||||
|
using Phares.Shared.Models;
|
||||||
|
using Phares.Shared.Models.Stateless;
|
||||||
using ShellProgressBar;
|
using ShellProgressBar;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using Phares.Metadata.Models;
|
|
||||||
using Phares.Metadata.Models.Stateless;
|
|
||||||
using Phares.Shared.Models;
|
|
||||||
using Phares.Shared.Models.Stateless;
|
|
||||||
using View_by_Distance.Windows.Models;
|
using View_by_Distance.Windows.Models;
|
||||||
|
|
||||||
namespace View_by_Distance.Windows;
|
namespace View_by_Distance.Windows;
|
||||||
@ -268,9 +268,11 @@ public partial class Windows : IWindows, IDisposable
|
|||||||
messages.Add($"{nginxFileSystem.URI.OriginalString}");
|
messages.Add($"{nginxFileSystem.URI.OriginalString}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
string nameWithoutExtension = Path.GetFileNameWithoutExtension(nginxFileSystem.Name);
|
||||||
string paddedId = IId.GetPaddedId(resultSettings: appSettings.ResultSettings,
|
string paddedId = IId.GetPaddedId(resultSettings: appSettings.ResultSettings,
|
||||||
metadataSettings: appSettings.MetadataSettings,
|
metadataSettings: appSettings.MetadataSettings,
|
||||||
id: deterministicHashCode.Id.Value,
|
id: deterministicHashCode.Id.Value,
|
||||||
|
nameWithoutExtension: nameWithoutExtension,
|
||||||
extensionLowered: appSettings.ResultSettings.ValidImageFormatExtensions[0],
|
extensionLowered: appSettings.ResultSettings.ValidImageFormatExtensions[0],
|
||||||
hasIgnoreKeyword: null,
|
hasIgnoreKeyword: null,
|
||||||
hasDateTimeOriginal: null,
|
hasDateTimeOriginal: null,
|
||||||
|
15
package.json
Normal file
15
package.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "adaptation",
|
||||||
|
"module": "index.ts",
|
||||||
|
"type": "module",
|
||||||
|
"private": true,
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/bun": "latest"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"typescript": "^5"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"garbage-collect": "git gc"
|
||||||
|
}
|
||||||
|
}
|
29
tsconfig.json
Normal file
29
tsconfig.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
// Environment setup & latest features
|
||||||
|
"lib": ["ESNext"],
|
||||||
|
"target": "ESNext",
|
||||||
|
"module": "Preserve",
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"jsx": "react-jsx",
|
||||||
|
"allowJs": true,
|
||||||
|
|
||||||
|
// Bundler mode
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"verbatimModuleSyntax": true,
|
||||||
|
"noEmit": true,
|
||||||
|
|
||||||
|
// Best practices
|
||||||
|
"strict": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUncheckedIndexedAccess": true,
|
||||||
|
"noImplicitOverride": true,
|
||||||
|
|
||||||
|
// Some stricter flags (disabled by default)
|
||||||
|
"noUnusedLocals": false,
|
||||||
|
"noUnusedParameters": false,
|
||||||
|
"noPropertyAccessFromIndexSignature": false
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user