Initial upload: immich-tv-viewer
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
param(
|
||||
[string]$Server = "http://192.168.1.29:2283",
|
||||
[int]$Pages = 4,
|
||||
[int]$Size = 100
|
||||
)
|
||||
|
||||
if (-not $env:IMMICH_KEY -and -not $IMMICH_KEY) {
|
||||
Write-Host "ERREUR: définis d'abord la clé API :" -ForegroundColor Red
|
||||
Write-Host '$env:IMMICH_KEY = "TA_CLE_API"'
|
||||
exit 1
|
||||
}
|
||||
|
||||
$key = if ($env:IMMICH_KEY) { $env:IMMICH_KEY } else { $IMMICH_KEY }
|
||||
|
||||
$rows = @()
|
||||
|
||||
for ($page = 1; $page -le $Pages; $page++) {
|
||||
Write-Host "Lecture people page $page..." -ForegroundColor Yellow
|
||||
|
||||
$peopleResult = Invoke-RestMethod `
|
||||
-Uri "$Server/api/people?page=$page&size=$Size&withHidden=false" `
|
||||
-Headers @{ "x-api-key" = $key } `
|
||||
-Method GET
|
||||
|
||||
foreach ($p in $peopleResult.people) {
|
||||
$body = @{
|
||||
personIds = @($p.id)
|
||||
type = "IMAGE"
|
||||
size = 1
|
||||
page = 1
|
||||
order = "desc"
|
||||
withArchived = $true
|
||||
withDeleted = $false
|
||||
withPeople = $true
|
||||
withStacked = $true
|
||||
} | ConvertTo-Json
|
||||
|
||||
try {
|
||||
$result = Invoke-RestMethod `
|
||||
-Uri "$Server/api/search/metadata" `
|
||||
-Headers @{ "x-api-key" = $key } `
|
||||
-Method POST `
|
||||
-ContentType "application/json" `
|
||||
-Body $body
|
||||
|
||||
$items = @()
|
||||
if ($result.assets -and $result.assets.items) {
|
||||
$items = @($result.assets.items)
|
||||
} elseif ($result.items) {
|
||||
$items = @($result.items)
|
||||
}
|
||||
|
||||
$rows += [PSCustomObject]@{
|
||||
PersonId = $p.id
|
||||
ShortId = $p.id.Substring(0,8)
|
||||
Name = if ($p.name) { $p.name } else { "(sans nom)" }
|
||||
HasImage = $items.Count -gt 0
|
||||
FirstAssetId = if ($items.Count -gt 0) { $items[0].id } else { "" }
|
||||
FirstFile = if ($items.Count -gt 0) { $items[0].originalFileName } else { "" }
|
||||
}
|
||||
} catch {
|
||||
$rows += [PSCustomObject]@{
|
||||
PersonId = $p.id
|
||||
ShortId = $p.id.Substring(0,8)
|
||||
Name = if ($p.name) { $p.name } else { "(sans nom)" }
|
||||
HasImage = $false
|
||||
FirstAssetId = "ERREUR"
|
||||
FirstFile = $_.Exception.Message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($peopleResult.hasNextPage -ne $true) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
$rows | Export-Csv -NoTypeInformation -Encoding UTF8 "immich_people_photo_debug.csv"
|
||||
$rows | Format-Table -AutoSize
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "CSV créé : immich_people_photo_debug.csv" -ForegroundColor Green
|
||||
Write-Host "Personnes avec photo : $(@($rows | Where-Object HasImage).Count)"
|
||||
Write-Host "Personnes sans photo : $(@($rows | Where-Object { -not $_.HasImage }).Count)"
|
||||
Reference in New Issue
Block a user