# Zeilen pro Seite
$cpp = 35
# Unsortierte Liste drucken
$pu = 1
# eigene Sortierung drucken
$ps = 0
# Favoriten drucken
$pf = 0
$allChannels = '{"counttotal":"306","channellist":[{"contentId":...'
$allChannelCustom = '{"retcode":"0","retmsg":"getCustomChanNo success","customChanNo":[{"key":...'
$fav = '{"retcode":"0","favoritelist":[{"id"...'
$c = ConvertFrom-Json $allChannels
$o = ConvertFrom-Json $allChannelCustom
$f = ConvertFrom-Json $fav
$cl = @{}
$ccp = @{}
foreach($ch in $c.channellist) {
$cl.Add($ch.contentId, $ch)
}
"
"
# unsortierte Liste
if($pu) {
$i = 0
""
foreach($ch in ($c.channellist | Sort-Object {[int]$_.chanNo})) {
if($i % $cpp -eq 0 -and $i -gt 0) {
" | "
if($i % ($cpp*2) -eq 0) {
"
"
}
""
}
"{1} | " -f $(if($i % 2 -eq 0) {"#ffffff"} else {"#dcdcdc"}) ,$ch.chanNo
if($($ch.pictures | where { $_.imageType -eq 15 })) {
$url = $ch.pictures | where { $_.imageType -eq 15 } | foreach { $_.href }
" " -f $url.Substring($url.LastIndexOf('/')+1)
}
" | {0} | " -f $ch.name
$i++
}
" |
"
}
# sortierte Liste
if($ps) {
""
foreach($ch in ($o.customChanNo | Where { [int]$_.value -gt 0 } | Sort-Object {[int]$_.value})) {
$ccp.Add($ch.key, $ch.value)
if($i % $cpp -eq 0 -and $i -gt 0) {
" | "
if($i % ($cpp*2) -eq 0) {
"
"
}
""
}
"{1} | " -f $(if($i % 2 -eq 0) {"#ffffff"} else {"#dcdcdc"}) ,$ch.value
if($($cl[$ch.key].pictures | where { $_.imageType -eq 15 })) {
$url = $cl[$ch.key].pictures | where { $_.imageType -eq 15 } | foreach { $_.href }
" " -f $url.Substring($url.LastIndexOf('/')+1)
}
" | {0} | " -f $cl[$ch.key].name
$i++
}
" |
"
}
#Favoriten
if($pf) {
$i = 0
""
foreach($ch in ($f.favoritelist | Where { [int]$_.id -gt 0 } | Sort-Object {$ccp[$_.id]})) {
if($i % $cpp -eq 0 -and $i -gt 0) {
" | "
if($i % ($cpp*2) -eq 0) {
"
"
}
""
}
"{1} | " -f $(if($i % 2 -eq 0) {"#ffffff"} else {"#dcdcdc"}) ,$ccp[$ch.id]
if($($cl[$ch.id].pictures | where { $_.imageType -eq 15 })) {
$url = $cl[$ch.id].pictures | where { $_.imageType -eq 15 } | foreach { $_.href }
" " -f $url.Substring($url.LastIndexOf('/')+1)
}
" | {0} | " -f $cl[$ch.id].name
$i++
}
" |
"
}
# Auszug bestimmter Sender aus sortierter Liste
#""
#foreach($ch in ($o.customChanNo | Sort-Object {[int]$_.value})) {
# if([int]$ch.value -lt 101 -or [int]$ch.value -gt 160) { continue }
# if($i % $cpp -eq 0 -and $i -gt 0) {
# " | "
# if($i % ($cpp*2) -eq 0) {
# "
"
# }
# ""
# }
# "{1} | " -f $(if($i % 2 -eq 0) {"#ffffff"} else {"#dcdcdc"}) ,$ch.value
# if($($cl[$ch.key].pictures | where { $_.imageType -eq 15 })) {
# $url = $cl[$ch.key].pictures | where { $_.imageType -eq 15 } | foreach { $_.href }
# " " -f $url.Substring($url.LastIndexOf('/')+1)
# }
# " | {0} | " -f $cl[$ch.key].name
# $i++
#}
#" |
"
""