move scheduling code to class, support split events
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@384 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
1d44efdcdc
commit
cfb12b7da6
@ -10,10 +10,6 @@ puts ""
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
#set _cgi(service) 4170
|
||||
#set _cgi(event) 38584
|
||||
#set _cgi(type) 2
|
||||
|
||||
if {![dict exists $_cgi service] || ![dict exists $_cgi event]} {
|
||||
puts "Error, insufficient parameters passed."
|
||||
exit
|
||||
@ -35,44 +31,8 @@ if {[$event percent] > 0} {
|
||||
exit
|
||||
}
|
||||
|
||||
$event get_channel_info
|
||||
|
||||
set args {}
|
||||
|
||||
set args(ersvtype) 3
|
||||
set args(hsvc) [$event get channel_hsvc]
|
||||
set args(nsttime) [$event get start]
|
||||
set args(nduration) [$event get duration]
|
||||
set args(usevtid) [$event get event_id]
|
||||
set args(szevtname) "\025[$event get name]"
|
||||
set args(eReady) 30
|
||||
|
||||
set ccrid [$event get channel_crid]
|
||||
|
||||
if {$type == 1} {
|
||||
# Event
|
||||
set args(ucCRIDType) 49
|
||||
set args(ucRecKind) 1
|
||||
set args(szCRID) "$ccrid[$event get event_crid]"
|
||||
set args(szEventToRecord) "1$args(szCRID)|"
|
||||
} else {
|
||||
# Series
|
||||
set args(ucCRIDType) 50
|
||||
set args(ucRecKind) 4
|
||||
set args(szCRID) "$ccrid[$event get series_crid]"
|
||||
set args(szFPBRecPath) "$args(szevtname)"
|
||||
set progs [lmap i [epg fetch dump -scrid [$event get series_crid]] {
|
||||
if {[set ecrid [$i get event_crid]] eq ""} { continue }
|
||||
list "1$::ccrid$ecrid"
|
||||
}]
|
||||
set args(szEventToRecord) "[join $progs "|"]|"
|
||||
}
|
||||
|
||||
#puts $args
|
||||
|
||||
set msg ""
|
||||
#if {![file exists /mod/.schedule.testing]} { set msg "Disabled during testing" }
|
||||
if {$msg ne "" || [catch {[rsv new $args] insert} msg]} {
|
||||
set r [rsv construct $event $type]
|
||||
if {[catch {$r insert} msg]} {
|
||||
puts "Error encountered while scheduling the recording: <i>$msg</i>"
|
||||
} else {
|
||||
puts "Successfully scheduled recording of <i>[$event get name]</i>"
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require rsv.class
|
||||
require rsv.class progressbar
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
@ -44,8 +44,9 @@ foreach record [lsort -command rsort $records] {
|
||||
if {$favlist != "" && [$record get service_id] ni $favlist} {
|
||||
continue
|
||||
}
|
||||
altrow
|
||||
set num [$record get channel_num]
|
||||
if {$num == 0 || $num >= 800} { continue }
|
||||
altrow
|
||||
puts "<td>$num</td>"
|
||||
puts "<td>[$record channel_icon 50]</td>
|
||||
<td>
|
||||
|
@ -173,24 +173,28 @@ proc eventrow {event {table TBL_RESERVATION}} {
|
||||
set e $($s + $d)
|
||||
set n [clock seconds]
|
||||
|
||||
if { $n > $e } {
|
||||
puts "<td class=blood nowrap class=va>"
|
||||
} else {
|
||||
puts "<td nowrap class=va>"
|
||||
}
|
||||
puts "[clock format $s -format "%a %d %b %Y"]<br>
|
||||
set ds "[clock format $s -format "%a %d %b %Y"]<br>
|
||||
[clock format $s -format "%H:%M %Z"]"
|
||||
|
||||
if { $n > $e && [$event get ersvtype] <= 3} {
|
||||
puts "<td nowrap class=va
|
||||
alt=\"$ds\" title=\"$ds\">
|
||||
--- -- --- ----<br>--:--"
|
||||
puts "</td><td>--:--:--</td>"
|
||||
} else {
|
||||
puts "<td nowrap class=\"va"
|
||||
if {$n > $e} { puts " blood" }
|
||||
puts "\">$ds"
|
||||
if {$d > 0 && $n > $s && $n < $e} {
|
||||
puts "<br>"
|
||||
set perc [expr [expr $n - $s] * 100 / $d]
|
||||
puts "<img class=va src=/images/745_1_11_Video_1REC.png>"
|
||||
puts "<img class=va
|
||||
src=/images/745_1_11_Video_1REC.png>"
|
||||
puts [progressbar $perc]
|
||||
}
|
||||
|
||||
puts "</td>"
|
||||
|
||||
puts "<td>[clock format [$event get nduration] -format %T]</td>"
|
||||
puts "</td><td>"
|
||||
puts "[clock format [$event get nduration] -format %T]</td>"
|
||||
}
|
||||
|
||||
puts "<td nowrap>$rsvicon $RKIcon</td>"
|
||||
if {[$event get aulEventToRecordInfo] != ""} {
|
||||
|
@ -197,6 +197,11 @@ epg method icon_set {{height 0}} {
|
||||
"<img src=/images/178_1_26_Icon_Recommend.png $height>"
|
||||
}
|
||||
|
||||
if {[string match {/*#?} $event_crid]} {
|
||||
lappend set \
|
||||
"<img src=/images/178_1_26_Icon_Split.png $height>"
|
||||
}
|
||||
|
||||
return $set
|
||||
}
|
||||
|
||||
|
@ -193,11 +193,13 @@ proc {rsv list} {{table tbl_reservation}} {
|
||||
set res [$::rsvdb query "
|
||||
select $table.*,
|
||||
channel.TBL_SVC.szSvcName, channel.TBL_SVC.usLcn,
|
||||
case when ersvtype > 3 then 1 else 0 end as sort
|
||||
case when ersvtype > 3 then 1 else 0 end as sort1,
|
||||
case when nsttime + nduration < [clock seconds]
|
||||
then 0 else 1 end as sort2
|
||||
from $table
|
||||
left join channel.TBL_SVC
|
||||
on $table.hSvc = channel.TBL_SVC.hSvc
|
||||
order by sort, nsttime
|
||||
order by sort1, sort2 desc, nsttime
|
||||
"]
|
||||
|
||||
set records {}
|
||||
@ -293,3 +295,46 @@ proc {rsv commit} {} {
|
||||
$::rsvdb query {commit transaction}
|
||||
}
|
||||
|
||||
proc {rsv construct} {event type} {
|
||||
$event get_channel_info
|
||||
|
||||
set args {}
|
||||
|
||||
set args(ersvtype) 3
|
||||
set args(hsvc) [$event get channel_hsvc]
|
||||
set args(nsttime) [$event get start]
|
||||
set args(nduration) [$event get duration]
|
||||
set args(usevtid) [$event get event_id]
|
||||
set args(szevtname) "\025[$event get name]"
|
||||
set args(eReady) 30
|
||||
|
||||
set ccrid [$event get channel_crid]
|
||||
|
||||
if {$type == 1} {
|
||||
# Event
|
||||
set args(ucCRIDType) 49
|
||||
set args(ucRecKind) 1
|
||||
set args(szCRID) "$ccrid[$event get event_crid]"
|
||||
set args(szEventToRecord) "1$args(szCRID)|"
|
||||
|
||||
# Handle split events
|
||||
if {[string match {*#?} $args(szCRID)]} {
|
||||
set args(ucRecKind) 2
|
||||
set args(szCRID) [string range $args(szCRID) 0 end-2]
|
||||
}
|
||||
} else {
|
||||
# Series
|
||||
set args(ucCRIDType) 50
|
||||
set args(ucRecKind) 4
|
||||
set args(szCRID) "$ccrid[$event get series_crid]"
|
||||
set args(szFPBRecPath) "$args(szevtname)"
|
||||
set progs [lmap i [epg fetch dump -scrid [$event get series_crid]] {
|
||||
if {[set ecrid [$i get event_crid]] eq ""} { continue }
|
||||
list "1$::ccrid$ecrid"
|
||||
}]
|
||||
set args(szEventToRecord) "[join $progs "|"]|"
|
||||
}
|
||||
|
||||
return [rsv new $args]
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user