Initial commit with design and layout files
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
<#
|
||||
Downloadt alle afbeeldingen uit assets/img/manifest.txt naar assets/img/.
|
||||
Gebruik: powershell -ExecutionPolicy Bypass -File scripts\download-images.ps1
|
||||
Opnieuw draaien is veilig; gebruik -Force om bestaande bestanden te overschrijven.
|
||||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[switch]$Force
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# Windows PowerShell 5.1 onderhandelt standaard nog TLS 1.0/1.1; veel servers
|
||||
# weigeren dat inmiddels. En de voortgangsbalk van Invoke-WebRequest maakt
|
||||
# downloads in 5.1 tot tientallen keren trager, dus die zetten we uit.
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$rootDir = Split-Path -Parent $scriptDir
|
||||
$imgDir = Join-Path $rootDir 'assets\img'
|
||||
$manifest = Join-Path $imgDir 'manifest.txt'
|
||||
|
||||
if (-not (Test-Path $manifest)) {
|
||||
Write-Error "Manifest niet gevonden: $manifest"
|
||||
}
|
||||
|
||||
$ok = 0; $skipped = 0; $failed = 0
|
||||
|
||||
foreach ($line in Get-Content $manifest) {
|
||||
$trimmed = $line.Trim()
|
||||
if ($trimmed -eq '' -or $trimmed.StartsWith('#')) { continue }
|
||||
|
||||
$parts = $trimmed -split '\s+', 2
|
||||
if ($parts.Count -lt 2) { continue }
|
||||
|
||||
$name = $parts[0]
|
||||
$url = $parts[1]
|
||||
$target = Join-Path $imgDir $name
|
||||
|
||||
if ((Test-Path $target) -and (-not $Force)) {
|
||||
Write-Host " overslaan $name"
|
||||
$skipped++
|
||||
continue
|
||||
}
|
||||
|
||||
Write-Host " ophalen $name ... " -NoNewline
|
||||
try {
|
||||
Invoke-WebRequest -Uri $url -OutFile $target -UseBasicParsing -TimeoutSec 30
|
||||
Write-Host 'ok'
|
||||
$ok++
|
||||
}
|
||||
catch {
|
||||
Write-Host "MISLUKT ($url)"
|
||||
if (Test-Path $target) { Remove-Item $target -Force }
|
||||
$failed++
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host ''
|
||||
Write-Host "Klaar: $ok gedownload, $skipped overgeslagen, $failed mislukt."
|
||||
if ($failed -gt 0) { exit 1 }
|
||||
Reference in New Issue
Block a user