Skip to content

Commit d7c2242

Browse files
committed
Release 1.226.2025
1 parent 42eb3bf commit d7c2242

35 files changed

Lines changed: 521 additions & 583 deletions

Functions/GenXdev.AI.DeepStack/Get-ImageDetectedFaces.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ function Get-ImageDetectedFaces {
245245
# create form data for DeepStack API (it expects multipart form
246246
# data, not JSON)
247247
$form = @{
248-
image = Microsoft.PowerShell.Management\Get-Item $imagePath
248+
image = Microsoft.PowerShell.Management\Get-Item -LiteralPath $imagePath
249249
}
250250

251251
# send the request to the DeepStack face recognition API

Functions/GenXdev.AI.DeepStack/Get-ImageDetectedObjects.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ function Get-ImageDetectedObjects {
364364

365365
# the 'min_confidence' parameter expects a value between 0.0 and 1.0
366366
$form = @{
367-
image = Microsoft.PowerShell.Management\Get-Item $imagePath
367+
image = Microsoft.PowerShell.Management\Get-Item -LiteralPath $imagePath
368368
min_confidence = $ConfidenceThreshold
369369
}
370370

Functions/GenXdev.AI.DeepStack/Get-ImageDetectedScenes.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ function Get-ImageDetectedScenes {
377377

378378
# create form data for deepstack api (it expects multipart form data)
379379
$form = @{
380-
image = Microsoft.PowerShell.Management\Get-Item $imagePath
380+
image = Microsoft.PowerShell.Management\Get-Item -LiteralPath $imagePath
381381
}
382382

383383
# send the request to the deepstack scene recognition api

Functions/GenXdev.AI.DeepStack/Invoke-ImageEnhancement.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ function Invoke-ImageEnhancement {
286286
-Parent
287287

288288
if (-not (Microsoft.PowerShell.Management\Test-Path `
289-
$outputDir)) {
289+
-LiteralPath $outputDir)) {
290290

291291
$null = Microsoft.PowerShell.Management\New-Item `
292292
-Path $outputDir `
@@ -343,7 +343,7 @@ function Invoke-ImageEnhancement {
343343

344344
# create form data for DeepStack API (it expects multipart form data)
345345
$form = @{
346-
image = Microsoft.PowerShell.Management\Get-Item $imagePath
346+
image = Microsoft.PowerShell.Management\Get-Item -LiteralPath $imagePath
347347
}
348348

349349
# send the request to the DeepStack image enhancement API

Functions/GenXdev.AI.DeepStack/Register-AllFaces.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ function Register-AllFaces {
221221
$script:SkippedRegistrations = 0
222222

223223
# validate that the faces directory exists before proceeding
224-
if (-not (Microsoft.PowerShell.Management\Test-Path $FacesDirectory `
224+
if (-not (Microsoft.PowerShell.Management\Test-Path -LiteralPath $FacesDirectory `
225225
-PathType Container)) {
226226

227227
throw "Faces directory does not exist: $FacesDirectory"
@@ -418,7 +418,7 @@ function Register-AllFaces {
418418

419419
# rename the failed image file
420420
Microsoft.PowerShell.Management\Rename-Item `
421-
-Path $imagePath `
421+
-LiteralPath $imagePath `
422422
-NewName $newPath `
423423
-ErrorAction Stop
424424

@@ -509,7 +509,7 @@ function Register-AllFaces {
509509

510510
# get all image files in the person's directory excluding failed files
511511
$imageFiles = Microsoft.PowerShell.Management\Get-ChildItem `
512-
-Path $PersonDirectory.FullName `
512+
-LiteralPath $PersonDirectory.FullName `
513513
-File |
514514
Microsoft.PowerShell.Core\Where-Object {
515515
$_.Extension -match '\.(jpg|jpeg|png|gif)$' -and
@@ -620,10 +620,10 @@ function Register-AllFaces {
620620
try {
621621

622622
# change to the faces directory for processing
623-
Microsoft.PowerShell.Management\Set-Location -Path $FacesDirectory
623+
Microsoft.PowerShell.Management\Set-Location -LiteralPath $FacesDirectory
624624

625625
# get all person directories from the faces directory
626-
$personDirectories = @(Microsoft.PowerShell.Management\Get-ChildItem "$FacesDirectory\*" `
626+
$personDirectories = @(Microsoft.PowerShell.Management\Get-ChildItem -LiteralPath "$FacesDirectory" -Filter "*" `
627627
-Directory)
628628

629629
# check if any person directories were found
@@ -651,7 +651,7 @@ function Register-AllFaces {
651651
finally {
652652

653653
# restore original location regardless of success or failure
654-
Microsoft.PowerShell.Management\Set-Location -Path $originalLocation
654+
Microsoft.PowerShell.Management\Set-Location -LiteralPath $originalLocation
655655
}
656656

657657
# report final results to user

Functions/GenXdev.AI.DeepStack/Register-Face.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ function Register-Face {
271271

272272
# add image file to form data
273273
$form[$imageKey] = Microsoft.PowerShell.Management\Get-Item `
274-
$validatedImagePaths[$i]
274+
-LiteralPath $validatedImagePaths[$i]
275275
}
276276

277277
# send the http request to the deepstack face recognition api

Functions/GenXdev.AI.LMStudio/Get-LMStudioPaths.ps1

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ function Get-LMStudioPaths {
3838
'~\.cache\lm-studio\bin\lms.exe',
3939
"${env:LOCALAPPDATA}\LM-Studio\lms.exe",
4040
"${env:LOCALAPPDATA}\Programs\LM-Studio\lms.exe",
41-
"${env:LOCALAPPDATA}\Programs\LM Studio\lms.exe"
41+
"${env:LOCALAPPDATA}\Programs\LM Studio\lms.exe",
42+
"${env:LOCALAPPDATA}\Programs\LM Studio\resources\app\.webpack\lms.exe"
43+
4244
)
4345
}
4446

@@ -52,7 +54,7 @@ function Get-LMStudioPaths {
5254

5355
# find main LM Studio executable
5456
$script:LMStudioExe = Microsoft.PowerShell.Management\Get-ChildItem `
55-
-Path $searchPathsLMStudio `
57+
-LiteralPath $searchPathsLMStudio `
5658
-File `
5759
-Recurse `
5860
-ErrorAction SilentlyContinue |
@@ -61,7 +63,7 @@ function Get-LMStudioPaths {
6163

6264
# find LMS command-line executable
6365
$script:LMSExe = Microsoft.PowerShell.Management\Get-ChildItem `
64-
-Path $searchPathsLMSexe `
66+
-LiteralPath $searchPathsLMSexe `
6567
-File `
6668
-Recurse `
6769
-ErrorAction SilentlyContinue |

Functions/GenXdev.AI.Queries/Export-ImageIndex.ps1

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ Database path for preference data files.
6060
Don't use alternative settings stored in session for AI preferences like
6161
Language, Image collections, etc.
6262
63+
.PARAMETER FullScreen
64+
Open in fullscreen mode.
65+
6366
.PARAMETER ShowWindow
6467
Show LM Studio window during initialization.
6568
@@ -319,6 +322,13 @@ function Export-ImageIndex {
319322
[Alias('FromPreferences')]
320323
[switch] $SkipSession,
321324
###############################################################################
325+
[Parameter(
326+
Mandatory = $false,
327+
HelpMessage = 'Opens in fullscreen mode'
328+
)]
329+
[Alias('fs', 'f')]
330+
[switch] $FullScreen,
331+
###############################################################################
322332
[Parameter(
323333
Mandatory = $false,
324334
HelpMessage = ('Show LM Studio window during ' +
@@ -568,6 +578,15 @@ function Export-ImageIndex {
568578

569579
$ImageDirectories = GenXdev.AI\Get-AIImageCollection @params
570580

581+
# copy identical parameter values for Find-Image function call
582+
$findImageParams = GenXdev.Helpers\Copy-IdenticalParamValues `
583+
-BoundParameters $PSBoundParameters `
584+
-FunctionName 'GenXdev.AI\Find-Image' `
585+
-DefaultValues (
586+
Microsoft.PowerShell.Utility\Get-Variable -Scope Local `
587+
-ErrorAction SilentlyContinue
588+
)
589+
571590
# output that the image index database is being recreated
572591
Microsoft.PowerShell.Utility\Write-Host (
573592
"Recreating image index database`r`n" +
@@ -598,7 +617,7 @@ function Export-ImageIndex {
598617
}
599618

600619
# define schema version constant
601-
$SCHEMA_VERSION = '1.0.0.5'
620+
$SCHEMA_VERSION = '1.0.0.6'
602621

603622
# initialize info object for tracking found results
604623
$Info = @{
@@ -638,7 +657,17 @@ function Export-ImageIndex {
638657
) -CreateDirectory -DeleteExistingFile -ErrorAction SilentlyContinue
639658

640659
# define backup file path for database
641-
$DatabaseBackupFilePath = GenXdev.FileSystem\Expand-Path "${DatabaseFilePath}.backup.db" -DeleteExistingFile -CreateDirectory
660+
$DatabaseBackupFilePath = "";
661+
$idx = 0;
662+
while ($true) {
663+
try {
664+
$DatabaseBackupFilePath = GenXdev.FileSystem\Expand-Path "${DatabaseFilePath}.backup.$(($idx -gt 0 ? '.$idx' : ''))db" -DeleteExistingFile -CreateDirectory
665+
break;
666+
}
667+
catch {
668+
$idx++;
669+
}
670+
}
642671

643672
# check if the database file exists after expansion and handle backup
644673
if ([IO.File]::Exists($DatabaseFilePath)) {
@@ -732,7 +761,6 @@ CREATE TABLE IF NOT EXISTS Images (
732761
scene_label TEXT,
733762
scene_confidence REAL,
734763
scene_confidence_percentage REAL,
735-
scene_processed_at DATETIME,
736764
737765
-- Camera metadata
738766
camera_make TEXT,
@@ -1005,13 +1033,13 @@ CREATE INDEX IF NOT EXISTS idx_images_scene_confidence_range ON Images(scene_con
10051033
$totalTime = [System.Diagnostics.Stopwatch]::StartNew()
10061034

10071035
# always delete existing database file to ensure clean rebuild
1008-
if (Microsoft.PowerShell.Management\Test-Path $DatabaseFilePath) {
1036+
if (Microsoft.PowerShell.Management\Test-Path -LiteralPath $DatabaseFilePath) {
10091037

10101038
Microsoft.PowerShell.Utility\Write-Verbose (
10111039
'Deleting existing database file for clean rebuild...'
10121040
)
10131041

1014-
Microsoft.PowerShell.Management\Remove-Item $DatabaseFilePath -Force
1042+
Microsoft.PowerShell.Management\Remove-Item -LiteralPath $DatabaseFilePath -Force
10151043
}
10161044

10171045
# create new database using specialized function
@@ -1059,7 +1087,7 @@ CREATE INDEX IF NOT EXISTS idx_images_scene_confidence_range ON Images(scene_con
10591087
'style_type, description_keywords, people_count, people_faces, ' +
10601088
'people_json, objects_count, objects_list, objects_json, ' +
10611089
'object_counts, scene_label, scene_confidence, ' +
1062-
'scene_confidence_percentage, scene_processed_at, camera_make, ' +
1090+
'scene_confidence_percentage, camera_make, ' +
10631091
'camera_model, software, gps_latitude, gps_longitude, ' +
10641092
'gps_altitude, exposure_time, f_number, iso_speed, focal_length, ' +
10651093
'flash, date_time_original, date_time_digitized, color_space, ' +
@@ -1070,7 +1098,7 @@ CREATE INDEX IF NOT EXISTS idx_images_scene_confidence_range ON Images(scene_con
10701098
'@desc_keywords, @people_count, @people_faces, @people_json, ' +
10711099
'@objects_count, @objects_list, @objects_json, @object_counts, ' +
10721100
'@scene_label, @scene_confidence, @scene_conf_pct, ' +
1073-
'@scene_processed, @camera_make, @camera_model, @software, ' +
1101+
'@camera_make, @camera_model, @software, ' +
10741102
'@gps_latitude, @gps_longitude, @gps_altitude, @exposure_time, ' +
10751103
'@f_number, @iso_speed, @focal_length, @flash, ' +
10761104
'@date_time_original, @date_time_digitized, @color_space, ' +
@@ -1085,7 +1113,7 @@ CREATE INDEX IF NOT EXISTS idx_images_scene_confidence_range ON Images(scene_con
10851113
'people_count, people_faces, people_json, objects_count, ' +
10861114
'objects_list, objects_json, object_counts, scene_label, ' +
10871115
'scene_confidence, scene_confidence_percentage, ' +
1088-
'scene_processed_at, camera_make, camera_model, software, ' +
1116+
'camera_make, camera_model, software, ' +
10891117
'gps_latitude, gps_longitude, gps_altitude, exposure_time, ' +
10901118
'f_number, iso_speed, focal_length, flash, date_time_original, ' +
10911119
'date_time_digitized, color_space, bits_per_sample, artist, ' +
@@ -1095,7 +1123,7 @@ CREATE INDEX IF NOT EXISTS idx_images_scene_confidence_range ON Images(scene_con
10951123
'@style, @desc_keywords, @people_count, @people_faces, ' +
10961124
'@people_json, @objects_count, @objects_list, @objects_json, ' +
10971125
'@object_counts, @scene_label, @scene_confidence, ' +
1098-
'@scene_conf_pct, @scene_processed, @camera_make, @camera_model, ' +
1126+
'@scene_conf_pct, @camera_make, @camera_model, ' +
10991127
'@software, @gps_latitude, @gps_longitude, @gps_altitude, ' +
11001128
'@exposure_time, @f_number, @iso_speed, @focal_length, @flash, ' +
11011129
'@date_time_original, @date_time_digitized, @color_space, ' +
@@ -1111,26 +1139,6 @@ CREATE INDEX IF NOT EXISTS idx_images_scene_confidence_range ON Images(scene_con
11111139
$Info.FoundResults = $true
11121140

11131141

1114-
# set image directories for Find-Image from configured sources
1115-
$imageCollectionParams = GenXdev.Helpers\Copy-IdenticalParamValues `
1116-
-BoundParameters $PSBoundParameters `
1117-
-FunctionName 'GenXdev.AI\Get-AIImageCollection' `
1118-
-DefaultValues (
1119-
Microsoft.PowerShell.Utility\Get-Variable -Scope Local `
1120-
-ErrorAction SilentlyContinue
1121-
)
1122-
1123-
# copy identical parameter values for Find-Image function call
1124-
$findImageParams = GenXdev.Helpers\Copy-IdenticalParamValues `
1125-
-BoundParameters $PSBoundParameters `
1126-
-FunctionName 'GenXdev.AI\Find-Image' `
1127-
-DefaultValues (
1128-
Microsoft.PowerShell.Utility\Get-Variable -Scope Local `
1129-
-ErrorAction SilentlyContinue
1130-
)
1131-
1132-
$findImageParams.ImageDirectories = `
1133-
GenXdev.AI\Get-AIImageCollection @imageCollectionParams
11341142

11351143
# prepare lookup table inserts using strongly typed collections
11361144
[System.Collections.Generic.List[String]] $lookupQueries = `
@@ -1258,9 +1266,6 @@ CREATE INDEX IF NOT EXISTS idx_images_scene_confidence_range ON Images(scene_con
12581266
'scene_conf_pct' = if ($image.scenes) {
12591267
$image.scenes.confidence_percentage }
12601268
else { 0 }
1261-
'scene_processed' = if ($image.scenes) {
1262-
$image.scenes.processed_at }
1263-
else { '' }
12641269

12651270
# Camera metadata
12661271
'camera_make' = if ($image.metadata -and
@@ -1375,7 +1380,7 @@ CREATE INDEX IF NOT EXISTS idx_images_scene_confidence_range ON Images(scene_con
13751380

13761381
# check if image file exists before reading binary data
13771382
if (Microsoft.PowerShell.Management\Test-Path `
1378-
$image.path -PathType Leaf) {
1383+
-LiteralPath $image.path -PathType Leaf) {
13791384

13801385
Microsoft.PowerShell.Utility\Write-Verbose (
13811386
"Reading image data from: $($image.path)"

0 commit comments

Comments
 (0)