Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ diff tv_addon_otr\ \(2\).tcl tv_addon_otr\ \(1\).tcl
- 6,54c6,19
- < #if {[catch {set t [http::geturl "http://www.onlinetvrecorder.com/downloader/api/stations.php" -timeout 25000]} err]} {
- < # putlog "Error while fetching TV Stations" ;return
- < #} elseif {[http::status $t]!="ok"} {
- < # putlog "Error while fetching TV Stations: [http::status $t]"; http::cleanup $t ;return
- < #}
- < #set h [http::data $t] ;http::cleanup $t
- < #foreach l [split $h \n] {
- < # set F [string range $l [expr {[string first < $l]+1}] [expr {[string first > $l]-1}]]
- < # set E [string tolower [string range $l [expr {[string first > $l]+1}] [expr {[string last < $l]-1}]]]
- < # if {[string equal $F "TITLE"]} {set x $E}
- < # if {[string equal $F "COUNTRY"] && ([string equal $E "de"] || [string equal $E "at"] || [string equal $E "ch"])} {
- < # if {![info exists channels] || [lsearch -exact channels $x]=="-1"} {lappend channels $x}
- < # regsub -all {[^a-zA-Z0-9]} $x "\\1" x
- < # if {![info exists ::tv(sender_$x)]} {set ::tv(sender_$x) 0}
- < # }
- < #}
- < #if {[llength [array names ::tv sender_*]]!="0"} {putlog "Found [llength [array names ::tv sender_*]] Stations"} {putlog "Error while fetching TV Stations: no TV Stations found." ;return}
- < foreach date [list "[clock seconds]" "[clock scan "+1 day"]"] {
- < putlog "Getting TV Data for [clock format $date -format "%d.%m.%Y"]"
- < #if {[catch {set t [http::geturl "http://www.onlinetvrecorder.com/index.php?aktion=epg_export&format=csv&btn_ok=OK&stations=[http::formatQuery [join $channels ","]]&from=[clock format [clock seconds] -format "%d.%m.%Y"]&to=[clock format [clock scan "+2 day"] -format "%d.%m.%Y"]" -timeout 25000]} err]} {}
- < if {[catch {set t [http::geturl "http://www.onlinetvrecorder.com/epg/csv/epg_[clock format $date -format "%Y_%m_%d"].csv" -timeout 25000]} err]} {
- < putlog "Error while fetching TV Data" ;return
- < } elseif {[http::status $t]!="ok"} {
- < putlog "Error while fetching TV Data: [http::status $t]"; http::cleanup $t ;return
- < }
- < set h [http::data $t] ;http::cleanup $t
- < set index "0"
- < foreach l [split $h \n] {
- < if {$index=="0"} {incr index; continue}
- < set l [split $l ";"]
- < if {[lindex $l 1]==""} {break}
- < set timestamp [clock scan [lindex $l 1] -format "%d.%m.%Y %H:%M:%S"]
- < set time [clock format $timestamp -format "%H:%M"] ;# Beginnzeit
- < set hr [lindex [split $time ":"] 0]
- < set min [lindex [split $time ":"] 1]
- < #if {[lindex $l 1]>[clock scan "+1 day 23:59:59"]} {continue}
- < set chan [string tolower [lindex $l 4]] ;# Sender
- < regsub -all {[^a-zA-Z0-9]} $chan "\\1" chan
- < if {![info exists ::tv(sender_$chan)]} {set ::tv(sender_$chan) 0}
- < set show [lindex $l 5] ;# Sendung
- < set dscr [lindex $l 6] ;# Beschreibung
- < if {[lindex $l 9]!=""} {append dscr ", [lindex $l 9]"} ;# FSK
- < putloglev 2 * "Got a new entry for $chan: \"[clock format $timestamp -format "%d.%m.%Y - %H:%M"]\" \"$show\" \"$dscr\""
- < if {[clock format $timestamp -format "%d"]!=[clock format [clock seconds] -format "%d"]} {
- < set hr [string trimleft $hr 0] ;if {$hr==""} {set hr 0}
- < incr hr 24
- < }
- < set time $hr:$min
- < lappend ::tvcache($chan) "$time" "[encrypt specialchar $show]" "[encrypt specialchar $dscr]"
- ---
- > if {[catch {set t [http::geturl "http://www.onlinetvrecorder.com/downloader/api/stations.php" -timeout 25000]} err]} {
- > putlog "Error while fetching TV Stations" ;return
- > } elseif {[http::status $t]!="ok"} {
- > putlog "Error while fetching TV Stations: [http::status $t]"; http::cleanup $t ;return
- > }
- > set h [http::data $t] ;http::cleanup $t
- > foreach l [split $h \n] {
- > set F [string range $l [expr {[string first < $l]+1}] [expr {[string first > $l]-1}]]
- > set E [string tolower [string range $l [expr {[string first > $l]+1}] [expr {[string last < $l]-1}]]]
- > if {[string equal $F "TITLE"]} {set x $E}
- > if {[string equal $F "COUNTRY"] && ([string equal $E "de"] || [string equal $E "at"] || [string equal $E "ch"])} {
- > if {![info exists channels] || [lsearch -exact channels $x]=="-1"} {lappend channels $x}
- > regsub -all {[^a-zA-Z0-9]} $x "\\1" x
- > if {![info exists ::tv(sender_$x)]} {set ::tv(sender_$x) 0}
- 57a23,51
- > putlog "Getting TV Data"
- > if {[catch {set t [http::geturl "http://www.onlinetvrecorder.com/index.php?aktion=epg_export&format=csv&btn_ok=OK&stations=[http::formatQuery [join $channels ","]]&from=[clock format [clock seconds] -format "%d.%m.%Y"]&to=[clock format [clock scan "+2 day"] -format "%d.%m.%Y"]" -timeout 25000]} err]} {
- > putlog "Error while fetching TV Data" ;return
- > } elseif {[http::status $t]!="ok"} {
- > putlog "Error while fetching TV Data: [http::status $t]"; http::cleanup $t ;return
- > }
- > set h [http::data $t] ;http::cleanup $t
- > set index "0"
- > foreach l [split $h \n] {
- > if {$index=="0"} {incr index; continue}
- > set l [split $l ";"]
- >
- > set time [clock format [lindex $l 1] -format "%H:%M"] ;# Beginnzeit
- > set hr [lindex [split $time ":"] 0]
- > set min [lindex [split $time ":"] 1]
- > if {[clock format [lindex $l 1] -format "%d"]>[clock format [clock scan "+1 day"] -format "%d"]} {continue}
- > set chan [string tolower [lindex $l 4]] ;# Sender
- > regsub -all {[^a-zA-Z0-9]} $chan "\\1" chan
- > set show [lindex $l 5] ;# Sendung
- > set dscr [lindex $l 6] ;# Beschreibung
- > if {[lindex $l 9]!=""} {append dscr ", [lindex $l 9]"} ;# FSK
- > putloglev 2 * "Got a new entry for $chan: \"[clock format [lindex $l 1] -format "%d.%m.%Y - %H:%M"]\" \"$show\" \"$dscr\""
- > if {[clock format [lindex $l 1] -format "%d"]!=[clock format [clock seconds] -format "%d"]} {
- > set hr [string trimleft $hr 0] ;if {$hr==""} {set hr 0}
- > incr hr 24
- > }
- > set time $hr:$min
- > lappend ::tvcache($chan) "$time" "[encrypt specialchar $show]" "[encrypt specialchar $dscr]"
- > }
- 62c56
- < foreach bind [binds cachetvdata] {foreach {1 2 3 4 5} $bind {break}; unbind $1 $2 $3 $5}; bind time - "00 05 *" cachetvdata
- ---
- > foreach bind [binds cachetvdata] {foreach {1 2 3 4 5} $bind {break}; unbind $1 $2 $3 $5}; bind time - "00 00 *" cachetvdata
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement