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 

Tv.com tv show info grabber?
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
koom
Voice


Joined: 30 Jul 2005
Posts: 22

PostPosted: Fri Aug 05, 2005 9:07 am    Post subject: Tv.com tv show info grabber? Reply with quote

Hey all,

I'm looking for a script to use in my channel to find out the info of a tv show. for example :

When i trigger the trigger, !TVinfo 24 in this case (24 obviously being the tv show)

http://www.tv.com/24/show/3866/summary.html
Genre: : Action/Adventure , Drama
Tagline: Counter-Terrorism agent Jack Bauer (Kiefer Sutherland) fights the bad guys of the world, one day at a time.
Runtime: 60 minutes
Rating: 9.0 Superb

I would look into doing this myself, but i am a complete noob at tcl scripting..

Hopefully someone can help me out Smile
Thanks alot,
Koom
Back to top
View user's profile Send private message
demond
Revered One


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

PostPosted: Fri Aug 05, 2005 9:56 pm    Post subject: Reply with quote

that someone could only be greenbear Wink check out his tv.com script in the other forum and hope he'll be bored enough, having nothing better to do, to implement what you want
Back to top
View user's profile Send private message Visit poster's website
koom
Voice


Joined: 30 Jul 2005
Posts: 22

PostPosted: Sat Aug 06, 2005 7:06 am    Post subject: Reply with quote

thanks demond, will ask him now Smile
Back to top
View user's profile Send private message
theauth0r
Voice


Joined: 04 Aug 2005
Posts: 6

PostPosted: Sat Aug 06, 2005 7:13 pm    Post subject: Reply with quote

any update on this topic..
I wouldnt mind having this script if possible


Smile

thx
Back to top
View user's profile Send private message
koom
Voice


Joined: 30 Jul 2005
Posts: 22

PostPosted: Sun Aug 07, 2005 4:25 am    Post subject: Reply with quote

i completely forgot to ask him! will do now
Back to top
View user's profile Send private message
greenbear
Owner


Joined: 24 Sep 2001
Posts: 733
Location: Norway

PostPosted: Sun Aug 07, 2005 11:05 am    Post subject: Reply with quote

Sure, I wouldnt mind doing this.. The only problem is I dont see any of that info you asked for on that tv.com page.
A page search returns nothing on both genre, tagline and runtime.
Back to top
View user's profile Send private message Send e-mail
w0lfstar
Voice


Joined: 20 May 2005
Posts: 22

PostPosted: Sun Aug 07, 2005 1:30 pm    Post subject: Reply with quote

i think a script that tells latest and next episode is what people would like more, since all the scripts that are available are outdated because of tv.com changes.

example:

Joe: !tv 24
Bot: Tv Info for: 24 (Action/Adventure , Drama)
Bot: Latest: S04E24 - Day 4: 6:00 A.M.-7:00 A.M. on 5/23/2005
Bot: Next: Unknown.

Joe: !tv desperate housewives
Bot: Tv Info for: Desperate Housewives (Drama , Comedy)
Bot: Latest: S01E23 - One Wonderful Day on 5/22/2005
Bot: Next: S02E01 - Season 2 Premiere (TBA) on 9/25/2005

etc..what do you think? I'm not sure if epguides.com is more easy, but such a script might be wanted by many Smile

greets wolfy.
Back to top
View user's profile Send private message
greenbear
Owner


Joined: 24 Sep 2001
Posts: 733
Location: Norway

PostPosted: Sun Aug 07, 2005 2:48 pm    Post subject: Reply with quote

ok, I think this is somewhat what koom had in mind...
Code:
###
# Parse show info from tv.com

# Enable with .chanset #channel +tv

# [0/1] public or private reply's (public 0, private 1)
set tvreply 0

# offset to EST
# 6 hours makes sense for CET (Europe)
set tvoffset 6

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

setudef flag tv

bind pub - !tvinfo pub:info.tv.com

proc pub:info.tv.com {nick uhost hand chan text} {
  if ![channel get $chan tv] return
  if {$::tvreply} {set target $nick} {set target $chan}
  if {$text==""} {putserv "PRIVMSG $target :Usage: $::lastbind <show>"; return}
  set search [join [lrange [split $text] 0 e] {+}]
  set d [date:offset [clock seconds] %m%d%y]
  set url "http://www.tv.com/search.php?type=11&stype=program&qs=$search&search=Search/"
  set sock [egghttp:geturl $url [list findrealurl:tv.com $target] -headers "Cookie: tv_promo_$d=1"]
}

proc findrealurl:tv.com {target sock} {
 set data [egghttp:data $sock]
 egghttp:cleanup $sock

 foreach line [split $data \n] {
  if [string match -noc "*returned no results*" $line] {
    putserv "PRIVMSG $target :Unknown show."
    return
  }
  if [string match -noc *www.tv.com*show*summary.html* $line] {
    regexp -nocase {(http://)[^\"]+} $line url
    set d [date:offset [clock seconds] %m%d%y]
    set s [egghttp:geturl $url [list parseinfo:tv.com $target $url] -headers "Cookie: tv_promo_$d=1"]
    return
  }
 }
}

proc parseinfo:tv.com {target url sock} {
 set data [egghttp:data $sock]
 egghttp:cleanup $sock

 set data [string map {"\n" "" "</div>" "</div>\n" "<br />" "<br />\n"} $data]
 foreach line [split $data \n] {
   if [regexp {<title>(.*).TV Show} $line . show] {
     putserv "PRIVMSG $target :Show: $show"
   }
   if [string match -noc "*Airs:*" $line] {
     regsub -all {<(.|\n)*?>} $line {} airs
     putserv "PRIVMSG $target :[concat [join $airs]]"
   }
   if [string match -noc "*Status:*" $line] {
     regsub -all {<(.|\n)*?>} $line {} status
     putserv "PRIVMSG $target :[concat [join $status]]"
   }
   if [string match -noc "*Premiered*" $line] {
     regsub -all {<(.|\n)*?>} $line {} premiered
     putserv "PRIVMSG $target :[concat [join $premiered]]"
   }
   if [string match -noc "*Show Category:*" $line] {
     regsub -all {<(.|\n)*?>} $line {} category
     putserv "PRIVMSG $target :[concat [join $category]]"
   }
   if [string match -noc "*Full Summary*" $line] {
     regsub -all {<(.|\n)*?>} $line {} summary
     regexp {(.*) Full Summary} $summary . summary
     putserv "PRIVMSG $target :Summary: [concat [join $summary]]"
   }
 }
 putserv "PRIVMSG $target :URL: $url"
}

proc date:offset {epox arg} {
 set t [expr $epox-((60*60)*$::tvoffset)]
 set w [clock format $t -format $arg]
 return $w
}

EDIT: Added option for public/private replies.


Last edited by greenbear on Sat Aug 13, 2005 12:19 am; edited 3 times in total
Back to top
View user's profile Send private message Send e-mail
koom
Voice


Joined: 30 Jul 2005
Posts: 22

PostPosted: Mon Aug 08, 2005 4:55 am    Post subject: Reply with quote

thanks for your help greenbear, really appreciated Smile

i just installed the script, but when i went to enable it by:
.chanset #koom +tv
this didnt work. errored with

chanset #koom +tv
::18:20:: -BTC|Bot- Error trying to set +tv for #koom, invalid mode.
Back to top
View user's profile Send private message
greenbear
Owner


Joined: 24 Sep 2001
Posts: 733
Location: Norway

PostPosted: Mon Aug 08, 2005 5:01 am    Post subject: Reply with quote

oops, seems like I forgot to define it.. it's fixed now
Back to top
View user's profile Send private message Send e-mail
koom
Voice


Joined: 30 Jul 2005
Posts: 22

PostPosted: Mon Aug 08, 2005 5:07 am    Post subject: Reply with quote

wow thanks for the fast reply Wink
seems the other error is gone now, but another one has appeared (as what happens always with tcl scripting, hehe)

::18:36:: -BTC|Bot- [03:07] Tcl error [pub:info.tv.com]: invalid command name "egghttp:geturl"

Thanks alot,
koom
Back to top
View user's profile Send private message
greenbear
Owner


Joined: 24 Sep 2001
Posts: 733
Location: Norway

PostPosted: Mon Aug 08, 2005 5:15 am    Post subject: Reply with quote

load egghttp.tcl before this one
Back to top
View user's profile Send private message Send e-mail
koom
Voice


Joined: 30 Jul 2005
Posts: 22

PostPosted: Mon Aug 08, 2005 5:45 am    Post subject: Reply with quote

sorry, but where can i find this egghttp.tcl? (like i said before, noob at this kinda stuff, Embarassed Embarassed )
Back to top
View user's profile Send private message
koom
Voice


Joined: 30 Jul 2005
Posts: 22

PostPosted: Mon Aug 08, 2005 5:49 am    Post subject: Reply with quote

ah dont worry about it, a quick search found it,now to test it Smile
Back to top
View user's profile Send private message
koom
Voice


Joined: 30 Jul 2005
Posts: 22

PostPosted: Mon Aug 08, 2005 5:58 am    Post subject: Reply with quote

Yay, script works great, thanks alot greenbear Smile

Also, anyway to make it so that script notices people instead of spamming the channel?

Other then that, it works like a charm Very Happy

also, is it possible for it to display the link last?

Thanks Smile
Koom
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
Goto page 1, 2, 3  Next
Page 1 of 3

 
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