honour filters in schedule display

This commit is contained in:
HummyPkg 2017-05-02 22:20:05 +01:00
parent f28a048bd9
commit ab1f04fe8e
4 changed files with 46 additions and 9 deletions

View File

@ -1,7 +1,7 @@
Package: webif
Priority: optional
Section: web
Version: 1.4.2
Version: 1.4.2-1
Architecture: mipsel
Maintainer: af123@hpkg.tv
Depends: tcpfix,webif-channelicons(>=1.1.25),lighttpd(>=1.4.39-1),jim(>=0.77),jim-oo(>=0.77),jim-sqlite3(>=0.77),jim-cgi(>=0.7-1),jim-binary(>=0.76),service-control(>=2.3),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.6),hmt(>=2.0.10),ssmtp,cron-daemon(>=1.18.3-3),at(>=3.1.18),anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.1.11),webif-charts(>=1.2-1),stripts(>=1.2.5-3),tmenu(>=1.21-2),ffmpeg(>=2.8),id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl,nugget(>=0.95),sqlite3(>=3.15.1),jim-xconv

View File

@ -185,7 +185,7 @@ proc eventrow {event {table TBL_RESERVATION}} {
<span class=footnote>(Last: $ds)</span>"
puts "</td><td>--:--:--</td>"
} else {
set elist [$event aul]
set elist [$event aul true]
set ds "[clock format $s -format {%a %d %b %Y %H:%M}]"
puts "<td nowrap class=\"va"
if {$n > $e} { puts -nonewline " blood" }

View File

@ -94,6 +94,16 @@ foreach p $pending {
# 5: ucRecKind
# 6: class (live, pending)
# Filter events array
set skip [rsv skiplist]
if {[llength $skip]} {
set events [lmap i $events {
lassign $i x x s e
if {"$s:$e" in $::skip} continue
function $i
}]
}
# Sort final events array
set events [lsort -index 0 -integer [lsort -index 2 -integer $events]]

View File

@ -80,6 +80,7 @@ proc {rsv dbhandle} {args} {
state text,
service_id int,
event_id int,
hSvc int,
start int,
ucCRIDType int,
szCRID text,
@ -111,13 +112,17 @@ rsv method status {} {
}
}
rsv method aul {} {
rsv method aul {{filter false}} {
set aul {}
set xaul {}
if {$filter} { set xaul [rsv skiplist $ulslot] }
for {set i 0} {$i < [string length $aulEventToRecordInfo]} {
incr i 16} {
binary scan [string range $aulEventToRecordInfo $i $($i + 15)]\
iiii service start end event_id
catch {lappend aul [list $service $start $end $event_id]}
if {"$service:$event_id" ni $xaul} {
catch {lappend aul [list $service $start $end $event_id]}
}
}
return $aul
}
@ -343,11 +348,11 @@ rsv method set_skip {event {persist true}} {
[rsv dbhandle] query {
insert or ignore into skip
(ulslot, state, ucCRIDType, szCRID, szSkipCRID,
service_id, event_id, start)
service_id, event_id, start, hSvc)
values('%s', 'pending', '%s', '%s', '%s', %s, %s,
%s)
%s, %s)
} -1 $ucCRIDType $szCRID $crid $service_id $event_id [\
$event get start]
$event get start] $event_hsvc
}
}
@ -1321,6 +1326,18 @@ proc {rsv clearskip} {slot} {
}
}
proc {rsv skiplist} {{ulslot -1}} {
set dbh [rsv dbhandle]
set q "select group_concat(hSvc || ':' || event_id, ' ')
as list from skip where state = 'live'"
if {$ulslot >= 0} {
append q " and ulslot = $ulslot"
}
lassign [$dbh query $q] ret
return $ret(list)
}
proc {rsv reassert_skips} {} {
set rsvdb [rsv dbhandle]
@ -1329,9 +1346,8 @@ proc {rsv reassert_skips} {} {
foreach s [$rsvdb query {
select * from skip
where state = 'live' and ulslot >= 0
and start > %s and start < %s
order by ulslot, service_id, event_id
} $now $($now + 86400)] {
}] {
if {![dict exists $s ulslot]} continue
set r [rsv slot $s(ulslot)]
if {$r eq "0"} {
@ -1345,6 +1361,17 @@ proc {rsv reassert_skips} {} {
continue
}
if {$s(start) < $now} {
# Recording time passed
rsv clearskip $s(ulslot)
continue
}
if {[$r get usevtid] != $s(event_id) &&
$s(start) > $now + 86400} {
continue
}
#puts "S: $s"
#require classdump; classdump $r