User:Zaz/FeedDumHostTests/script
From LoadingReadyWiki
Jump to navigationJump to search
The powershell script that created User:Zaz/FeedDumHostTests
curl "http://wiki.loadingreadyrun.com/index.php?title=Feed_Dump&action=edit" -o tmp.txt
$datatable = (gc tmp.txt -encoding UTF8) | ?{ $_.startswith("| ")} | ?{ !$_.startswith("| style") } | %{
$spl = $_ -split "\|\|"
$number = $spl[0].substring(2).trim()
$name = $spl[1].substring(26).trim()
$h = $spl[2].trim()
$cohosts = $spl[3].trim() -split "\[\[" | select -skip 1 | %{ $_ -split "\]\]|\|" | select -first 1 }
New-Object psobject | Add-Member -PassThru -MemberType NoteProperty -Name Number -Value $number `
| Add-Member -PassThru -MemberType NoteProperty -Name Name -Value $name `
| Add-Member -PassThru -MemberType NoteProperty -Name CoHosts -Value $cohosts `
| Add-Member -PassThru -MemberType NoteProperty -Name AllHosts -Value ($h+$cohosts) `
| Add-Member -PassThru -MemberType NoteProperty -Name Host -Value $h
}
$hostlist = $datatable.cohosts | select -unique | sort
$outstr = "{| class=""wikitable sortable collapsible"" border=""1"" style=""height: 200px;""`r`n"
$outstr += "|+ Feed dump hosts`r`n!| #`r`n!| Title`r`n"
$hostlist | %{ $outstr += "!scope=""col"" width=""50""| [[$($_)]]`r`n" }
$datatable| %{
$episode = $_
$outstr += "|-`r`n! $($episode.Number)`r`n! $($episode.Name)`r`n"
$hostlist | %{
$outstr += "|| "
if( $episode.AllHosts -ne $null -and $episode.AllHosts.contains($_) )
{
$outstr += "Yes "
}
}
$outstr += "`r`n"
}
$outstr += "|}"
$outstr | sc "output.txt" -encoding UTF8