User:Zaz/FeedDumHostTests/script: Difference between revisions
From LoadingReadyWiki
Jump to navigationJump to search
Created page with "The powershell script that created User:Zaz/FeedDumHostTests <pre>curl "http://wiki.loadingreadyrun.com/index.php?title=Feed_Dump&action=edit" -o tmp.txt $datatable = (gc..." |
mNo edit summary |
||
| Line 12: | Line 12: | ||
| Add-Member -PassThru -MemberType NoteProperty -Name Name -Value $name ` | | Add-Member -PassThru -MemberType NoteProperty -Name Name -Value $name ` | ||
| Add-Member -PassThru -MemberType NoteProperty -Name CoHosts -Value $cohosts ` | | 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 | | Add-Member -PassThru -MemberType NoteProperty -Name Host -Value $h | ||
| Line 26: | Line 27: | ||
$hostlist | %{ | $hostlist | %{ | ||
$outstr += "|| " | $outstr += "|| " | ||
if( $episode. | if( $episode.AllHosts -ne $null -and $episode.AllHosts.contains($_) ) | ||
{ | { | ||
$outstr += "Yes " | $outstr += "Yes " | ||
Latest revision as of 19:11, 11 May 2015
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