egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

tvprog.tcl - even more tv stuff (!today and !tomorrow)

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
greenbear
Owner


Joined: 24 Sep 2001
Posts: 733
Location: Norway

PostPosted: Fri Jul 08, 2005 5:19 pm    Post subject: tvprog.tcl - even more tv stuff (!today and !tomorrow) Reply with quote

Code:
############################################
# tvprog.tcl v0.1 by greenbear at gmail.com
#
# Parse the tv-program for today and
# tomorrow from thefutoncritic.com.
#
# Enable with .chanset #channel +tv
#

bind pub - !today pub:tfctoday
bind pub - !tomorrow pub:tfctomorrow

if ![info exists egghttp(version)] {
  putlog "egghttp.tcl was NOT successfully loaded."
}

setudef flag tv

proc pub:tfctoday {nick uhost hand chan text} {
if ![channel get $chan tv] return
  set sock [egghttp:geturl http://www.thefutoncritic.com/cgi/calendar.cgi?view=whatsnew [list parse:tfc $chan 0] -crlf 1]
}

proc pub:tfctomorrow {nick uhost hand chan text} {
  if ![channel get $chan tv] return
  set sock [egghttp:geturl http://www.thefutoncritic.com/cgi/calendar.cgi?view=whatsnew [list parse:tfc $chan 1] -crlf 1]
}

proc parse:tfc {chan type sock} {
 set data [egghttp:data $sock]
 egghttp:cleanup $sock

 set data [string map {"\n" ""} $data]
 set data [string map {"<td>" "<td>\n" "</td>" "</td>\n"} $data]
 set data [string map {"</a><br><i>" " - "} $data]
 set data [string map {"</p>" "</p>\n" "<br>" "<br>\n"} $data]

 if {$type} {
  scan [clock format [clock scan tomorrow] -format "%m/%d/%Y"] %d/%d/%d m d y
 } {
  scan [strftime "%m/%d/%Y"] %d/%d/%d m d y
 }
 set when "$m/$d/$y"

 set parse 0
 foreach line [split $data \n] {
  if {!$parse&&[string match -noc "*$when*" $line]} {set parse 1}
  if {$parse&&[string match -noc "*middle*content*ends*" $line]} {return}
  if {$parse} {
   regsub -all {<(.|\n)*?>} $line {} clean
   set out [join $clean]
   if {$out==""} {return}
    putserv "PRIVMSG $chan :$out"
  }
 }
}

putlog "* tvprog.tcl loaded."


Back to top
View user's profile Send private message Send e-mail
TaRgEt
Voice


Joined: 27 Sep 2005
Posts: 4

PostPosted: Tue Sep 27, 2005 4:12 pm    Post subject: Reply with quote

[09:19] Tcl error [pub:tfctoday]: Unknown option -crlf, can be: -timeout, -query, -headers, -protocol, -useragent

how do i fix that ?
Back to top
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Wed Sep 28, 2005 3:34 am    Post subject: Reply with quote

try using the most recent egghttp vesion.
_________________
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Back to top
View user's profile Send private message MSN Messenger
phab
Voice


Joined: 22 Aug 2005
Posts: 12

PostPosted: Fri Oct 07, 2005 4:25 am    Post subject: Reply with quote

Why don't you use the http package?
Back to top
View user's profile Send private message
greenbear
Owner


Joined: 24 Sep 2001
Posts: 733
Location: Norway

PostPosted: Fri Oct 07, 2005 1:44 pm    Post subject: Reply with quote

so you get to ask stupid questions
Back to top
View user's profile Send private message Send e-mail
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Fri Oct 07, 2005 2:57 pm    Post subject: Reply with quote

many users had issues with http package crashing the bot. I never got known which systems were affected, but it might have been a windrop pre TCL 8.4.9 issue (windrop admin changed something in the way he compiled TCL for cygwin). So it might nolonger be neccesary to use egghttp, but it would be a hassle to rewrite it back to http Very Happy.
_________________
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Back to top
View user's profile Send private message MSN Messenger
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Fri Oct 07, 2005 3:26 pm    Post subject: Reply with quote

other than personal preferences and habits (everyone has theirs), there couldn't possibly exist a single reason for choosing egghttp over Tcl's built-in http package - the latter is much superior to the former

egghttp might have been much more useful several years ago, but since then both eggdrop and Tcl have made huge improvements

from egghttp's header:
Quote:

# I noticed the need when using the http package for tcl,
# and it would not, for some reason or other, properly
# use asynchronous connections or not do anything at all when
# trying to use async connections.
# ^- As it turns out, eggdrop1.1.5 (and I believe 1.3.x) does
# not have Tcl_DoOneEvent in the source, so the http package fails
# for async connections, thus the need for this script.
#
# Realizing eggdrop already had the ability to make async connections,
# I created this considerably smaller tcl (in comparison to the http
# package).


none of these points is valid today; I use async [http::geturl] on multiple rss feeds (HTTP connections) simultaneously, without the slightest problem or bogging down the bot, let alone crashing it
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
qw3rty
Voice


Joined: 06 Apr 2006
Posts: 4

PostPosted: Thu Apr 06, 2006 11:52 pm    Post subject: working Reply with quote

is this working or still working for anyone else?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber