Skip to content

Commit

Permalink
- Just a reminder, Faces have been stored for a few versions now in \…
Browse files Browse the repository at this point in the history
…_Settings\FaceStorage. If you edit FACES.JSON (without AITOOLS open) you can control "MaxFilesPerFace" (defaults to 1000) and "MaxFilesAgeDays" (defaults to 182), "SaveUnknownFaces" (defaults to true), "SaveKnownFaces" (defaults to true. Sorry, no face training or UI for this feature yet. #256   #241

- Fix crash that happens when you try to open Deepstack > STDERR.TXT.    If Windows 11 has broken TXT file associations you have to re-associate manually to fix.
- Increase FileSystemWatcher.InternalBufferSize from 8k to 65k to try to avoid "too many changes at once in directory" error
- Fix error about for input path & copy alert images to folder if both paths were EMPTY.  #294
- Allow for "empty" deepstack CUSTOM model MODE field.   And do not force mode to uppercase since it appears to be case sensitive in the back end python code.   Force first letter upper, the rest lower.  Needs only Low Medium and High so MEDIUM fails with error in STDERR.TXT.  #281
- Update default camera Trigger URL to be more compatible with newer releases of BI - The new one seems to work with a single URL rather than multiple.  #273
- Lower default ActionDelayMS from 500 to 250.
  • Loading branch information
VorlonCD committed Nov 17, 2021
1 parent 56e643c commit 2174054
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 62 deletions.
88 changes: 44 additions & 44 deletions src/AITool.Setup/AITool.Setup.innoproj
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>1.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>977e04cc-69c8-4ca9-b599-89b5e5b25772</ProjectGuid>
<AssemblyName>AITool.Setup</AssemblyName>
<Name>AITool.Setup</Name>
<RootNamespace>AITool.Setup</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>
</OutputPath>
<CompilerOutput />
<CompilerBaseFileName />
<CompilerSignTool />
<DirectivesSymbol />
<DirectivesOption />
<DirectivesParseOption />
<DirectivesInclude />
<DirectivesIncludeFile />
<DirectivesInlineStart />
<DirectivesInlineEnd />
<LaunchToolBeforeBuild>
</LaunchToolBeforeBuild>
<LaunchToolAfterBuild>
</LaunchToolAfterBuild>
<RunInstaller>No</RunInstaller>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>
</OutputPath>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<ItemGroup>
<Compile Include="Script.iss">
</Compile>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\VisualInstaller\InnoSetupProject.targets" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>1.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>977e04cc-69c8-4ca9-b599-89b5e5b25772</ProjectGuid>
<AssemblyName>AITool.Setup</AssemblyName>
<Name>AITool.Setup</Name>
<RootNamespace>AITool.Setup</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>
</OutputPath>
<CompilerOutput />
<CompilerBaseFileName />
<CompilerSignTool />
<DirectivesSymbol />
<DirectivesOption />
<DirectivesParseOption />
<DirectivesInclude />
<DirectivesIncludeFile />
<DirectivesInlineStart />
<DirectivesInlineEnd />
<LaunchToolBeforeBuild>
</LaunchToolBeforeBuild>
<LaunchToolAfterBuild>
</LaunchToolAfterBuild>
<RunInstaller>No</RunInstaller>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>
</OutputPath>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<ItemGroup>
<Compile Include="Script.iss">
</Compile>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\VisualInstaller64\InnoSetupProject.targets" />
</Project>
4 changes: 2 additions & 2 deletions src/UI/AITOOL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1853,8 +1853,9 @@ public static async Task<FileSystemWatcher> CreateFileWatcherAsync(string path,
watcher.Path = path;
watcher.Filter = filter;
watcher.IncludeSubdirectories = IncludeSubdirectories;
watcher.InternalBufferSize = 65536; //defaults to 8k, we are going max it out to try to prevent "too many changes at once in directory"

//The 'default' is the bitwise OR combination of LastWrite, FileName, and DirectoryName'
//The 'default' is the bitwise OR combination of NotifyFilters.LastWrite | NotifyFilters.LastAccess | NotifyFilters.CreationTime | NotifyFilters.FileName | NotifyFilters.DirectoryName
watcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName;

//fswatcher events
Expand All @@ -1863,7 +1864,6 @@ public static async Task<FileSystemWatcher> CreateFileWatcherAsync(string path,
watcher.Deleted += new FileSystemEventHandler(OnDeleted);
watcher.Error += new ErrorEventHandler(OnError);


}
else
{
Expand Down
12 changes: 6 additions & 6 deletions src/UI/Camera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -355,16 +355,16 @@ public void UpdateCamera()
if (!AITOOL.BlueIrisInfo.IsNull() && AITOOL.BlueIrisInfo.Result == BlueIrisResult.Valid)
{
if (this.trigger_urls_as_string.IsEmpty())
this.trigger_urls_as_string = "[BlueIrisURL]/admin?trigger&flagalert=1&camera=[camera]&user=[Username]&pw=[Password]&memo=[summary]&jpeg=[ImagePathEscaped]";
this.trigger_urls_as_string = "[BlueIrisURL]/admin?camera=[camera]&trigger&user=[Username]&pw=[Password]&flagalert=2&memo=[summary]&jpeg=[ImagePathEscaped]";
if (this.cancel_urls_as_string.IsEmpty())
this.cancel_urls_as_string = "[BlueIrisURL]/admin?flagalert=0&camera=[camera]&user=[Username]&pw=[Password]&memo=(Canceled)";
this.cancel_urls_as_string = "[BlueIrisURL]/admin?&camera=[camera]&user=[Username]&pw=[Password]&flagalert=0&memo=(Canceled)";
}
else
{
if (this.trigger_urls_as_string.IsEmpty())
this.trigger_urls_as_string = "http://127.0.0.1:81/admin?trigger&flagalert=1&camera=[camera]&user=[Username]&pw=[Password]&memo=[summary]&jpeg=[ImagePathEscaped]";
this.trigger_urls_as_string = "http://127.0.0.1:81/admin?camera=[camera]&trigger&user=[Username]&pw=[Password]&flagalert=2&memo=[summary]&jpeg=[ImagePathEscaped]";
if (this.cancel_urls_as_string.IsEmpty())
this.cancel_urls_as_string = "http://127.0.0.1:81/admin?flagalert=0&camera=[camera]&user=[Username]&pw=[Password]&memo=(Canceled)";
this.cancel_urls_as_string = "http://127.0.0.1:81/admin?&camera=[camera]&user=[Username]&pw=[Password]&flagalert=0&memo=(Canceled)";

}

Expand All @@ -373,10 +373,10 @@ public void UpdateCamera()

this.CleanActionNetworkFolder();

if (this.input_path.TrimEnd("\\".ToCharArray()).EqualsIgnoreCase(this.Action_network_folder.TrimEnd("\\".ToCharArray())))
if (this.input_path.IsNotNull() && this.Action_network_folder.IsNotNull() && this.input_path.TrimEnd("\\".ToCharArray()).EqualsIgnoreCase(this.Action_network_folder.TrimEnd("\\".ToCharArray())))
{
//You dont want to watch, then copy the same file back to the same folder
AITOOL.Log($"WARNING: Input path ({this.input_path}) & 'Copy alert images to folder' path may not be the same.", "");
AITOOL.Log($"WARNING: Input path ({this.input_path}) & 'Copy alert images to folder' path may not be the same for camera '{this.Name}'.", "");
}


Expand Down
1 change: 1 addition & 0 deletions src/UI/ClsFileSystemWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public ClsFileSystemWatcher(string Name, string Path, FileSystemWatcher Watcher,
this.Path = Path;
this.watcher = Watcher;
this.IncludeSubdirectories = IncludeSubFolders;
this.watcher.InternalBufferSize = 65536; //defaults to 8k, we are going max it out to try to prevent "too many changes at once in directory"
}
}
}
2 changes: 1 addition & 1 deletion src/UI/ClsImageQueueItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public void LoadImage()
}
else
{
LastError = "Error: File has been deleted: " + this.image_path;
LastError = "Debug: File has been deleted: " + this.image_path;
}
}
catch (Exception ex)
Expand Down
6 changes: 5 additions & 1 deletion src/UI/DeepStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,11 @@ public bool StartDeepstack(bool ForceRestart = false)
Global.ClsProcess prc = new Global.ClsProcess();
prc.process.StartInfo.FileName = this.DeepStackEXE;
prc.process.StartInfo.WorkingDirectory = Path.GetDirectoryName(this.DeepStackEXE);
prc.process.StartInfo.Arguments = $"--MODELSTORE-DETECTION \"{cpaths[i].Replace("\\", "/")}\" --PORT {cports[i]} --MODE {cmodes[i].ToUpper()}";
string mode = cmodes.GetStrAtIndex(i).ToLower().UpperFirst(); //mode appears to be case sensitive in the Sept 21 version of deepstack
if (mode.IsNotNull())
mode = "--MODE " + mode + " ";

