Posted to tcl by mjanssen at Thu Oct 19 22:41:59 GMT 2006view raw
- package require http
- package require sqlite3
- set data [set [http::geturl http://tvrage.com/quickschedule.php](body)]
- sqlite3 db {}
- db eval {CREATE TABLE shows(date text, time text, name text)}
- set lines [split $data \n]
- foreach line $lines {
- set type {}
- regexp {\[(.*)?\](.*)\[.*\]} $line -> type value
- switch $type {
- DAY {set current_day $value }
- TIME {set show_time $value ; set show_nr 0}
- SHOW {db eval {INSERT INTO shows VALUES($current_day,$show_time, $value)}}
- default {continue}
- }
- }
- db eval {SELECT * from shows WHERE date="Wednesday, 25 Oct 2006" ORDER BY time } {
- puts "$time: $name"
- }
- db close