View Full Version : Deleting a channel ?

06-01-2003, 06:19 AM
I'm desperately trying to delete a channel I added for testing. It is labeled Ant 29, created by recording a minute off a RF channel with no official station. Using this script :

tvsource $tcl_library/tv/mfslib.tcl

EnableTransactionHoldoff True

proc foreachTransaction {var list n body} {
upvar $var $var
while 1 {
set sublist [lrange $list 0 [expr $n-1]] if {$sublist==""} break
uplevel [list RetryTransaction [list foreach $var $sublist $body]]
set list [lrange $list $n end]

set db [dbopen]
RetryTransaction {
set setup [db $db open "/Setup"]
set sources [dbobj $setup gettarget Source]
set sourcesobj [dbobj $setup get Source]
set tvsource [lindex $sourcesobj 1]
set channels [dbobj $tvsource gettarget Channel]
foreachTransaction id $channels 20 {
regexp {([0-9]*)/(.*)} $id junk fsid subobjid
set channel [db $db openidconstruction $fsid $subobjid]

set station [dbobj $channel get Station]
set name [dbobj $station get Name]
set callsign [dbobj $station get CallSign]
if { $callsign == "Ant" } {
puts stdout "$callsign $name"
puts stdout "channel : $channel"
puts stdout "station : $station"
puts stdout "tvsource : $tvsource"
dbobj $tvsource remove Channel $channel
dbobj $channel remove Station $station
dbobj $station markasrubbish
dbobj $channel markasrubbish

All I get is :

# ./remArte.tcl
Ant {Channel 29}
channel : dbobj57
station : dbobj58
tvsource : dbobj4
no such object: dbobj4
while executing
"dbobj $tvsource remove Channel $channel "

Can anyone help ?