2011-07-11 23:29:21 +00:00
|
|
|
#!/mod/bin/jimsh
|
|
|
|
|
|
|
|
package require cgi
|
2012-05-21 20:23:41 +00:00
|
|
|
source /mod/webif/lib/setup
|
2011-09-02 19:50:10 +00:00
|
|
|
require epg.class system.class
|
2011-07-11 23:29:21 +00:00
|
|
|
|
2013-02-09 22:46:15 +00:00
|
|
|
httpheader
|
2011-07-11 23:29:21 +00:00
|
|
|
|
2013-02-09 22:46:15 +00:00
|
|
|
set service [cgi_get service -]
|
|
|
|
set event [cgi_get event -]
|
|
|
|
set type [cgi_get type 1]
|
2011-07-11 23:29:21 +00:00
|
|
|
|
2013-02-09 22:46:15 +00:00
|
|
|
if {$service eq "-" || $event eq "-"} {
|
2011-07-11 23:29:21 +00:00
|
|
|
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} {
|
2011-07-12 18:57:30 +00:00
|
|
|
puts "Error, cannot record programme which has already started showing"
|
|
|
|
puts "or occurred in the past."
|
2011-07-11 23:29:21 +00:00
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
2011-09-11 21:23:42 +00:00
|
|
|
set r [rsv construct $event $type]
|
|
|
|
if {[catch {$r insert} msg]} {
|
2011-09-15 23:08:15 +00:00
|
|
|
puts "Error encountered while scheduling: <i>$msg</i>"
|
2011-07-11 23:29:21 +00:00
|
|
|
} else {
|
2011-09-15 23:08:15 +00:00
|
|
|
puts "Successfully scheduled <i>[$event get name]</i>"
|
2011-09-02 19:50:10 +00:00
|
|
|
system restartpending
|
2011-07-11 23:29:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
epg cleanup
|
|
|
|
|