#!/tvbin/tivosh # dbsX (dbset extended) can set list values and/or can work in interactive mode # (will display then ask for value, no change if enter only) # based on dbset and TIVOir, thanks! # Sample usage: # ========== # dbsetX /Setup # no attribute: just dumps the object so the attributes are displayed # dbsetX /Setup CableType 3 # will set CableType to 3 (like dbset does) # dbsetX /Setup CableType # will ask for value of cable type, after displaying existing value # dbsetX /Component/Ir/Format/1 Option 0 "4 148" # will set Option to listvalue 0 4 148 # dbsetX 785/11 Option - "4 148" # note the "-" will ask 'first' value then set format to first 4 148 # General usage: # dbsetX databse-ref attr-name-to-set value-or-none (interactive) added-values # database-ref can be an object name such as /Component/Ir/TivoFormat/10001 # or can be an object-ID such as 785/11 or 785 # source $tcl_library/tv/log.tcl proc OpenObject {db objspec} { set dumpId $objspec if {[string range $objspec 0 0] == "/"} { set obj [db $db open $objspec] } elseif { [regexp {([0-9]*)/(.*)} $objspec junk fsid subobjid] } { set obj [db $db openidconstruction $fsid $subobjid] set dumpId $fsid } else { set obj [db $db openid $objspec] } return $obj } set obj [lindex $argv 0] set attr [lindex $argv 1] set val [lindex $argv 2] set addVal [lindex $argv 3] set dumpId 1 set db [dbopen] RetryTransaction { set x [OpenObject $db $obj] if {$attr != ""} { set valNow [dbobj $x get $attr] # if no val given, ask it, else display current value if {$val == "" || $val == "-"} { puts "$obj $attr: $valNow New value (first only):" gets stdin val } else { puts "$obj $attr val was: $valNow" } # if no value given, dont change else change first value if { "$val" != ""} { dbobj $x set $attr $val # if list of values given, change then also if { "$addVal" != ""} { foreach item $addVal { dbobj $x add $attr $item } } set valNow [dbobj $x get $attr] puts "$obj $attr set to : $valNow" } else { puts "No change" } ; #endif test value given } ; #endif test attrib given } ; #endif transaction if {$attr == ""} { # if no attrib just dump the object dumpobj $obj }