<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/16612" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2009-02-21T08:04:16-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/16612</id>

		<entry>
		<author><name><![CDATA[Fire-Fox]]></name></author>
		<updated>2009-02-21T08:04:16-04:00</updated>

		<published>2009-02-21T08:04:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87502#p87502</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87502#p87502"/>
		<title type="html"><![CDATA[tv search (Danish, or can be edited to it)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87502#p87502"><![CDATA[
Please close the topic <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8230">Fire-Fox</a> — Sat Feb 21, 2009 8:04 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Fire-Fox]]></name></author>
		<updated>2009-02-13T12:26:14-04:00</updated>

		<published>2009-02-13T12:26:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87390#p87390</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87390#p87390"/>
		<title type="html"><![CDATA[Re: tv search (Danish, or can be edited to it)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87390#p87390"><![CDATA[
<blockquote class="uncited"><div><div class="codebox"><p>Code: </p><pre><code>  if {[regexp $tv(regex) $line garbage time title]} { </code></pre></div>what does $tv(regex) contain? As GI Joe once said, knowing is half the battle. Without knowing this battle is surely lost..  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_lol.gif" width="15" height="15" alt=":lol:" title="Laughing"></div></blockquote>Have no clue. <br><br>but here is the whole code<br><div class="codebox"><p>Code: </p><pre><code>package require http#tvrip2.tcl version 2.10 Released 15-08-2003set tv(lastid) 0set tv(regex) "&lt;div&gt;&lt;span class='.*'&gt;(.*)&lt;/span&gt;  &lt;span class='.*' onclick='.*'&gt;(.*)&lt;/span&gt;.*"setudef flag tvripproc tv:add {station time title} {global tv tvdbset id [incr tv(lastid)]set tvdb($id,station) $stationset tvdb($id,time) $timeset tvdb($id,title) $titlereturn $id}bind pub -|- !rehash pub:update:listproc pub:update:list {nick uhost handle chan text} {putserv "PRIVMSG $chan :Updateing lists"tv:update:list}proc tv:update:list {} { global tvrip tvdb catch { unset tvdb } set tvrip(db) "" set kanalnavne ""TV2" "TV2ZULU" "DR1" "DR2" "TV3+" "TV3" "TVDK1" "TVDK2"" set i 0 foreach kanal $kanalnavne {  incr i  set url "http://tv.tv2.dk/tv/listning.php?sektion&amp;Soegeord=&amp;Kategori=0&amp;Periode=-1&amp;KanalID=$i&amp;Region=0&amp;dato=3"  utimer [expr $i * 5] "gettitles [join [lindex $kanalnavne [expr $i - 1]]] $url" }}proc getnow {} {  #Return min of day  set usecs [clock seconds]  set h [clock format $usecs -format "%H"]  set m [clock format $usecs -format "%M"]  if {[string index $h 0]==0} { set h [string index $h 1] }# set h [expr $h + 6] ; #To compensate for timezone diff.  if {$h &gt; 23} { set h [expr $h - 24] }  if {[string index $m 0]==0} { set m [string index $m 1] }  set res [expr $h * 60]  set res [expr $res + $m]  if {$res &gt; 1400} { set res [expr $res - 1400] }  return $res}proc hhmm2minofday {time} {  set hh [join [lindex [split $time ":"] 0]]  set min [join [lindex [split $time ":"] 1]]  if {[string index $hh 0]==0} { set hh [string index $hh 1] }  if {[string index $min 0]==0} { set min [string index $min 1] }  set res [expr $hh * 60]  set res [expr $res + $min]  return $res}proc gettitles {tvkanal url} { global tv tvdb set token [http::geturl $url] upvar #0 $token state set lines 0 foreach line [split $state(body) "\n"] {  incr lines  if {[string match "*&lt;span class='udsendelse-symboler'&gt;*" $line]} {   set line [string range $line 0 [string first "&lt;span class='udsendelse-symboler'&gt;" $line]]  }  if {[regexp $tv(regex) $line garbage time title]} {   if {[string match -nocase "*&lt;/span&gt;*" $title]} {    set title [string range $title 0 [expr [string first "&lt;/span&gt;" $title] - 1]]   }    #$time should be converted to the min of day    set time [hhmm2minofday $time]    tv:add $tvkanal $time $title  } }if {$lines &lt; 15} {timer 1 "gettitles $tvkanal $url"putserv "RIVMSG #dktv :Update of $tvkanal failed, retrying in 60secs"putlog "Update of $tvkanal failed, retrying in 60secs"} else { putlog "Updated $tvkanal" putserv "PRIVMSG #dktv :Updated $tvkanal"}}proc nowplus {min} { set next [expr $min + [getnow]] if {$next &gt; 1440} { set next [expr $next - 1440] } return $next}proc notifychan {s t} {foreach chan [channels] { if {[lsearch [channel info $chan] +tvrip]&gt;-1 &amp;&amp; [lsearch [channel info $chan] -inactive]&gt;-1} {  putserv "PRIVMSG $chan :\[$s\] $t" }}}bind time - "* * * * *" tv:db:warnproc tv:db:warn {min hour day month year} {global tvdbif {[getnow]==304} { tv:update:list }  ;  #tv2.dk resets at 300#  set warn [nowplus 5]  set warn [getnow]  putloglev 5 * "Looking for programs with time $warn"  set size [array size tvdb]  for {set i 0} {$i&lt;$size} {incr i} {   set col [array get tvdb $i,*]   if {$col != ""} {    set time [tvdb:getfield $i time]    putloglev 4 * "$time == $warn"    if {$time == $warn} {     set title [tvdb:getfield $i title]     set station [tvdb:getfield $i station]     notifychan $station $title    }   }  }}proc tvdb:getfield {id field} { global tvdbreturn [join [lindex [array get tvdb $id,$field] 1]] }proc humantime {time} {set hour 0set min 0while {$time&gt;59} {set time [expr $time - 60]incr hour}set min $timeif {$hour&lt;9} { set hour "0$hour" }if {$min&lt;9} { set min "0$min" }return $hour:$min}proc islater {now time} { #return 1 if time is later then now if {$now &lt; 300} {  #After midnight and before update  if {$time &gt; $now &amp;&amp; $time &lt; 300} { return 1 }  return 0 } if {$now == 300} { return 0 } if {$now &gt; 300} {  #After update time  if {$time &gt; $now} { return 1 }  if {$time &lt; 300} { return 1 }  return 0 }}#!tv &lt;kanal&gt;#!tvall#!searchbind pub -|- !tv pub:tvproc pub:tv {nick uhost handle chan text} {global tvdbset kanal [join [lindex $text 0]]#Find next 5 programs on kanalset size [array size tvdb]set now [getnow]set found 0for {set i 0} {$i&lt;$size} {incr i} {set col [array get tvdb $i,*]if {$col != ""} {set time [tvdb:getfield $i time]set station [tvdb:getfield $i station]if {[string match -nocase $station $kanal]} {if {[islater $now $time]} {incr foundset title [tvdb:getfield $i title]set htime [humantime $time]putserv "PRIVMSG $nick :$htime $title"if {$found==5} { break }}}}}}bind pub -|- !tvall pub:tvallproc pub:tvall {nick uhost handle chan text} {global tvdb#Find next program for all channels.set size [array size tvdb]set now [getnow]set found ""for {set i 0} {$i&lt;$size} {incr i} {set col [array get tvdb $i,*]if {$col != ""} {set time [tvdb:getfield $i time]set station [tvdb:getfield $i station]if {[lsearch $found $station]!=-1} {if {[islater $now $time]} {lappend found $stationset title [tvdb:getfield $i title]set htime [humantime $time]putserv "PRIVMSG $nick :$htime \[$station\] $title"putloglev 8 * "Found=[llength $found]"if {[llength $found]==8} { break }}}}}}bind pub -|- !search pub:searchproc pub:search {nick uhost handle chan text} {global tvdbset program [join [lindex $text 0]]#Find all future programs containing program (max 10)set size [array size tvdb]set now [getnow]set found 0for {set i 0} {$i&lt;$size} {incr i} {set col [array get tvdb $i,*]if {$col != ""} {set time [tvdb:getfield $i time]set title [tvdb:getfield $i title]if {[string match -nocase "*$program*" $title]} {if {[islater $now $time]} {incr foundset station [tvdb:getfield $i station]set htime [humantime $time]putserv "PRIVMSG $nick :$htime \[$station\] $title"if {[llength $found]==10} { break }}}}}if {$found==0} { putserv "PRIVMSG $nick :Sorry, no matches" }}#TODO : pub triggers /msg triggersif {![info exists tv(started)]} { utimer 20 tv:update:list set tv(started) 1}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8230">Fire-Fox</a> — Fri Feb 13, 2009 12:26 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2009-02-12T19:16:50-04:00</updated>

		<published>2009-02-12T19:16:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87384#p87384</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87384#p87384"/>
		<title type="html"><![CDATA[Re: tv search (Danish, or can be edited to it)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87384#p87384"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>  if {[regexp $tv(regex) $line garbage time title]} { </code></pre></div>what does $tv(regex) contain? As GI Joe once said, knowing is half the battle. Without knowing this battle is surely lost..  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_lol.gif" width="15" height="15" alt=":lol:" title="Laughing"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Thu Feb 12, 2009 7:16 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Fire-Fox]]></name></author>
		<updated>2009-02-12T14:07:49-04:00</updated>

		<published>2009-02-12T14:07:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87374#p87374</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87374#p87374"/>
		<title type="html"><![CDATA[tv search (Danish, or can be edited to it)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87374#p87374"><![CDATA[
no one <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy">?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8230">Fire-Fox</a> — Thu Feb 12, 2009 2:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Fire-Fox]]></name></author>
		<updated>2009-02-10T16:38:36-04:00</updated>

		<published>2009-02-10T16:38:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87335#p87335</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87335#p87335"/>
		<title type="html"><![CDATA[tv search (Danish, or can be edited to it)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87335#p87335"><![CDATA[
Hey all<br><br>Is there a tv program Somethin like tvrage, where it shows air time and such?<br><br><br>I have tryed : tvrip2.tcl from the archive. <br>but there is and error in script or the site has been changed.<br><blockquote class="uncited"><div>Update of TV3 failed, retrying in 60secs</div></blockquote><div class="codebox"><p>Code: </p><pre><code>proc gettitles {tvkanal url} { global tv tvdb set token [http::geturl $url] upvar #0 $token state set lines 0 foreach line [split $state(body) "\n"] {  incr lines  if {[string match "*&lt;span class='udsendelse-symboler'&gt;*" $line]} {   set line [string range $line 0 [string first "&lt;span class='udsendelse-symboler'&gt;" $line]]  }  if {[regexp $tv(regex) $line garbage time title]} {   if {[string match -nocase "*&lt;/span&gt;*" $title]} {    set title [string range $title 0 [expr [string first "&lt;/span&gt;" $title] - 1]]   }    #$time should be converted to the min of day    set time [hhmm2minofday $time]    tv:add $tvkanal $time $title  } }if {$lines &lt; 15} {timer 1 "gettitles $tvkanal $url"putserv "PRIVMSG #dktv :Update of $tvkanal failed, retrying in 60secs"putlog "Update of $tvkanal failed, retrying in 60secs"} else { putlog "Updated $tvkanal" putserv "PRIVMSG #dktv :Updated $tvkanal"}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8230">Fire-Fox</a> — Tue Feb 10, 2009 4:38 pm</p><hr />
]]></content>
	</entry>
	</feed>
