Linux Config
This commit is contained in:
parent
cf5984385f
commit
b673e99f73
@ -8,18 +8,15 @@ public class AppSettings
|
||||
|
||||
public string Company { init; get; }
|
||||
public int MaxDegreeOfParallelism { init; get; }
|
||||
public string SaveDirectory { init; get; }
|
||||
public string WorkingDirectoryName { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public AppSettings(string company,
|
||||
int maxDegreeOfParallelism,
|
||||
string saveDirectory,
|
||||
string workingDirectoryName)
|
||||
{
|
||||
Company = company;
|
||||
MaxDegreeOfParallelism = maxDegreeOfParallelism;
|
||||
SaveDirectory = saveDirectory;
|
||||
WorkingDirectoryName = workingDirectoryName;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,6 @@ public class AppSettings
|
||||
|
||||
public string Company { get; set; }
|
||||
public int? MaxDegreeOfParallelism { get; set; }
|
||||
public string SaveDirectory { get; set; }
|
||||
public string WorkingDirectoryName { get; set; }
|
||||
|
||||
#nullable restore
|
||||
@ -29,7 +28,6 @@ public class AppSettings
|
||||
result = new(
|
||||
appSettings.Company,
|
||||
appSettings.MaxDegreeOfParallelism.Value,
|
||||
appSettings.SaveDirectory,
|
||||
appSettings.WorkingDirectoryName
|
||||
);
|
||||
return result;
|
||||
|
@ -13,6 +13,7 @@ public class Configuration
|
||||
[Display(Name = "Ignore Extensions"), Required] public string[] IgnoreExtensions { 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 = "Save Directory"), Required] public string SaveDirectory { get; set; }
|
||||
|
||||
#nullable restore
|
||||
|
||||
@ -34,7 +35,8 @@ public class Configuration
|
||||
result = new(
|
||||
configuration.IgnoreExtensions,
|
||||
configuration.PersonBirthdayFormat,
|
||||
configuration.PropertyConfiguration);
|
||||
configuration.PropertyConfiguration,
|
||||
configuration.SaveDirectory);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ public class Configuration
|
||||
protected Property.Models.Configuration _PropertyConfiguration;
|
||||
public string[] IgnoreExtensions { init; get; }
|
||||
public string PersonBirthdayFormat { init; get; }
|
||||
public string SaveDirectory { init; get; }
|
||||
|
||||
public Property.Models.Configuration PropertyConfiguration => _PropertyConfiguration;
|
||||
|
||||
@ -16,11 +17,13 @@ public class Configuration
|
||||
public Configuration(
|
||||
string[] ignoreExtensions,
|
||||
string personBirthdayFormat,
|
||||
Property.Models.Configuration propertyConfiguration)
|
||||
Property.Models.Configuration propertyConfiguration,
|
||||
string saveDirectory)
|
||||
{
|
||||
IgnoreExtensions = ignoreExtensions;
|
||||
PersonBirthdayFormat = personBirthdayFormat;
|
||||
_PropertyConfiguration = propertyConfiguration;
|
||||
SaveDirectory = saveDirectory;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
@ -35,11 +35,11 @@ public class Person
|
||||
_PropertyConfiguration = propertyConfiguration;
|
||||
_Configuration = configuration;
|
||||
propertyConfiguration.Update();
|
||||
string? comparePathRoot = Path.GetDirectoryName(appSettings.SaveDirectory);
|
||||
string? comparePathRoot = Path.GetDirectoryName(configuration.SaveDirectory);
|
||||
if (comparePathRoot is null || comparePathRoot == propertyConfiguration.RootDirectory)
|
||||
throw new Exception("Nested isn't allowed!");
|
||||
if (!Directory.Exists(appSettings.SaveDirectory))
|
||||
_ = Directory.CreateDirectory(appSettings.SaveDirectory);
|
||||
if (!Directory.Exists(configuration.SaveDirectory))
|
||||
_ = Directory.CreateDirectory(configuration.SaveDirectory);
|
||||
log.Information(propertyConfiguration.RootDirectory);
|
||||
Verify();
|
||||
Loop(ticks, log);
|
||||
@ -211,7 +211,7 @@ public class Person
|
||||
}
|
||||
if (approximateYears is null)
|
||||
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))
|
||||
_ = Directory.CreateDirectory(personDisplayDirectory);
|
||||
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}";
|
||||
}
|
||||
checkDirectory = Path.Combine(personDisplayDirectory, personKeyFormatted);
|
||||
log.Information($"Working directory <{checkDirectory}>");
|
||||
if (!Directory.Exists(checkDirectory))
|
||||
_ = Directory.CreateDirectory(checkDirectory);
|
||||
_ = IPath.WriteAllText(Path.Combine(checkDirectory, $"{personKeyFormatted}.json"), json, updateDateWhenMatches: false, compareBeforeWrite: true);
|
||||
|
@ -1,4 +1,9 @@
|
||||
{
|
||||
"Linux": {
|
||||
"Configuration": {
|
||||
"VerifyToSeason": []
|
||||
}
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Log4netProvider": "Debug"
|
||||
|
@ -1,6 +1,74 @@
|
||||
{
|
||||
"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": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
@ -10,7 +78,6 @@
|
||||
}
|
||||
},
|
||||
"MaxDegreeOfParallelism": 6,
|
||||
"SaveDirectory": "~/",
|
||||
"Serilog": {
|
||||
"Using": [
|
||||
"Serilog.Sinks.Console",
|
||||
@ -65,6 +132,7 @@
|
||||
"ResultContent": "()",
|
||||
"ResultSingleton": "{}",
|
||||
"RootDirectory": "C:/Tmp/Phares/Compare/Images-9b89679",
|
||||
"SaveDirectory": "D:/Tmp",
|
||||
"WriteBitmapDataBytes": false,
|
||||
"IgnoreExtensions": [
|
||||
".gif",
|
||||
|
Loading…
x
Reference in New Issue
Block a user