prc.process.StartInfo.Arguments = $"--MODELSTORE-DETECTION \"{cpaths[i].Replace("\\", "/")}\" {mode}--PORT {cports[i]}";

if (!AppSettings.Settings.deepstack_debug)
{
Expand Down
Binary file not shown.
4 changes: 2 additions & 2 deletions src/UI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.1.0")]
[assembly: AssemblyFileVersion("2.1.1.0")]
[assembly: AssemblyVersion("2.1.2.0")]
[assembly: AssemblyFileVersion("2.1.2.0")]
4 changes: 2 additions & 2 deletions src/UI/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class ClsSettings
public string deepstack_customModelPath = "";
public string deepstack_customModelName = "";
public string deepstack_customModelPort = "82";
public string deepstack_customModelMode = "Medium";
public string deepstack_customModelMode = "Medium"; //might be case sensitive
public bool deepstack_stopbeforestart = true;
public bool deepstack_urls_are_queued = true;
public bool deepstack_autostart = false;
Expand Down Expand Up @@ -174,7 +174,7 @@ public class ClsSettings
public string SightHoundAPIKey = ""; //https://accounts.sighthound.com/#/sighthound-cloud

public int ActionCancelSeconds = 30;
public int ActionDelayMS = 500;
public int ActionDelayMS = 250;

public bool MinimizeToTray = true;

Expand Down
17 changes: 13 additions & 4 deletions src/UI/Shell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2414,7 +2414,7 @@ private string AddCamera(Camera cam) //, int history_mins, int mask_create_count
if (BlueIrisInfo.Result == BlueIrisResult.Valid)
{
//http://10.0.1.99:81/admin?trigger&camera=BACKFOSCAM&user=AITools&pw=haha&memo=[summary]
cam.trigger_urls_as_string = "[BlueIrisURL]/admin?trigger&camera=[camera]&user=[Username]&pw=[Password]&flagalert=1&memo=[summary]&jpeg=[ImagePathEscaped]";
cam.trigger_urls_as_string = "[BlueIrisURL]/admin?camera=[camera]&trigger&user=[Username]&pw=[Password]&flagalert=2&memo=[summary]&jpeg=[ImagePathEscaped]";
}

//I dont think this is used anywhere
Expand Down Expand Up @@ -2719,10 +2719,10 @@ private void CameraSave(bool SaveTo)
return;
}

