Skip to content

Commit

Permalink
DOCS: Create New-MiyooGameListXml.ps1 (OnionUI#927)
Browse files Browse the repository at this point in the history
* Create Create-MiyooGameListXml.ps1

Added simple PowerShell script to remove dependency on 3rd party tool XMLStarlet. This version takes less space and is presumably more efficient since it's not indented at the cost of human readability.

* Rename Create-MiyooGameListXml.ps1 to New-MiyooGameListXml.ps1

Changed the verb from 'Create' to 'New' to follow established PowerShell standards.
  • Loading branch information
tobio-tenma authored Jul 4, 2023
1 parent ef0beda commit 44dc06c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions files/20230617/New-MiyooGameListXml.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[xml]$xml = Get-Content 'gamelist.xml'

$nodesToDelete = @('desc', 'rating', 'genre', 'players', 'releasedate', 'developer', 'publisher', 'hash', 'thumbnail', 'genreid')

foreach ($node in $nodesToDelete) {
$xml.SelectNodes("//$node") | ForEach-Object { $_.ParentNode.RemoveChild($_) }
}

$gamesWithoutImage = $xml.SelectNodes("//game[not(image)]")
foreach ($game in $gamesWithoutImage) {
$newImage = $xml.CreateElement('image')
$newImage.InnerText = 'no-img.png'
$game.AppendChild($newImage)
}

$xml.OuterXml | Set-Content 'miyoogamelist.xml'

0 comments on commit 44dc06c

Please sign in to comment.