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 

TVRage.com Schedule Script (Latest: 2.0)
Goto page 1, 2, 3 ... 32, 33, 34  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
GaveUp
Op


Joined: 19 Jan 2006
Posts: 139

PostPosted: Thu Jan 19, 2006 4:01 am    Post subject: TVRage.com Schedule Script (Latest: 2.0) Reply with quote

See https://github.com/GaveUp/tvrageegg for the latest version of this script. The code below is left only for legacy purposes.


Code:

####################
#    tvrage.tcl    #
#   v0.1 19Jan06   #
# Coded By: GaveUp #
####################

###################
#   DESCRIPTION   #
#################################################################################
# This script pulls today's or tomorrow's schedule of new shows from tvrage.com #
#################################################################################

####################
# Revision History #
##########################
# 0.1 -- Initial Release #
##########################

########
# TODO #
#################################################
# *Move hardcoded settings to variables.        #
# *Add support for changing timezones.          #
# *Add support for upto 5 days into the future. #
#################################################

bind pub - !today pub:tvrage.com.today
bind pub - !tomorrow pub:tvrage.com.tomorrow

package require http
setudef flag tv

proc pub:tvrage.com.today {nick uhost hand chan text} {
   parse:tvrage.com $nick $uhost $hand $chan $text "0"
}

proc pub:tvrage.com.tomorrow {nick uhost hand chan text} {
   parse:tvrage.com $nick $uhost $hand $chan $text "1"
}

