Adjust whitespace and indentation to match project

This commit is contained in:
HummyPkg 2020-06-03 11:19:29 +01:00
parent cd9e9924f6
commit 022e6459fc
2 changed files with 129 additions and 122 deletions

View File

@ -186,7 +186,7 @@ epg method get_rsv {} {
} }
epg method process_sched {{debug 0}} { epg method process_sched {{debug 0}} {
$self scheduled $debug $self scheduled $debug
} }
set rsvlookup "" set rsvlookup ""
@ -198,19 +198,21 @@ epg method scheduled {{debug 0}} {
set sched_type 0 set sched_type 0
if {$rsvlookup eq ""} { if {$rsvlookup eq ""} {
set st [clock milliseconds] set st [clock milliseconds]
set rsvlookup [rsv lookuptab] set rsvlookup [rsv lookuptab]
if {$debug} {puts "mS $([clock milliseconds]-$st) --- $rsvlookup} if {$debug} {
puts "mS $([clock milliseconds] - $st) --- $rsvlookup"
}
} }
set p 0 set p 0
foreach key [list \ foreach key [list \
"$service_id:$event_id" \ "$service_id:$event_id" \
"$channel_hsvc:$event_id" \ "$channel_hsvc:$event_id" \
[string tolower "$service_id:$channel_crid$series_crid"] \ [string tolower "$service_id:$channel_crid$series_crid"] \
[string tolower "$channel_crid$series_crid:$channel_crid$event_crid"] \ [string tolower "$channel_crid$series_crid:$channel_crid$event_crid"] \
] { ] {
if {$debug} {puts "Check key ($key)"} if {$debug} { puts "Check key ($key)" }
if {[dict exists $rsvlookup $key]} { if {[dict exists $rsvlookup $key]} {
set p $rsvlookup($key) set p $rsvlookup($key)
if {$debug} {puts "FOUND ($p)"} if {$debug} {puts "FOUND ($p)"}
@ -226,30 +228,29 @@ epg method scheduled {{debug 0}} {
default { set sched_type 0 } default { set sched_type 0 }
} }
if {$debug} {puts "SCHED_TYPE: ($sched_type)"} if {$debug} { puts "SCHED_TYPE: ($sched_type)" }
return $sched_type return $sched_type
} }
proc {epg update_lookup_tab} {svcid evtid {add true} {type "S"} } { proc {epg update_lookup_tab} {svcid evtid {add true} {type "S"}} {
global rsvlookup global rsvlookup
# Update the reservations look up table (if present) with single entry # Update the reservations look up table (if present) with single entry
if {$rsvlookup==""} {return} if {$rsvlookup == ""} return
set key $svcid:$evtid set key $svcid:$evtid
if {$add} { if {$add} {
# add new entry # add new entry
dict set rsvlookup $key $type dict set rsvlookup $key $type
} else { } else {
# remove existing entry # remove existing entry
if {[dict exists $rsvlookup $key]} { if {[dict exists $rsvlookup $key]} {
dict unset rsvlookup $key dict unset rsvlookup $key
} }
} }
#puts "$svcid:$evtid $add $type == $rsvlookup " #puts "$svcid:$evtid $add $type == $rsvlookup"
} }
epg method icon_set {{height 0}} { epg method icon_set {{height 0}} {
if {$height > 0} { set height "height=$height" } else { set height "" } if {$height > 0} { set height "height=$height" } else { set height "" }
set icon [$self type_icon] set icon [$self type_icon]
@ -502,7 +503,7 @@ proc {epg dbfetch} {mode args} {
lappend params "%$v%" lappend params "%$v%"
} }
append q ") " append q ") "
} }
-param { lappend params $v } -param { lappend params $v }
-nocase { append q "collate nocase " } -nocase { append q "collate nocase " }
default { error "Invalid option, $arg" } default { error "Invalid option, $arg" }
@ -567,3 +568,4 @@ proc {epg channellist} {{field usLcn}} {
return $channels return $channels
} }

View File

