mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-10 10:48:31 +02:00
Update list-nina-warnings.ps1
This commit is contained in:
parent
1c92a03ad5
commit
d796331f19
@ -3,6 +3,8 @@
|
||||
Lists the current NINA warnings
|
||||
.DESCRIPTION
|
||||
This PowerShell script queries the current NINA warnings and lists it.
|
||||
.PARAMETER ARS
|
||||
Specifies the official regional key in Germany ("Amtlicher Regionalschlüssel", e.g. 09777, none by default)
|
||||
.EXAMPLE
|
||||
PS> ./list-nina-warnings.ps1
|
||||
|
||||
@ -14,6 +16,8 @@
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
param([string]$ARS = "")
|
||||
|
||||
function ListWarningsOf([string]$source, [string]$URL)
|
||||
{
|
||||
Write-Progress "Loading NINA - $source warnings..."
|
||||
@ -28,19 +32,24 @@ function ListWarningsOf([string]$source, [string]$URL)
|
||||
$severity = $warning.severity
|
||||
$urgency = $warning.urgency
|
||||
$type = $warning.type
|
||||
Write-Output "⚠️ $title"
|
||||
Write-Output " 🕘 $($startDate)...$expiresDate (by $source, $type, $severity, $urgency)"
|
||||
Write-Output ""
|
||||
Write-Output "⚠️ $title"
|
||||
if ("$type" -ne "") {
|
||||
Write-Output " 🕘 $($startDate)...$expiresDate (by $source, $type, $severity, $urgency)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Write-Output ""
|
||||
ListWarningsOf "Katwarn" "https://warnung.bund.de/api31/katwarn/mapData.json"
|
||||
ListWarningsOf "DWD" "https://warnung.bund.de/api31/dwd/mapData.json"
|
||||
ListWarningsOf "Police" "https://warnung.bund.de/api31/police/mapData.json"
|
||||
ListWarningsOf "LHP" "https://warnung.bund.de/api31/lhp/mapData.json"
|
||||
ListWarningsOf "Biwapp" "https://warnung.bund.de/api31/biwapp/mapData.json"
|
||||
if ("$ARS" -ne "") {
|
||||
ListWarningsOf "Region" "https://warnung.bund.de/api31/dashboard/$($ARS)0000000.json"
|
||||
} else {
|
||||
ListWarningsOf "Katwarn" "https://warnung.bund.de/api31/katwarn/mapData.json"
|
||||
ListWarningsOf "DWD" "https://warnung.bund.de/api31/dwd/mapData.json"
|
||||
ListWarningsOf "Police" "https://warnung.bund.de/api31/police/mapData.json"
|
||||
ListWarningsOf "LHP" "https://warnung.bund.de/api31/lhp/mapData.json"
|
||||
ListWarningsOf "Biwapp" "https://warnung.bund.de/api31/biwapp/mapData.json"
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
Loading…
Reference in New Issue
Block a user