proc parse:tvrage.com {nick uhost hand chan text when} {
   if ![channel get $chan tv] return
   set token [http::geturl http://www.tvrage.com/quickschedule.php]
   set data [http::data $token]
   http::cleanup $token
   set date ""
   set systemTime [clock seconds]
   set systemTime [expr $systemTime + 3600]
   set currentTime ""
   set parsing 0
   set currentOutput ""
   set gotTime 0
   set neededDate ""

   if {$when == 0} {
      set neededDate [clock format $systemTime -format "%A, %d %b %Y"]
   } elseif {$when == 1} {
      set systemTime [expr "$systemTime + 86400"]
      set neededDate [clock format $systemTime -format "%A, %d %b %Y"]
   }

   foreach line [split $data \n] {
      if {[regexp {^\[DAY\]([\w\, ]+)\[\/DAY\]$} $line -> date]} {
         #putlog "THIS IS THE [censored] DATE: $date"
         if {$parsing == 1} {
            break;
         }
         
         if {$date == $neededDate} {
            putserv "PRIVMSG $chan :\00303New TV Shows for $date ***All Times in EST/EDT***\00315"
            set parsing 1
         }
      }

      if {$parsing} {
         if {[regexp {^\[TIME\]([\w\: ]+)\[\/TIME\]$} $line -> currentTime]} {
            if {$gotTime} {
               set currentOutput [string trim $currentOutput <>]
               putserv "PRIVMSG $chan :$currentOutput"
            }
         
            set currentOutput "\002$currentTime:\002 "
            set gotTime 1
         }

         if {[regexp {^\[SHOW\]([ \w]+)\^([\w \']+)\^([\dx]+)\^([\w\\\/\:\.]+)\[\/SHOW\]$} $line -> network title epnum url]} {
            set currentOutput [concat $currentOutput "\00304$network\00315 - \00314$title $epnum\00315 <>"]
         }
      }
   }
}

putlog "TVRage.com Primetime Schedule v0.1"


Last edited by GaveUp on Sun Feb 28, 2016 4:29 pm; edited 20 times in total
Back to top
View user's profile Send private message
Taz
Voice


Joined: 23 Oct 2005
Posts: 9

PostPosted: Mon Jan 23, 2006 3:56 am    Post subject: Reply with quote

Very Happy Nicely done. I always like to see this theme of script being worked on and shared with us. Thank you. I look forward to seeing what enhancements you make to this script.
Back to top
View user's profile Send private message
GaveUp
Op


Joined: 19 Jan 2006
Posts: 139

PostPosted: Mon Jan 23, 2006 5:48 am    Post subject: Reply with quote

Here's v0.2

Code:
####################
#    tvrage.tcl    #
#   v0.2 23Jan06   #
# Coded By: GaveUp #
####################

###################
#   DESCRIPTION   #
#################################################################################
# This script pulls today's or tomorrow's schedule of new shows from tvrage.com #
#################################################################################

####################
# Revision History #
#####################################################################
# 0.2 -- +!showinfo trigger for detailed show info and next/last ep #
#        +!schedule for 7 day schedule                              #
#        *fixed errors in various regex                             #
# 0.1 -- Initial Release                                            #
#                                                                   #
# + added   - removed   * fixed/changed                             #
#####################################################################

########
# TODO #
#################################################
# *Move hardcoded settings to variables.        #
# *Add support for changing timezones.          #
#################################################

bind pub - !today pub:tvrage.com.today
bind pub - !tomorrow pub:tvrage.com.tomorrow
bind pub - !showinfo pub:tvrage.com.showinfo
bind pub - !schedule pub:tvrage.com.schedule

package require http
setudef flag tv

proc pub:tvrage.com.schedule {nick uhost hand chan text} {
   set seconds [clock seconds]
   set days(sun) 0
   set days(mon) 1
   set days(tue) 2
   set days(wed) 3
   set days(thu) 4
   set days(fri) 5
   set days(sat) 6

   if ![info exist days([string tolower $text])] return

   set currDay [clock format $seconds -format "%w"]
   
   if {$currDay > $days([string tolower $text])} {
      parse:tvrage.com $nick $uhost $hand $chan $text [expr (7 - $currDay) + $days([string tolower $text])]
   } else {
      parse:tvrage.com $nick $uhost $hand $chan $text [expr $days([string tolower $text]) - $currDay]
   }
}
      

proc pub:tvrage.com.today {nick uhost hand chan text} {
   parse:tvrage.com $nick $uhost $hand $chan $text "0"
}

proc pub:tvrage.com.tomorrow {nick uhost hand chan text} {
   parse:tvrage.com $nick $uhost $hand $chan $text "1"
}

proc pub:tvrage.com.showinfo {nick uhost hand chan text} {
   if ![channel get $chan tv] return
   
   set token [http::geturl "http://www.tvrage.com/quickinfo.php?show=$text"]
   set data [http::data $token]
   http::cleanup $token
   set show(title) ""

   foreach line [split $data \n] {
      if {[regexp {^No Show Results Were Found For \".*\"$} $line]} {
         putserv "PRIVMSG $chan :\00303$line\00315"
         return
      }
      if {[regexp {^Show Name@(.*)$} $line -> match]} { set show(title) $match }
      if {[regexp {^Show URL@(.*)$} $line -> match]} { set show(url) $match }
      if {[regexp {^Premiered@(.*)$} $line -> match]} { set show(premiered) $match }
      if {[regexp {^Latest Episode@(\d+)x(\d+)\^([\w\'\.\, ]+)\^([\w\/]+)$} $line -> season episode eptitle epDate]} {
         set show(latest) [join [list "\00303Latest Episode ::\00315 \00304$season" "x$episode - $eptitle ($epDate)\00315"] ""]
      }
      if {[regexp {^Next Episode@(\d+)x(\d+)\^([\w\'\.\, ]+)\^([\w\/]+)$} $line -> season episode eptitle epDate]} {
         set show(next) [join [list "\00303Next Episode ::\00315 \00304$season" "x$episode - $eptitle ($epDate)\00315"] ""]
      }
      if {[regexp {^Country@(.*)$} $line -> match]} { set show(country) $match }
      if {[regexp {^Status@(.*)$} $line -> match]} { set show(status) $match }
      if {[regexp {^Classification@(.*)$} $line -> match]} { set show(class) $match }
   }

   if ![info exist show(next)] { set show(next) "\00303Next Episode ::\00315 \00304N/A\00315" }

   putserv "PRIVMSG $chan :\00303Title ::\00315 \00304$show(title)\00315 \00308<>\00315 \00303URL ::\00315 \00304$show(url)\00315 \00308<>\00315 \00303Premiered ::\00315 \00304$show(premiered)\00315 \00308<>\00315 $show(latest) \00308<>\00315 $show(next) \00308<>\00315 \00303Country ::\00315 \00304$show(country)\00315 \00308<>\00315 \00303Status ::\00315 \00304$show(status)\00315"
}
      

proc parse:tvrage.com {nick uhost hand chan text when} {
   if ![channel get $chan tv] return
   set token [http::geturl http://www.tvrage.com/quickschedule.php]
   set data [http::data $token]
   http::cleanup $token
   set date ""
   set systemTime [clock seconds]
   set systemTime [expr $systemTime + 3600]
   set currentTime ""
   set parsing 0
   set currentOutput ""
   set gotTime 0
   set neededDate ""

   set systemTime [expr "$systemTime + ($when * 86400)"]
   set neededDate [clock format $systemTime -format "%A, %d %b %Y"]

   foreach line [split $data \n] {
      if {[regexp {^\[DAY\]([\w\, ]+)\[\/DAY\]$} $line -> date]} {
         if {$parsing == 1} {
            break;
         }
         
         if {$date == $neededDate} {
            putserv "PRIVMSG $chan :\00303New TV Shows for $date ***All Times in EST/EDT***\00315"
            set parsing 1
         }
      }

      if {$parsing} {
         if {[regexp {^\[TIME\]([\w\: ]+)\[\/TIME\]$} $line -> currentTime]} {
            if {$gotTime} {
               set currentOutput [string trim $currentOutput <>]
               putserv "PRIVMSG $chan :$currentOutput"
            }
         
            set currentOutput "\002$currentTime:\002 "
            set gotTime 1
         }

         if {[regexp {^\[SHOW\]([ \w]+)\^([\w \'\:\&\!]+)\^([\dx]+)\^([\w\\\/\:\.\-]+)\[\/SHOW\]$} $line -> network title epnum url]} {
            set currentOutput [concat $currentOutput "\00304$network\00315 - \00314$title $epnum\00315 <>"]
         }
      }
   }
}

putlog "TVRage.com Primetime Schedule v0.2"
Back to top
View user's profile Send private message
Tammik
Voice


Joined: 23 Jan 2006
Posts: 10

PostPosted: Mon Jan 23, 2006 9:43 am    Post subject: cant get it to work ? Reply with quote

the script will not work ? i have loded it in to my eggdrop bot ... but when i do !today in chanel noting happens..
Back to top
View user's profile Send private message
GaveUp
Op


Joined: 19 Jan 2006
Posts: 139

PostPosted: Mon Jan 23, 2006 12:21 pm    Post subject: Reply with quote

DCC or Telnet in and see if an messages pop up there that could indicate a problem.
Back to top
View user's profile Send private message
Taz
Voice


Joined: 23 Oct 2005
Posts: 9

PostPosted: Mon Jan 23, 2006 9:31 pm    Post subject: Reply with quote

Absolutely well done. Nice work. Works well here, running on eggy 1.6.17+SSL
Back to top
View user's profile Send private message
Tammik
Voice


Joined: 23 Jan 2006
Posts: 10

PostPosted: Tue Jan 24, 2006 1:15 am    Post subject: it works now.. Reply with quote

just for got to do a thing the script is working now..

mybe you can make the script look a bit like this ?

and on
!today
mybe removed tv company.. and just print out
!today
TV Shedule for 2006-01-24
06:00 pm: My Own 01x14
07:30 pm: The Adventures of Jimmy Neutron: Boy Genius 03x11
08:00 pm: NCIS 03x14 | American Idol 05x03 | According to Jim 05x13 | Fear Factor 06x07 | Gilmore Girls 06x13 | NOVA 33x04

!showinfo lost
Lost - http://www.tvrage.com/Lost
Latest Episode: 02x11 - The Hunting Party (18/Jan/2006)
Next Episode:   N/A


just some ideas for your next verion
Back to top
View user's profile Send private message
prim3
Voice


Joined: 18 Nov 2005
Posts: 8

PostPosted: Tue Jan 24, 2006 6:54 pm    Post subject: Reply with quote

hm.. im getting an error on lookup:

Tcl error [pub:tvrage.com.today]: unknown channel command: should be one of: add, set, info, remove

any idea's?
Back to top
View user's profile Send private message
GaveUp
Op


Joined: 19 Jan 2006
Posts: 139

PostPosted: Tue Jan 24, 2006 7:58 pm    Post subject: Reply with quote

What did you do to trigger the error?
Back to top
View user's profile Send private message
demond
Revered One


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

PostPosted: Wed Jan 25, 2006 12:01 am    Post subject: Reply with quote

prim3 wrote:
hm.. im getting an error on lookup:

Tcl error [pub:tvrage.com.today]: unknown channel command: should be one of: add, set, info, remove

any idea's?


upgrade eggdrop

(not that the latest version isn't ancient already, but still)
_________________
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
prim3
Voice


Joined: 18 Nov 2005
Posts: 8

PostPosted: Wed Jan 25, 2006 2:25 am    Post subject: Reply with quote

well im useing eggdrop1.6.2_linux2.2_static_glibc_x86_tcl8.3.tar.. that should be the latest version right....
Back to top
View user's profile Send private message
demond
Revered One


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

PostPosted: Wed Jan 25, 2006 2:46 am    Post subject: Reply with quote

lol, no
_________________
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
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Wed Jan 25, 2006 3:34 am    Post subject: Reply with quote

Latest version is 1.6.17 and can be downloaded from Eggheads.org.
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
prim3
Voice


Joined: 18 Nov 2005
Posts: 8

PostPosted: Thu Jan 26, 2006 3:56 am    Post subject: Reply with quote

is it posible to change display time to GMT+01:00?
Back to top
View user's profile Send private message
GaveUp
Op


Joined: 19 Jan 2006
Posts: 139

PostPosted: Wed Feb 01, 2006 2:21 am    Post subject: Reply with quote

Just a couple bugfixes for in this update.

Code:
####################
#    tvrage.tcl    #
#   v0.2 23Jan06   #
# Coded By: GaveUp #
####################

###################
#   DESCRIPTION   #
#################################################################################
# This script pulls today's or tomorrow's schedule of new shows from tvrage.com #
#################################################################################

####################
# Revision History #
#####################################################################
# 0.3 -- *fixed last time of 7th day now displayed                  #
#        *tweaked regex to catch some programs it was missing       #
# 0.2 -- +!showinfo trigger for detailed show info and next/last ep #
#        +!schedule for 7 day schedule                              #
#        *fixed errors in various regex                             #
# 0.1 -- Initial Release                                            #
#                                                                   #
# + added   - removed   * fixed/changed                             #
#####################################################################

########
# TODO #
#################################################
# *Move hardcoded settings to variables.        #
# *Add support for changing timezones.          #
#################################################

### Begin Config ###

set tvrage(scheduleurl) "http://www.tvrage.com/quickschedule.php"
set tvrage(showinfourl) "http://www.tvrage.com/quickinfo.php"
set tvrage(scheduleTitle) "\00303New TV Shows for %%date%% ***All Times in EST/EDT***\00315"
set tvrage(c1) ""
set tvrage(c2) ""
set tvrage(c3) ""
set tvrage(c4) ""

### End Config ###

bind pub - !today pub:tvrage.com.today
bind pub - !tomorrow pub:tvrage.com.tomorrow
bind pub - !showinfo pub:tvrage.com.showinfo
bind pub - !schedule pub:tvrage.com.schedule

package require http
package require ncgi
setudef flag tv

proc pub:tvrage.com.schedule {nick uhost hand chan text} {
   set seconds [clock seconds]
   set days(sun) 0
   set days(mon) 1
   set days(tue) 2
   set days(wed) 3
   set days(thu) 4
   set days(fri) 5
   set days(sat) 6

   if ![info exist days([string tolower $text])] return

   set currDay [clock format $seconds -format "%w"]
   
   if {$currDay > $days([string tolower $text])} {
      parse:tvrage.com $nick $uhost $hand $chan $text [expr (7 - $currDay) + $days([string tolower $text])]
   } else {
      parse:tvrage.com $nick $uhost $hand $chan $text [expr $days([string tolower $text]) - $currDay]
   }
}
      

proc pub:tvrage.com.today {nick uhost hand chan text} {
   parse:tvrage.com $nick $uhost $hand $chan $text "0"
}

proc pub:tvrage.com.tomorrow {nick uhost hand chan text} {
   parse:tvrage.com $nick $uhost $hand $chan $text "1"
}

proc pub:tvrage.com.showinfo {nick uhost hand chan text} {
   if ![channel get $chan tv] return
   
   set token [http::geturl [join [list "http://www.tvrage.com/quickinfo.php?show=" [ncgi::encode [string trimleft $text]]] ""]]
   set data [http::data $token]
   http::cleanup $token
   set show(title) ""
   
   foreach line [split $data \n] {
      if {[regexp {^No Show Results Were Found For \".*\"$} $line]} {
         putserv "PRIVMSG $chan :\00303$line\00315"
         return
      }
      if {[regexp {^Show Name@(.*)$} $line -> match]} { set show(title) $match }
      if {[regexp {^Show URL@(.*)$} $line -> match]} { set show(url) $match }
      if {[regexp {^Premiered@(.*)$} $line -> match]} { set show(premiered) $match }
      if {[regexp {^Latest Episode@(\d+)x(\d+)\^([\w\'\.\, \#\&\@\:]+)\^([\w\/]+)$} $line -> season episode eptitle epDate]} {
         set show(latest) [join [list "\00303Latest Episode ::\00315 \00304$season" "x$episode - $eptitle ($epDate)\00315"] ""]
      }
      if {[regexp {^Next Episode@(\d+)x(\d+)\^([\w\'\.\, \#\@\&\:]+)\^([\w\/]+)$} $line -> season episode eptitle epDate]} {
         set show(next) [join [list "\00303Next Episode ::\00315 \00304$season" "x$episode - $eptitle ($epDate)\00315"] ""]
      }
      if {[regexp {^Country@(.*)$} $line -> match]} { set show(country) $match }
      if {[regexp {^Status@(.*)$} $line -> match]} { set show(status) $match }
      if {[regexp {^Classification@(.*)$} $line -> match]} { set show(class) $match }
   }

   if ![info exist show(next)] { set show(next) "\00303Next Episode ::\00315 \00304N/A\00315" }

   putserv "PRIVMSG $chan :\00303Title ::\00315 \00304$show(title)\00315 \00308<>\00315 \00303URL ::\00315 \00304$show(url)\00315 \00308<>\00315 \00303Premiered ::\00315 \00304$show(premiered)\00315 \00308<>\00315 $show(latest) \00308<>\00315 $show(next) \00308<>\00315 \00303Country ::\00315 \00304$show(country)\00315 \00308<>\00315 \00303Status ::\00315 \00304$show(status)\00315"
}
      
proc parse:tvrage.com {nick uhost hand chan text when} {
   if ![channel get $chan tv] return
   set token [http::geturl http://www.tvrage.com/quickschedule.php]
   set data [http::data $token]
   http::cleanup $token
   set date ""
   set systemTime [clock seconds]
   set systemTime [expr $systemTime + 3600]
   set currentTime ""
   set parsing 0
   set currentOutput ""
   set gotTime 0
   set neededDate ""
   set neof 1

   set systemTime [expr "$systemTime + ($when * 86400)"]
   set neededDate [clock format $systemTime -format "%A, %d %b %Y"]

   foreach line [split $data \n] {
      if {[regexp {^\[DAY\]([\w\, ]+)\[\/DAY\]$} $line -> date]} {
         if {$parsing == 1} {
            break;
         }
         
         if {$date == $neededDate} {
            putserv "PRIVMSG $chan :\00303New TV Shows for $date ***All Times in EST/EDT***\00315"
            set parsing 1
         }
      }

      if {$parsing} {
         if {[regexp {^\[TIME\]([\w\: ]+)\[\/TIME\]$} $line -> currentTime]} {
            if {$gotTime} {
               set currentOutput [string trim $currentOutput <>]
               putserv "PRIVMSG $chan :$currentOutput"
               set currentOutput ""
            }
         
            set currentOutput "\002$currentTime:\002 "
            set gotTime 1
         }

         if {[regexp {^\[SHOW\]([ \w\&\!]+)\^([\#\w \'\:\&\!\/]+)\^([\dx]+)\^([\w\\\/\:\.\-]+)\[\/SHOW\]$} $line -> network title epnum url]} {
            set currentOutput [concat $currentOutput "\00304$network\00315 - \00314$title $epnum\00315 <>"]
         }
      }
   }

   if {$currentOutput != ""} {
      set currentOutput [string trim $currentOutput <>]
      putserv "PRIVMSG $chan :$currentOutput"
   }
}

putlog "TVRage.com Primetime Schedule v0.3"
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 ... 32, 33, 34  Next
Page 1 of 34

 
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