#
# (C) Copyright 2003 by Christopher R. Wingert
# All rights reserved
#
set global_manrec_version "v0.2.5"
set global_manrec_link "http://www.tivocommunity.com/tivo-vb/showthread.php?p=3751312#post3751312"
#
# 12/06/2003 - v0.0.1 [Alpha] - Initial public release
# 13/06/2003 - v0.0.2 [Alpha] - Software 2.5 or later wants a Series in the Program
# 18/06/2003 - v0.0.2 [Alpha] - Add manual season pass
# 14/07/2003 - v0.0.3 [Alpha] - Add manual season pass scheduling of two weeks of recording
#
# 20/05/2004 - v0.0.4 [Patch] - Add (commented) code for SVideo input search
# 20/05/2004 - v0.0.5 [Patch] - Allow user to select number of weeks to record
# 24/05/2004 - v0.0.6 [Patch] - Allow user to select number of days to keep a recording
# 26/05/2004 - v0.0.7 [Patch] - Allow user to select maximum number of episodes to keep
# 18/06/2004 - v0.0.8 [Patch] - 2.5.5 uses SeasonPass tydir, 3.0 uses SeasonPass/User
# 26/06/2004 - v0.0.9 [Patch] - Define defaults for GUI and HTTP interface
# 27/08/2004 - v0.1.0 [Patch] - Fixed up an issue with TZ and repeat recordings
# 09/09/2004 - v0.1.1 [Patch] - Cosmetic fix to use noon and midnight
# 15/09/2004 - v0.1.2 [Patch] - Support for keep "Until I Delete"
# 09/10/2004 - v0.1.3 [Patch] - Support for digital (real) channel numbers
# 15/10/2004 - v0.1.4 [Patch] - Made the creation of a season pass optional
# 13/11/2004 - v0.1.5 [Patch] - "Start Minute" changed from a list to an entry field
# 09/03/2005 - v0.1.6 [Patch] - Using a little DHTML to clean up the form
# 15/03/2005 - v0.1.7 [Patch] - Supports a configuration file
# 05/07/2005 - v0.1.8 [Patch] - Conflict support for dual-tuner units under TWP
# 07/07/2005 - v0.1.9 [Patch] - True manual season pass implemented (and a new GUI)
# 13/07/2005 - v0.2.0 [Patch] - Allow selection of favourite channels (for mobiles)
# 02/11/2005 - v0.2.1 [Patch] - Uses TWP's get_tzoffset function if available
# 04/11/2005 - v0.2.2 [Patch] - Accepts station callsigns (translates to chnsel)
# 09/11/2005 - v0.2.3 [Patch] - Checks for duplicate recordings on dual tuner units
# 13/11/2005 - v0.2.4 [Patch] - Added support for a showdate and chnnum parameter
# 07/02/2006 - v0.2.5 [Patch] - Included support for titles on Manual SeasonPass's
#
# ToDo:
# N/A
#
# Compatibility:
# Mfr Type Model # Tivo Version ManRec.itcl Ver. + Result
# -------- ------- ---------- --------------- -------------------------
# Thomson TiVo PVR10UK 2.5.5-01-1-023 V0.2.5 PASSED 07-02-2006
# Philips TiVo HDR212 3.0-01-1-000 V0.2.5 PASSED 07-02-2006
# Samsung D*TiVo SIR-S4040R 6.2 V0.2.0 PASSED 21-07-2005
#
# Notes:
# The "Keep At Most" (MaxRecording) setting will not override the
# "Keep At Least" (ExpirationDate) setting... so no new episodes will
# be recorded once the limit has been reached - unless some of the
# recordings have expired.
#
# Manual recordings are likely to be renamed on systems running
# version 3.0 or greater, as they favour information from the guide
# data.
#
# WARNING:
# When you use this tool, you do so at your own risk.
# No warranties, expressed or implied... etc.
#
if {[info exists tvratingnums] == 0} {
# Needed if UI.itcl has not being initialised correctly
set tvratingnums "1 2 3 4 5 6"
set tvratingvals "TV-Y7 TV-Y TV-G TV-PG TV-14 TV-MA"
}
proc get_num_conflicts { conflictsLists } {
set conflictstodo [ lindex $conflictsLists 0 ]
set numconflicts [ llength $conflictstodo ]
return $numconflicts
}
# RecConflictsList is defined in sched.itcl (it returns two
# lists, the first is a list of conflicting recordings, the
# second is a list of conflicting suggestions). This wraps
# this function with conflict resolution support for setups
# with dual tuners.
proc RecConflictsList_Dual {chan starttime endtime chnsel} {
global db
set conflictsLists [ RecConflictsList $starttime $endtime ]
# TivoWeb v1.9.4 does not define 'num_tuners', so the following
# will only work for TivoWebPlus users. The following will ignore
# conflicts if a spare tuner exists.
if {[info exists ::num_tuners]} {
if {$::dtivo && $::num_tuners == 2} {
set numconflicts [llength [lindex $conflictsLists 0]]
if {$numconflicts > 1} {
# There are more than one conflicting recordings... need
# to check if there is a spare tuner that we can use.
set conflictslist [lindex $conflictsLists 0]
set conflicts 0
foreach conflict $conflictslist {
RetryTransaction {
set rec [db $db openid $conflict]
set showing [dbobj $rec get Showing]
set showingfsid "[dbobj $showing fsid]/[dbobj $showing subobjid]"
set startearlysecs [defaultval 0 [dbobj $rec get StartPadding]]
set endlatesecs [defaultval 0 [dbobj $rec get EndPadding]]
}
set conflict_conflictslist [GetConflictsList $showingfsid $startearlysecs $endlatesecs]
set conflictindex [lsearch -exact $conflict_conflictslist $conflict]
set conflict_conflictslist [lreplace $conflict_conflictslist $conflictindex $conflictindex]
foreach conflict_conflict $conflict_conflictslist {
if { [lsearch -exact $conflictslist $conflict_conflict] != -1 } {
incr conflicts
}
}
}
if {$conflicts == 0} {
# Let's print out a note of the other recordings
puts $chan "Note: These recordings are also scheduled within this timeslot:
"
dump_conflicts $chan 0 $conflictsLists
# Remove the list of todo conflicts as we still have a tuner spare
set conflictsLists [lreplace $conflictsLists 0 0 {}]
}
} else {
if {$numconflicts == 1} {
# Let's check to see if this conflict is actually the same show
# as that we are attempting to record, otherwise we will end up
# recording the same programme on different tuners.
set conflict [lindex [lindex $conflictsLists 0] 0]
RetryTransaction {
set rec [db $db openid $conflict]
set showing [dbobj $rec get Showing]
set date [dbobj $showing get Date]
set time [dbobj $showing get Time]
set duration [dbobj $showing get Duration]
set station [dbobj $showing get Station]
set sfsid [dbobj $station fsid]
}
set starttime2 [expr $date * 86400 + $time]
set endtime2 [expr $starttime2 + $duration]
if {$sfsid == $chnsel && $starttime == $starttime2 && $endtime == $endtime2} {
# We are already recording this programme, so we are going to
# handle this as a conflict even though we have a tuner spare.
puts $chan "Note: This recording has already been scheduled.
"
} else {
puts $chan "Note: This recording is also scheduled within this timeslot:
"
dump_conflicts $chan 0 $conflictsLists
# We only have one conflict... so we can remove any todo conflict
# as we know we will have a spare tuner available, but let's check
# to see if we are attempting to record the SAME show twice.
set conflictsLists [lreplace $conflictsLists 0 0 {}]
}
}
}
}
}
return $conflictsLists
}
proc dump_conflicts { chan flag conflictsLists } {
global db
set conflictstodo [ lindex $conflictsLists 0 ]
RetryTransaction {
foreach conflict $conflictstodo {
set rec [db $db openid $conflict]
set showing [dbobj $rec get Showing]
set program [dbobj $showing get Program]
set title [strim [dbobj $program get Title]]
set station [dbobj $showing get Station]
set callsign [dbobj $station get CallSign]
set showingfsid "[dbobj $showing fsid]/[dbobj $showing subobjid]"
if { $flag == 0 } {
puts $chan "[html_link "/showing/$showingfsid" $title] on $callsign.
"
} else {
puts $chan "[html_link "/showing/$showingfsid" $title] on $callsign conflicts.
"
}
}
}
if { $flag != 0 } {
puts $chan "
No recording scheduled!"
}
}
proc cancel_conflicts { chan conflictsLists } {
set conflictstodo [ lindex $conflictsLists 0 ]
set conflictssugg [ lindex $conflictsLists 1 ]
set numconflicts [ llength $conflictstodo ]
if { $numconflicts > 0 } {
puts $chan "Cancelling Conflicting Recording..."
foreach conflict $conflictstodo {
set success [DeleteTodoRec $conflict 24 "Cancelled by user"]
}
puts $chan "Done.
"
}
foreach conflict $conflictssugg {
set success [DeleteTodoRec $conflict 24 "Cancelled by user"]
}
}
# Use TWP's get_tzoffset(time) function if it is available,
# otherwise just use the current value of tzoffset.
proc manrec_tzoffset { time } {
global tzoffset
if {[catch {set offset [get_tzoffset $time]}] == 0} {
return $offset
} else {
return $tzoffset
}
}
proc convert_time { wodatetz wotimetz womin durationstr } {
# Local time
set lstarttime [ expr $wodatetz + ( $wotimetz * 3600 ) + ( $womin * 60 ) ]
set lrecdate [ expr $lstarttime / 86400 ]
set lrectime [ expr $lstarttime - ( $lrecdate * 86400 ) ]
# System time (GMT/UCT)
set starttime [ expr $lstarttime - [manrec_tzoffset $lstarttime] ]
set recdate [ expr $starttime / 86400 ]
set rectime [ expr $starttime - ( $recdate * 86400 ) ]
set duration [ expr $durationstr * 60 ]
set endtime [ expr $starttime + $duration ]
set retval {}
lappend retval $lrecdate $lrectime $recdate $rectime $duration $starttime $endtime
return $retval
}
proc create_manual_todo_recording { chan timeArray chnsel titlestr episodestr descriptionstr ratingstr progsource recqual keepdays createSP} {
global version3
global db
set lrecdate [lindex $timeArray 0]
set lrectime [lindex $timeArray 1]
set recdate [lindex $timeArray 2]
set rectime [lindex $timeArray 3]
set duration [lindex $timeArray 4]
set starttime [lindex $timeArray 5]
set endtime [lindex $timeArray 6]
RetryTransaction {
puts $chan "Creating Recording..."
set recording [ db $db create Recording ]
dbobj $recording set BitRate 0
dbobj $recording set ErrorString "Manual Todo (manrec.itcl)"
if { $keepdays > 0 } {
dbobj $recording set ExpirationDate [ expr $recdate + $keepdays ]
} else {
# Keep "Until I Delete"
dbobj $recording set ExpirationDate 24855
}
dbobj $recording set ExpirationTime 0
if { $progsource != 0 } {
set ps [db $db openid $progsource]
dbobj $recording set ProgramSource $ps
}
###########################################################
# NOTE: To create an entry that is not flagged as manual, #
# use SelectionType=3 and ProgramGuideBehavior=1. #
# Not really recommended as it will cause problems #
# while listed in the ToDo list. #
###########################################################
# Create a manual(5) entry and place in the todo(6) list
dbobj $recording set RecordQuality $recqual
dbobj $recording set Score 0
dbobj $recording set SelectionType 5
dbobj $recording set StartDate $recdate
dbobj $recording set StartTime $rectime
dbobj $recording set State 6
dbobj $recording set StopDate $recdate
dbobj $recording set StopTime [expr $rectime + $duration]
if { $::version3 } {
# Only needed for 3.x and above
dbobj $recording set StreamFileSize 0
dbobj $recording set UsedBy 1
#
# Create the RecordingBehavior subobject.
#
set recordingbehavior [db $db createsub RecordingBehavior $recording]
dbobj $recordingbehavior set DiskBehavior 1
dbobj $recordingbehavior set PresentationBehavior 2
dbobj $recordingbehavior set ProgramGuideBehavior 3
dbobj $recordingbehavior set TunerBehavior 3
dbobj $recording set RecordingBehavior $recordingbehavior
}
puts $chan "Done.
"
#
# Create the station subobject.
#
set station [db $db openid $chnsel]
puts $chan "Creating Program..."
#
# Create the program subobject. This is where we put all of the stuff
# that describes the recording, including genre and episode information.
#
set program [db $db create Program]
set series [db $db create Series]
if {$episodestr != ""} {
dbobj $series set Episodic 1
dbobj $program set IsEpisode 1
dbobj $program set EpisodeNum 0
dbobj $program set EpisodeTitle $episodestr
}
dbobj $series set Title $titlestr
dbobj $program set Series $series
dbobj $program set Title $titlestr
dbobj $program set Description $descriptionstr
puts $chan "Done.
"
puts $chan "Creating Showing..."
#
# Create the showing subobject.
#
set showing [db $db createsub Showing $recording]
dbobj $recording set Showing $showing
dbobj $showing set Date $recdate
dbobj $showing set Duration $duration
dbobj $showing set Program $program
if { $createSP == 0 } {
dbobj $showing set Reason 2
} else {
dbobj $showing set Reason 4
}
dbobj $showing set Station $station
dbobj $showing set Time $rectime
#dbobj $showing set TvRating $ratingstr
puts $chan "Done.
"
}
}
proc create_manual_season_pass { chan timeArray chnsel days recqual keepdays keepmost createSP titlestr } {
global version3
global db
set lrecdate [lindex $timeArray 0]
set lrectime [lindex $timeArray 1]
set recdate [lindex $timeArray 2]
set rectime [lindex $timeArray 3]
set duration [lindex $timeArray 4]
set starttime [lindex $timeArray 5]
set endtime [lindex $timeArray 6]
puts $chan "Creating Season Pass..."
# Determine where Season Passes are stored...
if { $::version3 } {
set SeasonPasses "/SeasonPass/User"
} else {
set SeasonPasses "/SeasonPass"
}
set maxPriority -1
ForeachMfsFileTrans fsid name type $SeasonPasses "" 20 {
set seasonpass [ db $db openid $fsid ]
set priority [ dbobj $seasonpass get Priority ]
if { $priority > $maxPriority } {
set maxPriority $priority
}
}
incr maxPriority
# puts $chan "
days $days, priority $maxPriority
"
RetryTransaction {
set station [db $db openid $chnsel]
set seasonpass [db $db create SeasonPass]
dbobj $seasonpass set DayOfWeekLocal [ lindex $days 0 ]
set count [ llength $days ]
if { $count > 1 } {
for { set i 1 } { $i < $count } { incr i } {
dbobj $seasonpass add DayOfWeekLocal [ lindex $days $i ]
}
}
dbobj $seasonpass set Duration $duration
# The following will limit how many episodes we keep
if { $keepmost > 0 } {
dbobj $seasonpass set MaxRecordings $keepmost
}
dbobj $seasonpass set Priority $maxPriority
dbobj $seasonpass set RecordQuality $recqual
dbobj $seasonpass set StartTimeLocal $lrectime
dbobj $seasonpass set Station $station
# Manual Repeat Recording
dbobj $seasonpass set Type 2
if { $keepdays == 0 } {
# set KeepTime to 0 for "Until I Delete"
dbobj $seasonpass set KeepTime 0
}
set spfsid [dbobj $seasonpass fsid]
# Support the creation of a Series so that a title can
# be assigned to the Season Pass. This is not really
# a supported configuration (results in zombie series
# entries in the database, and errors when viewing the
# season pass under TWP)... but does help if guide data
# is not very reliable.
if { $createSP == 2 && [llength $titlestr] > 0 } {
set series [ db $db create Series ]
dbobj $series set Title $titlestr
dbobj $seasonpass set Series $series
dbobj $seasonpass remove Type
}
}
puts $chan "Done.
"
return $spfsid
}
proc action_manrec {chan path env} {
global tvratingvals
global tvratingnums
global channeltablenum
global channeltablestation
global version3
global db
global guideindexdir
global source_dir
set tzoffset [manrec_tzoffset [clock seconds]]
#
# Setup session variables with their defaults
#
set weeks 2
set keepdays 6
set keepmost 5
set createSP 0
set titlestr "Manual Recording"
set episodestr ""
set descriptionstr "Manual Recording"
set chnnum -1
set chnsel ""
set callsign ""
set showdate ""
set repeat "once"
set recqual 75
set forcerecord 0
set durationstr 60
set ratingstr 1
set womin 0
set wodatetz -1
set favs 0
set daysahead 14
set fakeSP 0
# Load any settings found in the configuration file
if {[file exists $source_dir/modules/manrec.cfg]} {
catch {source $source_dir/modules/manrec.cfg}
}
# Don't really want SeasonPasses for single recordings
if { $repeat == "once" } {
set createSP 0
}
# Load any submitted parameters
eval $env
# Check to see if we were provided a station callsign or channel
# number rather than the station fsid.
if { $chnsel == "" } {
if { $callsign != ""} {
# convert callsign to chnsel
foreach chnnum [lsort -real [array names channeltablenum]] {
set sta $channeltablenum($chnnum)
set data $channeltablestation($sta)
if {[lindex $data 2] == $callsign} {
set chnsel $sta
break
}
}
} elseif { $chnnum > -1 && $chnnum < [array size channeltablenum]} {
set chnsel $channeltablenum($chnnum)
}
}
# Check to see if we were provided a showdate (MM/DD[/YY]), otherwise
# default to using todays date.
if {$wodatetz == -1} {
if {$showdate == ""} {
set wodatetz [expr ([clock seconds] + $tzoffset) - (([clock seconds] + $tzoffset) % 86400)]
} else {
set wodatetz [expr [clock scan $showdate] + [manrec_tzoffset [clock scan $showdate]]]
}
}
if {![regexp -nocase {set "(submit|action)" "Record";} $env]} {
#
# Create channel selection drop-down list
#
set chnvals ""
set chnlabels ""
foreach num [lsort -real [array names channeltablenum]] {
set sta $channeltablenum($num)
set data $channeltablestation($sta)
set favourite [lindex $data 1]
if {$favs == 1 && $favourite == 0} {
continue
}
set sign [lindex $data 2]
set label "$sign - $num"
lappend chnlabels $label
lappend chnvals $sta
}
####################### BEGIN: SVideo search #######################
# If you use your tivo to record via the SVideo input then you
# may like to replace the above "foreach" loop with the following
# code segment. This resolves the problem with this input not
# being in the "Watch" programs as defined by the UI->ChannelGuide.
####################################################################
#
#RetryTransaction {
# set channelfsid [lindex [mfs find $guideindexdir/ChannelTable] 0]
# set channeltabledata [mfs get $channelfsid]
#}
#binary scan [string range $channeltabledata 0 3] I numkeys
#set incrsize 50
#set varname [lindex $::datagroup [lsearch $::datagroup "SF_Serial*"]]
#set varname [string range $varname 9 11]
#for {set i 0} {$i < $numkeys} {incr i $incrsize} {
# set maxchannelcount [expr ($numkeys > $i + $incrsize) ? ($i + $incrsize) : $numkeys]
# RetryTransaction {
# for {set count $i} {$count < $maxchannelcount} {incr count} {
# binary scan [string range $channeltabledata [expr $count*8 + 4] [expr $count*8 + 11]] ISS sta dummy num
# set station [db $db openid $sta]
# set sign [dbobj $station get CallSign]
# set label "$sign - $num"
# lappend chnlabels $label
# lappend chnvals $sta
# }
# }
#}
######################## END: SVideo search ########################
#
# Create date selection drop-down list
#
set datevals {}
set datelabels {}
set minseconds [ expr ([clock seconds] + $tzoffset) - (([clock seconds] + $tzoffset) % 86400) ]
set maxseconds [ expr $minseconds + ( 86400 * $daysahead ) ]
if {$wodatetz > $maxseconds} {set maxseconds $wodatetz}
for {set i $minseconds} {$i <= $maxseconds} {incr i 86400} {
set timestr [clock format $i -format "%a %1m/%1d"]
lappend datelabels $timestr
lappend datevals $i
}
#
# Create time(hours) selection drop-down list
#
set wotimetz [expr (([clock seconds] + $tzoffset - $wodatetz) / 3600 )]
#set womin [expr [clock format [clock seconds] -format {%M}] + 2]
set timevals {}
set timelabels {}
for { set i 0 } { $i < 24 } { incr i } {
if { $i < 12 } {
set t $i
if { $t == 0 } {
lappend timelabels "midnight"
} else {
lappend timelabels "$t am"
}
} else {
set b [expr $i - 12]
if { $b == 0 } {
lappend timelabels "noon"
} else {
lappend timelabels "$b pm"
}
}
lappend timevals $i
}
set yesNoLabels "Yes No"
set yesNoValues "1 0"
if {$fakeSP == 0} {
set spLabels "Yes No"
set spValues "1 0"
if {$createSP > 1} {set createSP 1}
} else {
set spLabels "{Yes (with series title)} Yes No"
set spValues "2 1 0"
}
set repeatLabels "Once Daily Weekdays {Every Sunday} {Every Monday} {Every Tuesday} {Every Wednesday} {Every Thursday} {Every Friday} {Every Saturday}"
set repeatValues "once daily weekdays 0 1 2 3 4 5 6"
set mr_qualvals "0 40 75 100"
set mr_quallabs "Basic Medium High Best"
#
# Display the HTML "Manual Record" form
#
puts $chan [html_start "Manual Record"]
puts $chan {
}
puts $chan [html_form_start "GET" "/manrec" "name=\"record\" id=\"record\""]
puts $chan [html_table_start "" "Manual Record" "COLSPAN=2"]
puts $chan [tr "" [td "Title"] [td "" [html_form_text 1 40 "titlestr" $titlestr]]]
puts $chan [tr "" [td "Episode"] [td "" [html_form_text 1 40 "episodestr" $episodestr]]]
puts $chan [tr "" [td "Description"] [td "" [html_form_text 1 40 "descriptionstr" $descriptionstr]]]
puts $chan [tr "STYLE=\"font-size:6px\"" [td ""] [td "" ""]]
puts $chan [tr "" [td "Repeat Options"] [td "" [html_form_select "repeat\" OnChange=\"Toggle_Repeat()" $repeatValues $repeatLabels $repeat]]]
puts $chan [tr "id=ssd" [td "Showing Date"] [td "" [html_form_select "wodatetz" $datevals $datelabels $wodatetz]]]
puts $chan [tr "id=createSP STYLE=\"display:none\"" [td "Use a Season Pass"] [td "" [html_form_select "createSP\" OnChange=\"Toggle_SP()" $spValues $spLabels $createSP]]]
puts $chan [tr "id=keepmost STYLE=\"display:none\"" [td "Keep At Most"] [td "" [html_form_select "keepmost" "1 2 5 0" "{1 episode} {2 episodes} {5 episodes} {All episodes}" $keepmost]]]
puts $chan [tr "id=todo" [td "ToDo Repeat"] [td "" [html_form_select "weeks" "2 4 8 16" "{Two weeks} {One month} {Two months} {Four months}" $weeks]]]
puts $chan [tr "STYLE=\"font-size:6px\"" [td ""] [td "" ""]]
puts $chan [tr "" [td "Channel"] [td "" [html_form_select "chnsel" $chnvals $chnlabels $chnsel]]]
puts $chan [tr "" [td "Start Hour"] [td "" [html_form_select "wotimetz" $timevals $timelabels $wotimetz]]]
puts $chan [tr "" [td "Start Minute"] [td "" [html_form_text 1 40 "womin" $womin]]]
puts $chan [tr "" [td "Duration (Min)"] [td "" [html_form_text 1 40 "durationstr" $durationstr]]]
puts $chan [tr "STYLE=\"font-size:6px\"" [td ""] [td "" ""]]
puts $chan [tr "" [td "Keep At Least"] [td "" [html_form_select "keepdays" "1 3 6 13 27 0" "{One day} {Three days} {One week} {Two weeks} {Four weeks} {Until I Delete}" $keepdays]]]
#puts $chan [tr "" [td "TV Rating"] [td "" [html_form_select "ratingstr" $tvratingnums $tvratingvals $ratingstr]]]
puts $chan [tr "" [td "Record Quality"] [td "" [html_form_select "recqual" $mr_qualvals $mr_quallabs $recqual]]]
puts $chan [tr "" [td "Force Record"] [td "" [html_form_select "forcerecord" $yesNoValues $yesNoLabels $forcerecord]]]
puts $chan [html_table_end]
puts $chan [html_form_input "submit" "submit" "Record"]
puts $chan "
manrec.itcl module version"
puts $chan [html_link $::global_manrec_link $::global_manrec_version]
if {[info exists ::num_tuners]} {
if {$::dtivo && $::num_tuners == 2} {
puts $chan "(Dual Tuner)"
}
}
puts $chan "
"
puts $chan [html_form_end]
# The settings in the configuration file may not be the same as
# the defaults, so we will need to run the Toggle functions to
# get the form to display correctly.
puts $chan {
}
} else {
puts $chan [html_start "Manual Record"]
if { $chnsel == "" } {
puts $chan "ERROR: A chnsel, chnnum, or callsign must be provided."
puts $chan [html_end]
return
}
if {$womin == "" || $durationstr == ""} {
puts $chan "ERROR: Either Start Minute or Duration was left blank."
puts $chan [html_end]
return
}
# The following will stop strings such as "08" causing an error
scan $womin "%d" womin
scan $durationstr "%d" durationstr
set timeArray [convert_time $wodatetz $wotimetz $womin $durationstr]
set starttime [lindex $timeArray 5]
set endtime [lindex $timeArray 6]
# RecConflictsList is defined in sched.itcl (it returns two
# lists, the first is a list of conflicting recordings, the
# second is a list of conflicting suggestions).
set conflictsLists [ RecConflictsList_Dual $chan $starttime $endtime $chnsel ]
set numconflicts [ get_num_conflicts $conflictsLists ]
if { $repeat == "once" } {
if { $starttime < ([clock seconds]-600) } {
# the start time was more than 10 minutes ago
puts $chan "I can not schedule programs in the past (check timezone, tz=$tzoffset)"
} elseif { $forcerecord == 0 && $numconflicts > 0 } {
dump_conflicts $chan 1 $conflictsLists
} else {
cancel_conflicts $chan $conflictsLists
set programSource 0
puts $chan "