Skip to content

Commit cfa87db

Browse files
Add NDI.NDIRuntime (#93)
Co-authored-by: SpecterShell <56779163+SpecterShell@users.noreply.github.com>
1 parent 7b179c1 commit cfa87db

2 files changed

Lines changed: 48 additions & 0 deletions

File tree

Tasks/NDI.NDIRuntime/Config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Type: PackageTask
2+
WinGetIdentifier: NDI.NDIRuntime
3+
Skip: false

Tasks/NDI.NDIRuntime/Script.ps1

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
$Object1 = Invoke-RestMethod -Uri 'https://downloads.ndi.tv/Tools/ndi_tools_win_current_version.json'
2+
3+
# Version
4+
$this.CurrentState.Version = $Object1.version
5+
6+
# Installer
7+
$this.CurrentState.Installer += [ordered]@{
8+
InstallerUrl = "https://downloads.ndi.tv/SDK/NDI_SDK/NDI $($this.CurrentState.Version.Split('.')[0]) Runtime.exe"
9+
}
10+
11+
switch -Regex ($this.Check()) {
12+
'New|Changed|Updated' {
13+
try {
14+
$Object2 = Invoke-WebRequest -Uri 'https://docs.ndi.video/all/using-ndi/ndi-tools/release-notes' | ConvertFrom-Html
15+
16+
$ReleaseNotesTitleNode = $Object2.SelectSingleNode("//h2[contains(., '$($this.CurrentState.Version.Split('.')[0..2] -join '.')')]")
17+
if ($ReleaseNotesTitleNode) {
18+
# Remove pseudo nodes
19+
$Object2.SelectNodes("//li/div[contains(.//@style, `"pseudoBefore`")]").ForEach({ $_.Remove() })
20+
21+
# ReleaseNotes (en-US)
22+
$ReleaseNotesNodes = for ($Node = $ReleaseNotesTitleNode.NextSibling; $Node -and $Node.Name -ne 'h2'; $Node = $Node.NextSibling) { $Node }
23+
$this.CurrentState.Locale += [ordered]@{
24+
Locale = 'en-US'
25+
Key = 'ReleaseNotes'
26+
Value = $ReleaseNotesNodes | Get-TextContent | Format-Text
27+
}
28+
} else {
29+
$this.Log("No ReleaseNotes (en-US) for version $($this.CurrentState.Version)", 'Warning')
30+
}
31+
} catch {
32+
$_ | Out-Host
33+
$this.Log($_, 'Warning')
34+
}
35+
36+
$this.Print()
37+
$this.Write()
38+
}
39+
'Changed|Updated' {
40+
$this.Message()
41+
}
42+
'Updated' {
43+
$this.Submit()
44+
}
45+
}

0 commit comments

Comments
 (0)