Merge pull request 'Use service ids to map to mux names' (#12) from prpr/webif:master into master

Reviewed-on: hummypkg/webif#12
This commit is contained in:
af123 2020-10-16 13:18:00 +00:00
commit c428a367a1
1 changed files with 21 additions and 7 deletions

View File

@ -19,6 +19,19 @@ proc f2c {frequency} {
return [expr int($ch)]
}
proc svc2mux {svcid mux} {
return [switch $($svcid / 4096) {
1 { format "PSB1/BBC A" }
2 { format "PSB2/D3&4" }
4 { format "PSB3/BBC B" }
3 { format "COM4/SDN" }
5 { format "COM5/ARQ A" }
6 { format "COM6/ARQ B" }
10 { format "COM7/ARQ C" }
default { format $mux }
}]
}
puts "
<div class=va>
<img class=va src=/img/aerials.png height=50>
@ -61,7 +74,7 @@ foreach tw [$db query {
puts "<td>[system strip $netName]</td>"
set channels [$db query {
select usLcn, szSvcName, szPrvName, aucDefaultAuthority
select usLcn, szSvcName, usSvcId, szPrvName, aucDefaultAuthority
from TBL_SVC left join TBL_PRV using (prvIdx)
where tsIdx = %s
order by usLcn
@ -72,14 +85,15 @@ foreach tw [$db query {
} else {
set mux "Unknown"
}
if {[llength $channels] != 0} {
set chan [lindex $channels 0]
lassign $chan x lcn x name x svcid
set mux [svc2mux $svcid $mux]
}
set ehs 0
foreach chan $channels {
lassign $chan x lcn x name
set name [system strip $name]
lassign $chan x lcn
if {$lcn >= 800} { incr ehs }
if {[dict exists $::muxdb $name]} {
set mux $::muxdb($name)
}
}
puts "<td>$mux</td>"
if {$eSystem == 0} {
@ -106,7 +120,7 @@ foreach tw [$db query {
</tr>"
altrow reset
foreach chan $channels {
lassign $chan x lcn x name x prv x auth
lassign $chan x lcn x name x svcid x prv x auth
set name [system strip $name]
set prv [system strip $prv]
altrow