webif/var/mongoose/cgi-bin/epg/schedule.jim

39 lines
806 B
Plaintext
Raw Normal View History

#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require epg.class system.class
httpheader
set service [cgi_get service -]
set event [cgi_get event -]
set type [cgi_get type 1]
if {$service eq "-" || $event eq "-"} {
puts "Error, insufficient parameters passed."
exit
}
set event [lindex [epg fetch dump -service $service -event $event] 0]
if {$event eq ""} {
puts "Error, cannot find event to schedule."
exit
}
if {[$event percent] > 0} {
puts "Error, cannot record programme which has already started showing"
puts "or occurred in the past."
exit
}
set r [rsv construct $event $type]
if {[catch {$r insert} msg]} {
puts "Error encountered while scheduling: <i>$msg</i>"
} else {
puts "Successfully scheduled <i>[$event get name]</i>"
system restartpending
}
epg cleanup