Posted to tcl by Saedelaere at Fri Nov 16 21:30:06 GMT 2007view raw
- #! /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
-
- I'am sure this could be done much better. But it works and is much better than the code i used to have.
- Thanks to all of you
-