Posted to tcl by Saedelaere at Fri Nov 16 13:05:49 GMT 2007view raw
- #! /bin/sh
- # the next line restarts using wish \
- exec wish "$0" "$@"
- set home_path $::env(HOME)
- set file $::home_path/.tv-viewer/config/channels.conf
- set f [open $file r]
- set i 1
- while {[gets $f line]!=-1} {
- foreach {kanal channel} [split $line] {
- set kanalid($i) $kanal
- }
- incr i
- }
- parray kanalid
- if { "$kanalid($i)" == "ARD" } {
- puts aha
- }
- exit 0
Comments
Posted by Saedelaere at Fri Nov 16 21:28:30 GMT 2007 [text] [code]
#! /bin/sh # the next line restarts using wish \ exec wish "$0" "$@" set home_path $::env(HOME) proc channel_up {} { set file $::home_path/.tv-viewer/config/channels.conf set f [open $file r] set i 1 while {[gets $f line]!=-1} { if { "$::kanalid($i)" == "ZDF" } { puts $i set rechnung [expr {($i == 30) ? 1 : ($i + 1)}] puts $rechnung puts $::kanalid($rechnung) } incr i } } proc channel_down {} { set file $::home_path/.tv-viewer/config/channels.conf set f [open $file r] set i 1 while {[gets $f line]!=-1} { if { "$::kanalid($i)" == "ARD" } { set rechnung [expr {($i == 1) ? 30 : ($i - 1)}] puts $rechnung puts $::kanalid($rechnung) } incr i } } set file $::home_path/.tv-viewer/config/channels.conf set f [open $file r] set i 1 while {[gets $f line]!=-1} { foreach {kanal channel} [split $line] { set kanalid($i) $kanal } incr i } channel_down this the working code for channel_up and channel_down. I'am sure this could be done much better but it works for me :)