if (cam.input_path.TrimEnd("\\".ToCharArray()).EqualsIgnoreCase(cam.Action_network_folder.TrimEnd("\\".ToCharArray())))
if (cam.input_path.IsNotNull() && cam.Action_network_folder.IsNotNull() && cam.input_path.TrimEnd("\\".ToCharArray()).EqualsIgnoreCase(cam.Action_network_folder.TrimEnd("\\".ToCharArray())))
{
//You dont want to watch, then copy the same file back to the same folder
MessageBox.Show($"WARNING: Input path ({cam.input_path}) & 'Copy alert images to folder' path may not be the same.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show($"WARNING: Input path ({cam.input_path}) & 'Copy alert images to folder' path may not be the same for camera '{cam.Name}'", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
this.DisplayCameraSettings(); //reset displayed settings
return;
}
Expand Down Expand Up @@ -5308,7 +5308,16 @@ private void Btn_ViewLog_Click(object sender, EventArgs e)
if (File.Exists(errfile))
{
if (new FileInfo(errfile).Length > 4)
Process.Start(errfile);
{
try
{
Process.Start(errfile);
}
catch (Exception)
{
MessageBox.Show("Error: Please correct the WINDOWS File Association for .TXT files.");
}
}
else
MessageBox.Show("File has no lines " + errfile);
}
Expand Down

0 comments on commit 2174054

Please sign in to comment.