#!/tvbin/tivosh
#
# Remove previous SignalSources and create new ones...
#
# Set up to create one for FTA air via Tuner and another
# for Foxtel (or whatever) via composite inputs.
#
# (c) 2002, Ron Davis
# Edited by Andrew Palm 2002
#
# All care, No responsibility!
#
source $tcl_library/tv/Inc.itcl
source $tcl_library/tv/mfslib.tcl

# Set db

set db [dbopen]

# Start Transaction, we'll put the deletes in one and the adds
# in another transaction, not sure if necessary but I'll try it
# this way first. I'd like to be sure that the sources are really
# deleted, before I add more... Might not matter...

transaction {

# get FSID of /Setup

  set setup [ db $db open /Setup ]

# Set FSID of /Source you want to remove, the two numbers
# at the end can be obtained by "dumpobj /Setup", if you
# have more than 1 source then repeat for each.
# Dumpobj will report FSIDs like 12345/6789, in this case 
# you would use 12345 for the first number & 6789 for the 2nd.

  set source [ db $db openidconstruction 525111 13]

# And remove it.

  dbobj $setup remove Source $source

# If you have 2 Sources in your /Setup then complete
# and uncomment the next 2 lines to remove the second one.
#
# set source [ db $db openidconstruction 525111 13 ]
# dbobj $setup remove Source $source

# End the Transaction which deletes the source(s)

  }

dbclose $db
unset db

# The event send was pinched from Cramer's comp-in.tcl
# and so was the sync. Works there, why not here?  :-)
# I've no idea where the event send values are documented. 

event send 23 16 0
puts "Source(s) Removed!"
sync

