Linux Config
This commit is contained in:
parent
cf5984385f
commit
b673e99f73
@ -8,18 +8,15 @@ public class AppSettings
|
|||||||
|
|
||||||
public string Company { init; get; }
|
public string Company { init; get; }
|
||||||
public int MaxDegreeOfParallelism { init; get; }
|
public int MaxDegreeOfParallelism { init; get; }
|
||||||
public string SaveDirectory { init; get; }
|
|
||||||
public string WorkingDirectoryName { init; get; }
|
public string WorkingDirectoryName { init; get; }
|
||||||
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public AppSettings(string company,
|
public AppSettings(string company,
|
||||||
int maxDegreeOfParallelism,
|
int maxDegreeOfParallelism,
|
||||||
string saveDirectory,
|
|
||||||
string workingDirectoryName)
|
string workingDirectoryName)
|
||||||
{
|
{
|
||||||
Company = company;
|
Company = company;
|
||||||
MaxDegreeOfParallelism = maxDegreeOfParallelism;
|
MaxDegreeOfParallelism = maxDegreeOfParallelism;
|
||||||
SaveDirectory = saveDirectory;
|
|
||||||
WorkingDirectoryName = workingDirectoryName;
|
WorkingDirectoryName = workingDirectoryName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ public class AppSettings
|
|||||||
|
|
||||||
public string Company { get; set; }
|
public string Company { get; set; }
|
||||||
public int? MaxDegreeOfParallelism { get; set; }
|
public int? MaxDegreeOfParallelism { get; set; }
|
||||||
public string SaveDirectory { get; set; }
|
|
||||||
public string WorkingDirectoryName { get; set; }
|
public string WorkingDirectoryName { get; set; }
|
||||||
|
|
||||||
#nullable restore
|
#nullable restore
|
||||||
@ -29,7 +28,6 @@ public class AppSettings
|
|||||||
result = new(
|
result = new(
|
||||||
appSettings.Company,
|
appSettings.Company,
|
||||||
appSettings.MaxDegreeOfParallelism.Value,
|
appSettings.MaxDegreeOfParallelism.Value,
|
||||||
appSettings.SaveDirectory,
|
|
||||||
appSettings.WorkingDirectoryName
|
appSettings.WorkingDirectoryName
|
||||||
);
|
);
|
||||||
return result;
|
return result;
|
||||||
|
@ -13,6 +13,7 @@ public class Configuration
|
|||||||
[Display(Name = "Ignore Extensions"), Required] public string[] IgnoreExtensions { get; set; }
|
[Display(Name = "Ignore Extensions"), Required] public string[] IgnoreExtensions { get; set; }
|
||||||
[Display(Name = "Property Configuration"), Required] public Property.Models.Configuration PropertyConfiguration { get; set; }
|
[Display(Name = "Property Configuration"), Required] public Property.Models.Configuration PropertyConfiguration { get; set; }
|
||||||
[Display(Name = "Person Birthday Format"), Required] public string PersonBirthdayFormat { get; set; }
|
[Display(Name = "Person Birthday Format"), Required] public string PersonBirthdayFormat { get; set; }
|
||||||
|
[Display(Name = "Save Directory"), Required] public string SaveDirectory { get; set; }
|
||||||
|
|
||||||
#nullable restore
|
#nullable restore
|
||||||
|
|
||||||
@ -34,7 +35,8 @@ public class Configuration
|
|||||||
result = new(
|
result = new(
|
||||||
configuration.IgnoreExtensions,
|
configuration.IgnoreExtensions,
|
||||||
configuration.PersonBirthdayFormat,
|
configuration.PersonBirthdayFormat,
|
||||||
configuration.PropertyConfiguration);
|
configuration.PropertyConfiguration,
|
||||||
|
configuration.SaveDirectory);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ public class Configuration
|
|||||||
protected Property.Models.Configuration _PropertyConfiguration;
|
protected Property.Models.Configuration _PropertyConfiguration;
|
||||||
public string[] IgnoreExtensions { init; get; }
|
public string[] IgnoreExtensions { init; get; }
|
||||||
public string PersonBirthdayFormat { init; get; }
|
public string PersonBirthdayFormat { init; get; }
|
||||||
|
public string SaveDirectory { init; get; }
|
||||||
|
|
||||||
public Property.Models.Configuration PropertyConfiguration => _PropertyConfiguration;
|
public Property.Models.Configuration PropertyConfiguration => _PropertyConfiguration;
|
||||||
|
|
||||||
@ -16,11 +17,13 @@ public class Configuration
|
|||||||
public Configuration(
|
public Configuration(
|
||||||
string[] ignoreExtensions,
|
string[] ignoreExtensions,
|
||||||
string personBirthdayFormat,
|
string personBirthdayFormat,
|
||||||
Property.Models.Configuration propertyConfiguration)
|
Property.Models.Configuration propertyConfiguration,
|
||||||
|
string saveDirectory)
|
||||||
{
|
{
|
||||||
IgnoreExtensions = ignoreExtensions;
|
IgnoreExtensions = ignoreExtensions;
|
||||||
PersonBirthdayFormat = personBirthdayFormat;
|
PersonBirthdayFormat = personBirthdayFormat;
|
||||||
_PropertyConfiguration = propertyConfiguration;
|
_PropertyConfiguration = propertyConfiguration;
|
||||||
|
SaveDirectory = saveDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
@ -35,11 +35,11 @@ public class Person
|
|||||||
_PropertyConfiguration = propertyConfiguration;
|
_PropertyConfiguration = propertyConfiguration;
|
||||||
_Configuration = configuration;
|
_Configuration = configuration;
|
||||||
propertyConfiguration.Update();
|
propertyConfiguration.Update();
|
||||||
string? comparePathRoot = Path.GetDirectoryName(appSettings.SaveDirectory);
|
string? comparePathRoot = Path.GetDirectoryName(configuration.SaveDirectory);
|
||||||
if (comparePathRoot is null || comparePathRoot == propertyConfiguration.RootDirectory)
|
if (comparePathRoot is null || comparePathRoot == propertyConfiguration.RootDirectory)
|
||||||
throw new Exception("Nested isn't allowed!");
|
throw new Exception("Nested isn't allowed!");
|
||||||
if (!Directory.Exists(appSettings.SaveDirectory))
|
if (!Directory.Exists(configuration.SaveDirectory))
|
||||||
_ = Directory.CreateDirectory(appSettings.SaveDirectory);
|
_ = Directory.CreateDirectory(configuration.SaveDirectory);
|
||||||
log.Information(propertyConfiguration.RootDirectory);
|
log.Information(propertyConfiguration.RootDirectory);
|
||||||
Verify();
|
Verify();
|
||||||
Loop(ticks, log);
|
Loop(ticks, log);
|
||||||
@ -211,7 +211,7 @@ public class Person
|
|||||||
}
|
}
|
||||||
if (approximateYears is null)
|
if (approximateYears is null)
|
||||||
continue;
|
continue;
|
||||||
personDisplayDirectory = Path.Combine(_AppSettings.SaveDirectory, ticks.ToString(), $"{personName.First.Value} {personName.Last.Value}~{approximateYears}");
|
personDisplayDirectory = Path.Combine(_Configuration.SaveDirectory, ticks.ToString(), $"{personName.First.Value} {personName.Last.Value}~{approximateYears}");
|
||||||
if (!Directory.Exists(personDisplayDirectory))
|
if (!Directory.Exists(personDisplayDirectory))
|
||||||
_ = Directory.CreateDirectory(personDisplayDirectory);
|
_ = Directory.CreateDirectory(personDisplayDirectory);
|
||||||
log.Information("Enter url to download an image (press enter if none)");
|
log.Information("Enter url to download an image (press enter if none)");
|
||||||
@ -238,6 +238,7 @@ public class Person
|
|||||||
personKeyFormatted = $"{IPersonBirthday.GetFormatted(_Configuration.PersonBirthdayFormat, personKey)[..^2]}{code}";
|
personKeyFormatted = $"{IPersonBirthday.GetFormatted(_Configuration.PersonBirthdayFormat, personKey)[..^2]}{code}";
|
||||||
}
|
}
|
||||||
checkDirectory = Path.Combine(personDisplayDirectory, personKeyFormatted);
|
checkDirectory = Path.Combine(personDisplayDirectory, personKeyFormatted);
|
||||||
|
log.Information($"Working directory <{checkDirectory}>");
|
||||||
if (!Directory.Exists(checkDirectory))
|
if (!Directory.Exists(checkDirectory))
|
||||||
_ = Directory.CreateDirectory(checkDirectory);
|
_ = Directory.CreateDirectory(checkDirectory);
|
||||||
_ = IPath.WriteAllText(Path.Combine(checkDirectory, $"{personKeyFormatted}.json"), json, updateDateWhenMatches: false, compareBeforeWrite: true);
|
_ = IPath.WriteAllText(Path.Combine(checkDirectory, $"{personKeyFormatted}.json"), json, updateDateWhenMatches: false, compareBeforeWrite: true);
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
{
|
{
|
||||||
|
"Linux": {
|
||||||
|
"Configuration": {
|
||||||
|
"VerifyToSeason": []
|
||||||
|
}
|
||||||
|
},
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Log4netProvider": "Debug"
|
"Log4netProvider": "Debug"
|
||||||
|
@ -1,6 +1,74 @@
|
|||||||
{
|
{
|
||||||
"Company": "Mike Phares",
|
"Company": "Mike Phares",
|
||||||
"Linux": {},
|
"Linux": {
|
||||||
|
"Configuration": {
|
||||||
|
"DateGroup": "9b89679",
|
||||||
|
"DiffPropertyDirectory": "",
|
||||||
|
"FileNameDirectorySeparator": ".Z.",
|
||||||
|
"ForcePropertyLastWriteTimeToCreationTime": false,
|
||||||
|
"MaxImagesInDirectoryForTopLevelFirstPass": 10,
|
||||||
|
"OutputExtension": ".jpg",
|
||||||
|
"Pattern": "[^ABCDEFGHIJKLMNOPQRSTUVWXYZbcdfghjklmnpqrstvwxyz0-9]",
|
||||||
|
"PersonBirthdayFormat": "yyyy-MM-dd_HH",
|
||||||
|
"PopulatePropertyId": true,
|
||||||
|
"PropertiesChangedForProperty": false,
|
||||||
|
"ResultAllInOne": "_ _ _",
|
||||||
|
"ResultCollection": "[]",
|
||||||
|
"ResultContent": "()",
|
||||||
|
"ResultSingleton": "{}",
|
||||||
|
"RootDirectory": "/srv/samba/share",
|
||||||
|
"SaveDirectory": "/home/vscode",
|
||||||
|
"WriteBitmapDataBytes": false,
|
||||||
|
"IgnoreExtensions": [
|
||||||
|
".gif",
|
||||||
|
".GIF",
|
||||||
|
".pdf",
|
||||||
|
".PDF"
|
||||||
|
],
|
||||||
|
"ValidImageFormatExtensions": [
|
||||||
|
".bmp",
|
||||||
|
".BMP",
|
||||||
|
".gif",
|
||||||
|
".GIF",
|
||||||
|
".jpeg",
|
||||||
|
".JPEG",
|
||||||
|
".jpg",
|
||||||
|
".JPG",
|
||||||
|
".png",
|
||||||
|
".PNG",
|
||||||
|
".tiff",
|
||||||
|
".TIFF"
|
||||||
|
],
|
||||||
|
"ValidMetadataExtensions": [
|
||||||
|
".3gp",
|
||||||
|
".3GP",
|
||||||
|
".avi",
|
||||||
|
".AVI",
|
||||||
|
".bmp",
|
||||||
|
".BMP",
|
||||||
|
".gif",
|
||||||
|
".GIF",
|
||||||
|
".ico",
|
||||||
|
".ICO",
|
||||||
|
".jpeg",
|
||||||
|
".JPEG",
|
||||||
|
".jpg",
|
||||||
|
".JPG",
|
||||||
|
".m4v",
|
||||||
|
".M4V",
|
||||||
|
".mov",
|
||||||
|
".MOV",
|
||||||
|
".mp4",
|
||||||
|
".MP4",
|
||||||
|
".mta",
|
||||||
|
".MTA",
|
||||||
|
".png",
|
||||||
|
".PNG",
|
||||||
|
".tiff",
|
||||||
|
".TIFF"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
@ -10,7 +78,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"MaxDegreeOfParallelism": 6,
|
"MaxDegreeOfParallelism": 6,
|
||||||
"SaveDirectory": "~/",
|
|
||||||
"Serilog": {
|
"Serilog": {
|
||||||
"Using": [
|
"Using": [
|
||||||
"Serilog.Sinks.Console",
|
"Serilog.Sinks.Console",
|
||||||
@ -65,6 +132,7 @@
|
|||||||
"ResultContent": "()",
|
"ResultContent": "()",
|
||||||
"ResultSingleton": "{}",
|
"ResultSingleton": "{}",
|
||||||
"RootDirectory": "C:/Tmp/Phares/Compare/Images-9b89679",
|
"RootDirectory": "C:/Tmp/Phares/Compare/Images-9b89679",
|
||||||
|
"SaveDirectory": "D:/Tmp",
|
||||||
"WriteBitmapDataBytes": false,
|
"WriteBitmapDataBytes": false,
|
||||||
"IgnoreExtensions": [
|
"IgnoreExtensions": [
|
||||||
".gif",
|
".gif",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user