@ -312,9 +312,8 @@ rsv method iconset {{height 20}} {
return $iconlist return $iconlist
} }
# source /df
rsv method set {ivName val} { rsv method set {ivName val} {
set $ivName $val set $ivName $val
} }
rsv method setorigstart {o} { rsv method setorigstart {o} {
@ -346,77 +345,78 @@ rsv method set_refresh {} {
} }
rsv method update_aul {new_event old_aul} { rsv method update_aul {new_event old_aul} {
# Add new_event (optional) to the aulEventToRecordInfo and szEventToRecord # Add new_event (optional) to aulEventToRecordInfo and szEventToRecord
# remove old_aul (optional) from " " # remove old_aul (optional) from " "
# Maintain list in time order # Maintain list in time order
set curauls [$self aul] set curauls [$self aul]
set ecrids [split $szEventToRecord "|"] set ecrids [split $szEventToRecord "|"]
set evtaul {} set evtaul {}
set insert 1 set insert 1
set start 0 set start 0
# Do we have new event to add? # Do we have new event to add?
if {$new_event != 0 && $new_event !={}} { if {$new_event != 0 && $new_event !={}} {
set service_id [$new_event get channel_hsvc] set service_id [$new_event get channel_hsvc]
set start [$new_event get start] set start [$new_event get start]
set end [$new_event end] set end [$new_event end]
set evtid [$new_event get event_id] set evtid [$new_event get event_id]
set evtaul [list $service_id $start $end $evtid] set evtaul [list $service_id $start $end $evtid]
set evtcrid [string toupper "1[$new_event get channel_crid][$new_event get event_crid]"] set evtcrid [string toupper
set insert 0 "1[$new_event get channel_crid][$new_event get event_crid]"]
} set insert 0
# rebuild aul and events list with new event in correct order }
lmap aul $curauls ecrid $ecrids { # rebuild aul and events list with new event in correct order
#puts "$aul $ecrid" lmap aul $curauls ecrid $ecrids {
if {$aul == $old_aul} {continue; #remove current entry} #puts "$aul $ecrid"
if {$aul == ""} {continue; #null entry} if {$aul == $old_aul} {continue; #remove current entry}
if {!$insert && $start <= [lindex $aul 1]} { if {$aul == ""} {continue; #null entry}
set insert 1 if {!$insert && $start <= [lindex $aul 1]} {
lappend newaul $evtaul set insert 1
append newevnts "$evtcrid|" lappend newaul $evtaul
} append newevnts "$evtcrid|"
lappend newaul $aul }
append newevnts "$ecrid|" lappend newaul $aul
} append newevnts "$ecrid|"
# add to end if not inserted }
if {!$insert} { # add to end if not inserted
set insert 1 if {!$insert} {
lappend newaul $evtaul set insert 1
append newevnts "$evtcrid|" lappend newaul $evtaul
} append newevnts "$evtcrid|"
set action 5 }
$self setaul [$self buildaul $newaul] set action 5
set szEventToRecord $newevnts $self setaul [$self buildaul $newaul]
} set szEventToRecord $newevnts
}
rsv method set_next_event {} { rsv method set_next_event {} {
# Update reservation next event info in ucVolume # Update reservation next event info in ucVolume
if {[string length $aulEventToRecordInfo] >0} { if {[string length $aulEventToRecordInfo] >0} {
binary scan [string range $aulEventToRecordInfo 0 15]\ binary scan [string range $aulEventToRecordInfo 0 15] \
iiii service_id start end event_id iiii service_id start end event_id
set dur $($end-$start) set dur $($end-$start)
if {$hsvc != $service_id || if {$hsvc != $service_id ||
$nsttime != $start || $nsttime != $start ||
$nduration != $dur || $nduration != $dur ||
$usevtid != $event_id} { $usevtid != $event_id} {
set nduration $dur set nduration $dur
set ucVolume "$service_id:$event_id:$start" set ucVolume "$service_id:$event_id:$start"
} }
} else { } else {
# The next event is not yet in the EPG # The next event is not yet in the EPG
set time $([clock seconds] - 86400) set time $([clock seconds] - 86400)
set ucVolume "$hsvc:$usLastRecordedEvtId:$time" set ucVolume "$hsvc:$usLastRecordedEvtId:$time"
} }
} }
rsv method reset_next_event {} { rsv method reset_next_event {} {
# Ensure our copy matches the updated reservation # Ensure our copy matches the updated reservation
if {$ucVolume!=0} { if {$ucVolume != 0} {
lassign [split $ucVolume ":"] service_id event_id start lassign [split $ucVolume ":"] service_id event_id start
set hsvc $service_id set hsvc $service_id
set nsttime $start set nsttime $start
set usevtid $event_id set usevtid $event_id
set ucVolume 0 set ucVolume 0
} }
} }
rsv method set_skip {event} { rsv method set_skip {event} {
@ -554,8 +554,8 @@ rsv method apply_skip {service event} {
lassign [epg dbfetch dump -service $service -event $event] epg lassign [epg dbfetch dump -service $service -event $event] epg
if {$epg eq ""} { if {$epg eq ""} {
error "Cannot find event in EPG." error "Cannot find event in EPG."
} }
$epg get_channel_info $epg get_channel_info
# First check to see if there is already a pending skip for this # First check to see if there is already a pending skip for this
@ -572,7 +572,7 @@ rsv method apply_skip {service event} {
$ev set_skip $epg $ev set_skip $epg
if {[catch {$ev insert_deferred} msg]} { if {[catch {$ev insert_deferred} msg]} {
error "Error during insert." error "Error during insert."
} }
} }
rsv method remove_pending {} { rsv method remove_pending {} {
@ -749,7 +749,7 @@ proc {rsv lookuptab} {} {
set res [[rsv dbhandle] query " set res [[rsv dbhandle] query "
select usSvcId, usevtid, ucCRIDType, szCRID, select usSvcId, usevtid, ucCRIDType, szCRID,
ucRecKind, aulEventToRecordInfo, ucRecKind, aulEventToRecordInfo,
szRecordedProgCrid szRecordedProgCrid
from $tab left join channel.TBL_SVC from $tab left join channel.TBL_SVC
on $tab.hSvc = channel.TBL_SVC.hSvc on $tab.hSvc = channel.TBL_SVC.hSvc
where ersvtype <= 3 where ersvtype <= 3
@ -772,35 +772,39 @@ proc {rsv lookuptab} {} {
continue continue
} }
foreach r [split $rec(szRecordedProgCrid) "|"] { foreach r [split $rec(szRecordedProgCrid) "|"] {
if {$r != {}} { if {$r != {}} {
set records([string tolower "\ set records([string tolower "\
$rec(szCRID):\ $rec(szCRID):\
[string range $r 1 end]"]) "R" [string range $r 1 end]"]) "R"
} }
} }
set aul $rec(aulEventToRecordInfo) set aul $rec(aulEventToRecordInfo)
if {[string length $aul]} { if {[string length $aul]} {
for {set i 0} {$i < [string length $aul]} {incr i 16} { for {set i 0} {
binary scan [string range $aul $i $($i + 15)]\ $i < [string length $aul]} {incr i 16} {
iiii service start end event_id binary scan [string range \
set records([\ $aul $i $($i + 15)] \
string tolower "$service:$event_id"]) $p iiii service start end event_id
} set records([
string tolower \
} else { "$service:$event_id"]) $p
set records([\ }
string tolower "$rec(usSvcId):$rec(szCRID)"]) $p } else {
} set records([
string tolower \
"$rec(usSvcId):$rec(szCRID)"]) $p
}
} }
} }
# Add all skipped epsisodes for all series
set skiplist [rsv _skiplist] # Add all skipped episodes for all series
foreach skip $skiplist { set skiplist [rsv _skiplist]
set records($skip) "X" foreach skip $skiplist {
} set records($skip) "X"
}
return $records return $records
} }
@ -1224,7 +1228,7 @@ proc {rsv restore} {file} {
# Need to fix up the AUL table service IDs too. # Need to fix up the AUL table service IDs too.
set newaul "" set newaul ""
foreach aul [$rsv aul] { foreach aul [$rsv aul] {
# {service start end event_id} # {service start end event_id}
lassign $aul ohsvc start end eid lassign $aul ohsvc start end eid
if {![dict exists $hsvcmap $ohsvc]} { if {![dict exists $hsvcmap $ohsvc]} {
# Should not happen # Should not happen
@ -1263,7 +1267,7 @@ proc {rsv restore} {file} {
puts "Restoring skiplist..." puts "Restoring skiplist..."
set fields "ulslot state service_id event_id hSvc start set fields "ulslot state service_id event_id hSvc start
ucCRIDType szCRID szSkipCRID" ucCRIDType szCRID szSkipCRID"
foreach line $data { foreach line $data {
set vals [lrange [lassign [split $line "\t"] key] 0 end-1] set vals [lrange [lassign [split $line "\t"] key] 0 end-1]
@ -1718,3 +1722,4 @@ proc {rsv reassert_skips} {{debug false}} {
rsv commit rsv commit
} }
} }