Advertisement
Weegee

Untitled

Aug 6th, 2012
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 6.25 KB | None | 0 0
  1. $ diff tv_addon_otr\ \(2\).tcl tv_addon_otr\ \(1\).tcl
  2. 6,54c6,19
  3. <   #if {[catch {set t [http::geturl "http://www.onlinetvrecorder.com/downloader/api/stations.php" -timeout 25000]} err]} {
  4. <   #  putlog "Error while fetching TV Stations" ;return
  5. <   #} elseif {[http::status $t]!="ok"} {
  6. <   #  putlog "Error while fetching TV Stations: [http::status $t]"; http::cleanup $t ;return
  7. <   #}
  8. <   #set h [http::data $t] ;http::cleanup $t
  9. <   #foreach l [split $h \n] {
  10. <   #  set F [string range $l [expr {[string first < $l]+1}] [expr {[string first > $l]-1}]]
  11. <   #  set E [string tolower [string range $l [expr {[string first > $l]+1}] [expr {[string last < $l]-1}]]]
  12. <   #  if {[string equal $F "TITLE"]} {set x $E}
  13. <   #  if {[string equal $F "COUNTRY"] && ([string equal $E "de"] || [string equal $E "at"] || [string equal $E "ch"])} {
  14. <   #    if {![info exists channels] || [lsearch -exact channels $x]=="-1"} {lappend channels $x}
  15. <   #    regsub -all {[^a-zA-Z0-9]} $x "\\1" x
  16. <   #    if {![info exists ::tv(sender_$x)]} {set ::tv(sender_$x) 0}
  17. <   #  }
  18. <   #}
  19. <   #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}
  20. <   foreach date [list "[clock seconds]" "[clock scan "+1 day"]"] {
  21. <     putlog "Getting TV Data for [clock format $date -format "%d.%m.%Y"]"
  22. <     #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]} {}
  23. <     if {[catch {set t [http::geturl "http://www.onlinetvrecorder.com/epg/csv/epg_[clock format $date -format "%Y_%m_%d"].csv" -timeout 25000]} err]} {
  24. <       putlog "Error while fetching TV Data" ;return
  25. <     } elseif {[http::status $t]!="ok"} {
  26. <       putlog "Error while fetching TV Data: [http::status $t]"; http::cleanup $t ;return
  27. <     }
  28. <     set h [http::data $t] ;http::cleanup $t
  29. <     set index "0"
  30. <     foreach l [split $h \n] {
  31. <       if {$index=="0"} {incr index; continue}
  32. <       set l [split $l ";"]
  33. <       if {[lindex $l 1]==""} {break}
  34. <       set timestamp [clock scan [lindex $l 1] -format "%d.%m.%Y %H:%M:%S"]
  35. <       set time [clock format $timestamp -format "%H:%M"] ;# Beginnzeit
  36. <       set hr [lindex [split $time ":"] 0]
  37. <       set min [lindex [split $time ":"] 1]
  38. <       #if {[lindex $l 1]>[clock scan "+1 day 23:59:59"]} {continue}
  39. <       set chan [string tolower [lindex $l 4]] ;# Sender
  40. <       regsub -all {[^a-zA-Z0-9]} $chan "\\1" chan
  41. <       if {![info exists ::tv(sender_$chan)]} {set ::tv(sender_$chan) 0}
  42. <       set show [lindex $l 5] ;# Sendung
  43. <       set dscr [lindex $l 6] ;# Beschreibung
  44. <       if {[lindex $l 9]!=""} {append dscr ", [lindex $l 9]"} ;# FSK
  45. <       putloglev 2 * "Got a new entry for $chan: \"[clock format $timestamp -format "%d.%m.%Y - %H:%M"]\" \"$show\" \"$dscr\""
  46. <       if {[clock format $timestamp -format "%d"]!=[clock format [clock seconds] -format "%d"]} {
  47. <         set hr [string trimleft $hr 0] ;if {$hr==""} {set hr 0}
  48. <         incr hr 24
  49. <       }
  50. <       set time $hr:$min
  51. <       lappend ::tvcache($chan) "$time" "[encrypt specialchar $show]" "[encrypt specialchar $dscr]"
  52. ---
  53. >   if {[catch {set t [http::geturl "http://www.onlinetvrecorder.com/downloader/api/stations.php" -timeout 25000]} err]} {
  54. >     putlog "Error while fetching TV Stations" ;return
  55. >   } elseif {[http::status $t]!="ok"} {
  56. >     putlog "Error while fetching TV Stations: [http::status $t]"; http::cleanup $t ;return
  57. >   }
  58. >   set h [http::data $t] ;http::cleanup $t
  59. >   foreach l [split $h \n] {
  60. >     set F [string range $l [expr {[string first < $l]+1}] [expr {[string first > $l]-1}]]
  61. >     set E [string tolower [string range $l [expr {[string first > $l]+1}] [expr {[string last < $l]-1}]]]
  62. >     if {[string equal $F "TITLE"]} {set x $E}
  63. >     if {[string equal $F "COUNTRY"] && ([string equal $E "de"] || [string equal $E "at"] || [string equal $E "ch"])} {
  64. >       if {![info exists channels] || [lsearch -exact channels $x]=="-1"} {lappend channels $x}
  65. >       regsub -all {[^a-zA-Z0-9]} $x "\\1" x
  66. >       if {![info exists ::tv(sender_$x)]} {set ::tv(sender_$x) 0}
  67. 57a23,51
  68. >   putlog "Getting TV Data"
  69. >   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]} {
  70. >     putlog "Error while fetching TV Data" ;return
  71. >   } elseif {[http::status $t]!="ok"} {
  72. >     putlog "Error while fetching TV Data: [http::status $t]"; http::cleanup $t ;return
  73. >   }
  74. >   set h [http::data $t] ;http::cleanup $t
  75. >   set index "0"
  76. >   foreach l [split $h \n] {
  77. >     if {$index=="0"} {incr index; continue}
  78. >     set l [split $l ";"]
  79. >
  80. >     set time [clock format [lindex $l 1] -format "%H:%M"] ;# Beginnzeit
  81. >     set hr [lindex [split $time ":"] 0]
  82. >     set min [lindex [split $time ":"] 1]
  83. >     if {[clock format [lindex $l 1] -format "%d"]>[clock format [clock scan "+1 day"] -format "%d"]} {continue}
  84. >     set chan [string tolower [lindex $l 4]] ;# Sender
  85. >     regsub -all {[^a-zA-Z0-9]} $chan "\\1" chan
  86. >     set show [lindex $l 5] ;# Sendung
  87. >     set dscr [lindex $l 6] ;# Beschreibung
  88. >     if {[lindex $l 9]!=""} {append dscr ", [lindex $l 9]"} ;# FSK
  89. >     putloglev 2 * "Got a new entry for $chan: \"[clock format [lindex $l 1] -format "%d.%m.%Y - %H:%M"]\" \"$show\" \"$dscr\""
  90. >     if {[clock format [lindex $l 1] -format "%d"]!=[clock format [clock seconds] -format "%d"]} {
  91. >       set hr [string trimleft $hr 0] ;if {$hr==""} {set hr 0}
  92. >       incr hr 24
  93. >     }
  94. >     set time $hr:$min
  95. >     lappend ::tvcache($chan) "$time" "[encrypt specialchar $show]" "[encrypt specialchar $dscr]"
  96. >   }
  97. 62c56
  98. < foreach bind [binds cachetvdata] {foreach {1 2 3 4 5} $bind {break}; unbind $1 $2 $3 $5}; bind time - "00 05 *" cachetvdata
  99. ---
  100. > 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