| View previous topic :: View next topic |
| Author |
Message |
Cletus Voice
Joined: 06 Aug 2006 Posts: 19
|
Posted: Tue Aug 15, 2006 3:36 pm Post subject: football links are broke with tsnstats 0.6 [Problem Solved] |
|
|
I think the link is broke for football and golf, those are the only links broke though, can someone help me with this, I looked on efnet for AkiraX but he wasn't there. I got the script from these archives. thanks.
| Code: |
#############################################
# tsnstats.tcl v0.6 by AkiraX #
# <#AnimeFiends@EFNet> #
#############################################
####### DESCRIPTION #########################
# looks up player stats and info for
# professional sports leagues from tsn.ca
#############################################
####### USAGE ###############################
#
# [league] can be: !nhl !nfl !mlb !nba !pga
#
# ![league] <name> ................... personal player info
# ![league]stats [year] <name> ....... player stats and injury/roster status
# ![league]playoffs [year] <name> .... playoff stats
# ![league]history [year] <name> ..... player transactions and awards
# ![league]history <name> "search" ... transactions and awards matching "search"
# ![league]scout <name> .............. scouting report
# ![league]photo <name> .............. player profile photo
#
# <name> can be "firstname lastname" or "lastname, firstname"
#
# [year] is optional, and can be "20XX" or "XX" or "XX-YY"
#
#############################################
####### NOTES ###############################
# Limited results for playoffs in all sports
# (NHL and NBA seem to be the only good ones)
#############################################
####### LICENSE #############################
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U
#############################################
package require http
bind pub -|- !nhl tsn:nhl
proc tsn:nhl { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nhl core
}
bind pub -|- !nhlstats tsn:nhlstats
proc tsn:nhlstats { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nhl stats
}
bind pub -|- !nhlplayoffs tsn:nhlplayoffs
proc tsn:nhlplayoffs { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nhl playoffs
}
bind pub -|- !nhlhistory tsn:nhlhistory
proc tsn:nhlhistory { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nhl history
}
bind pub -|- !nhlscout tsn:nhlscout
proc tsn:nhlscout { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nhl scout
}
bind pub -|- !nhlphoto tsn:nhlphoto
proc tsn:nhlphoto { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nhl photo
}
bind pub -|- !nfl tsn:nfl
proc tsn:nfl { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nfl core
}
bind pub -|- !nflstats tsn:nflstats
proc tsn:nflstats { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nfl stats
}
bind pub -|- !nflplayoffs tsn:nflplayoffs
proc tsn:nflplayoffs { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nfl playoffs
}
bind pub -|- !nflhistory tsn:nflhistory
proc tsn:nflhistory { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nfl history
}
bind pub -|- !nflscout tsn:nflscout
proc tsn:nflscout { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nfl scout
}
bind pub -|- !nflphoto tsn:nflphoto
proc tsn:nflphoto { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nfl photo
}
bind pub -|- !mlb tsn:mlb
proc tsn:mlb { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name mlb core
}
bind pub -|- !mlbstats tsn:mlbstats
proc tsn:mlbstats { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name mlb stats
}
bind pub -|- !mlbplayoffs tsn:mlbplayoffs
proc tsn:mlbplayoffs { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name mlb playoffs
}
bind pub -|- !mlbhistory tsn:mlbhistory
proc tsn:mlbhistory { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name mlb history
}
bind pub -|- !mlbscout tsn:mlbscout
proc tsn:mlbscout { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name mlb scout
}
bind pub -|- !mlbphoto tsn:mlbphoto
proc tsn:mlbphoto { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name mlb photo
}
bind pub -|- !nba tsn:nba
proc tsn:nba { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nba core
}
bind pub -|- !nbastats tsn:nbastats
proc tsn:nbastats { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nba stats
}
bind pub -|- !nbaplayoffs tsn:nbaplayoffs
proc tsn:nbaplayoffs { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nba playoffs
}
bind pub -|- !nbahistory tsn:nbahistory
proc tsn:nbahistory { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nba history
}
bind pub -|- !nbascout tsn:nbascout
proc tsn:nbascout { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nba scout
}
bind pub -|- !nbaphoto tsn:nbaphoto
proc tsn:nbaphoto { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nba photo
}
bind pub -|- !pga tsn:pga
proc tsn:pga { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name pga core
}
bind pub -|- !pgastats tsn:pgastats
proc tsn:pgastats { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name pga stats
}
bind pub -|- !pgaplayoffs tsn:pgaplayoffs
proc tsn:pgaplayoffs { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name pga playoffs
}
bind pub -|- !pgahistory tsn:pgahistory
proc tsn:pgahistory { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name pga history
}
bind pub -|- !pgascout tsn:pgascout
proc tsn:pgascout { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name pga scout
}
bind pub -|- !pgaphoto tsn:pgaphoto
proc tsn:pgaphoto { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name pga photo
}
proc tsn:run { chan name sport type } {
# format the input
set year 0
set namecount 0
set namecheck ""
foreach entry [split $name] {
set entry [string map { {-} {} } $entry]
if { [string is integer -strict $entry] } {
set year [join [lindex [split $name] $namecount]]
} {
set namecheck "$namecheck [join [lindex [split $name] $namecount]]"
}
incr namecount
}
if { $namecheck != "" } {
set name $namecheck
}
if { $name == "" } {
if { ($type == "stats") || ($type == "playoffs") || ($type == "history") } {
if { $year == 0 } {
puthelp "PRIVMSG $chan :You must provide a last name: !$sport$type \[year\] lastname, firstname"
} {
puthelp "PRIVMSG $chan :You must provide a last name: !$sport$type $year lastname, firstname"
}
} {
puthelp "PRIVMSG $chan :You must provide a last name: !$sport$type lastname, firstname"
}
return
}
# format the year
set input(year) $year
set input(yearalt) "$year-"
if { $year == 0 } {
if { ($type == "playoffs") || ($type == "history") } {
set input(year) "2006"
set input(yearalt) "05-06"
}
} {
if { [string first "-" $year] < 0 } {
if { [string length $year] == 4 } {
set input(yearalt) "[string range $year 2 3]"
}
}
}
# format the name
set name [string trim $name]
if { ([regexp {\,} $name]) || ([regexp { } $name]) } {
if { [regexp {\,} $name] } {
set input(lastname) [join [lindex [split $name {,}] 0]]
set input(firstname) [join [lindex [split $name {,}] 1]]
} {
if { [regexp { } $name] } {
set input(firstname) [string totitle [join [lindex [split $name] 0]]]
set input(lastname) [string totitle [join [lrange [split $name] 1 end]]]
}
}
set input(name) "[string totitle [string trim $input(lastname)]], [string totitle [string trim $input(firstname)]]"
} {
set input(name) [string totitle $name]
}
# find the player page
set token [http::config -useragent "Mozilla"]
set input(lookupurl) "http://www.tsn.ca/$sport/teams/players/?letter=[string index $input(name) 0]"
if { $sport == "nfl" } { set input(lookupurl) "http://www.tsn.ca/nfl/player_list.asp?letter=[string index $input(name) 0]" }
if { $sport == "pga" } { set input(lookupurl) "http://www.tsn.ca/golf/player_list.asp?letter=[string index $input(name) 0]" }
set token [http::geturl $input(lookupurl) -timeout 15000]
upvar #0 $token state
if { $state(status) == "timeout" } {
puthelp "PRIVMSG $chan :Sorry, your request timed out."
return
}
set input(html) [split [http::data $token] "\n"]
http::cleanup $token
# find the player url
set input(url) ""
set input(namelist) ""
foreach line $input(html) {
if { [regexp {/players?.bio} $line] } {
if { [string match -nocase *$input(name)* "$line"]} {
# perfect match
if { [regexp {\,} $input(name)] } {
regexp {<a href\=\"(.*?)\"} $line match input(url)
break
}
# collect $name* matches
set first ""
set last ""
if { ($sport == "nfl") || ($sport == "pga") } {
regexp {>(.*?)\,} [string range $line [string last "\"" $line] end] match lastname
} {
regexp {hubname=.*?\">(.*?)\,} $line match lastname
}
regexp {\,(.*?)<} $line match firstname
if { ([string match -nocase $input(name)* "$lastname"]) ||
([string compare -nocase "$input(name)" "$lastname"] == 0) } {
regexp {<a href\=\"(.*?)\"} $line match input(url)
lappend input(namelist) "[string trim $firstname] [string trim $lastname]"
continue
}
}
}
}
if { $input(url) == "" } {
puthelp "PRIVMSG $chan :Couldn't find \002$input(name)\002 in the database."
return
}
if { [llength $input(namelist)] > 1 } {
set output "Found [llength $input(namelist)] matches: [lindex $input(namelist) 0]"
foreach name [lrange $input(namelist) 1 end] {
set output "$output, $name"
}
puthelp "PRIVMSG $chan :$output"
return
}
# grab the player page
set token [http::geturl "http://www.tsn.ca$input(url)" -timeout 15000]
upvar #0 $token state
if { $state(status) == "timeout" } {
puthelp "PRIVMSG $chan :Sorry, your request timed out."
return
}
set input(html) [split [http::data $token] "\n"]
http::cleanup $token
## get player stats
set player(name) ""
set player(team) ""
set player(city) ""
set player(number) ""
set player(position) ""
set player(photo) ""
set player(age) ""
set player(birthday) ""
set player(birthplace) ""
set player(hometown) ""
set player(college) ""
set player(height) ""
set player(weight) ""
set player(hand) ""
set player(handbat) ""
set player(exp) ""
set player(draft) ""
set player(signed) ""
set scout(grab) 0
set scout(assets) ""
set scout(flaws) ""
set scout(potential) ""
set stats(grab) 0
set stats(status) ""
set stats(columns) ""
set stats(data) ""
set stats(next) ""
set history(grab) 0
set history(data) ""
set playoffs(grab) 0
set playoffs(columns) ""
set playoffs(data) ""
set playoffs(next) ""
foreach line $input(html) {
# team
if { [regexp {szone} $line] } {
regexp {szone\=\"...\-(.*?)\"} $line match player(team)
set player(team) [string trim [string totitle $player(team)]]
set player(team) [string map { {_} {} } $player(team)]
continue
}
# city
if { ($player(city) == "") && ([regexp {<td class\=\'pad10\'>} $line]) } {
if { $sport == "mlb" } { regexp {<b>(.*?) } $line match player(city) }
if { $player(city) == "" } { regexp {<b>(.*?)</b>} $line match player(city) }
if { $player(city) == "" } { set player(city) " " }
if { $type == "photo" } { break }
continue
}
# name, number and position
if { [regexp {class\=\'playername\'} $line] } {
regexp {\'playername\'>(.*?)<} $line match player(name)
set player(name) [string trim [string map { { } {} } $player(name)]]
regexp {\'playerposition\'>(.*?)<} $line match numpos
set numpos [string trim [string map { { } {} } $numpos]]
set player(number) [join [lindex [split $numpos] 0]]
set player(position) [join [lindex [split $numpos] 1]]
continue
}
# image
if { $type == "photo" } {
if { [regexp {pics.forecaster.ca} $line] } {
set player(photo) ""
regexp {<img src=\'(.*?)\'} $line match player(photo)
continue
}
}
# player core info
if { $type == "core" } {
if { [regexp {Current Status} $line] } { break }
if { [regexp {<b>DOB:</b>} $line] } { regexp {</b> ?(.*?)</td>} $line match player(birthday); continue }
if { [regexp {<b>Age:</b>} $line] } { regexp {</b> ?(.*?)</td>} $line match player(age); continue }
if { [regexp {<b>Place of Birth:</b>} $line] } { regexp {</b> ?(.*?)</td>} $line match player(birthplace); continue }
if { [regexp {<b>Hometown:</b>} $line] } { regexp {</b> ?(.*?)</td>} $line match player(hometown); continue }
if { [regexp {<b>College:</b>} $line] } { regexp {</b> ?(.*?)</td>} $line match player(college); continue }
if { [regexp {<b>HT:</b>} $line] } {
regexp {HT:</b> ?(.*?) ?<b>} $line match player(height)
regexp {WT:</b> ?(.*?)</td>} $line match player(weight)
continue
}
if { [regexp {<b>Shoots: ?</b>} $line] } {
regexp {</b>(.*?)</td>} $line match player(hand)
if { $player(hand) == "L" } { set player(hand) "left" }
if { $player(hand) == "R" } { set player(hand) "right" }
continue
}
if { [regexp {<b>Bats/Throws: ?</b>} $line] } {
regexp {</b>(.*?)</td>} $line match hand
set player(hand) [join [lindex [split $hand {/}] 1]]
set player(handbat) [join [lindex [split $hand {/}] 0]]
if { $player(hand) == "L" } { set player(hand) "lefty" }
if { $player(hand) == "R" } { set player(hand) "righty" }
if { $player(hand) == "S" } { set player(hand) "switch" }
if { $player(handbat) == "L" } { set player(handbat) "lefty" }
if { $player(handbat) == "R" } { set player(handbat) "righty" }
if { $player(handbat) == "S" } { set player(handbat) "switch" }
continue
}
if { [regexp {<b>... Seasons: ?</b>} $line] } { regexp {</b> ?(.*?)</td>} $line match player(exp); continue }
if { [regexp {Drafted by} $line] } { regexp {\'pad10\'>(.*?)\.?</td>} $line match player(draft); continue }
if { [regexp {Signed by} $line] } { regexp {\'pad10\'>(.*?)\.?</td>} $line match player(signed); continue }
}
# player season stats and history
if { ($type == "stats") || ($type == "playoffs") || ($type == "history") } {
if { [regexp {Current Status\:} $line] } {
regexp {Current Status\: ?(.*?)</td>} $line match stats(status)
set stats(grab) 1
continue
}
if { $stats(grab) > 0 } {
if { [regexp {Playoff Stats} $line] } {
set playoffs(grab) 1
set stats(grab) 2
continue
}
if { $stats(grab) == 1 } {
if { $input(year) == 0 } {
if { [regexp {</tr>} $line] } {
set stats(grab) 3
}
} {
if { [regexp {Career Stats} $line] } {
set stats(grab) 2
} {
if { [regexp {Scouting Report} $line] } {
set history(grab) 1
continue
}
# find transactions, injuries, etc
if { $history(grab) > 0 } {
if { [regexp {row.?\'>} $line] } {
set entry ""
regexp {row.?\'>(.*?)</td>} $line match entry
# event year
if { $history(grab) == 1 } {
if { [tsn:checkyear $input(year) $input(yearalt) $entry] } {
set history(data) "$history(data) $entry"
if { [string index $history(data) end] != ":" } {
set history(data) "$history(data):"
}
set history(grab) 2
continue
}
}
# event description
if { $history(grab) == 2 } {
if { [string index $entry end] != "." } {
set entry "$entry."
}
set history(data) "$history(data) $entry"
set history(grab) 1
}
}
}
}
}
continue
} {
if { [regexp {</tr>} $line] } {
incr stats(grab)
if { $stats(grab) > 4 } {
if { $input(year) == 0 } { break }
if { $stats(grab) == 5 } {
set stats(grab) 6
if { $playoffs(grab) } {
if { [tsn:checkyear $input(year) $input(yearalt) [lindex $playoffs(data) 0]] == 0 } {
set stats(grab) 4
set playoffs(data) ""
}
} {
if { [tsn:checkyear $input(year) $input(yearalt) [lindex $stats(data) 0]] == 0 } {
set stats(grab) 4
set stats(data) ""
}
}
continue
}
if { $stats(grab) > 5 } {
if { $playoffs(grab) } {
if { [llength $playoffs(next)] <= 0 } { break }
if { [tsn:checkyear $input(year) $input(yearalt) [lindex $playoffs(next) 0]] == 0 } { break }
if { [string first "Total" "[lindex $playoffs(next) 1]"] >= 0 } { break }
foreach entry $playoffs(next) {
lappend playoffs(data) "$entry"
}
set stats(grab) 6
set playoffs(next) ""
} {
if { [llength $stats(next)] <= 0 } { set stats(grab) 1; continue }
if { [tsn:checkyear $input(year) $input(yearalt) [lindex $stats(next) 0]] == 0 } { set stats(grab) 1; continue }
if { [string first "Total" "[lindex $stats(next) 1]"] >= 0 } { set stats(grab) 1; continue }
foreach entry $stats(next) {
lappend stats(data) "$entry"
}
set stats(grab) 6
set stats(next) ""
}
}
}
continue
}
if { [regexp {row.?\'>} $line] } {
set entry ""
regexp {row.?\'>(.*?)</td>} $line match entry
if { $entry != "" } {
if { $playoffs(grab) } {
switch $stats(grab) \
3 { lappend playoffs(columns) "$entry" } \
4 { lappend playoffs(data) "$entry" } \
6 { lappend playoffs(next) "$entry" }
} {
switch $stats(grab) \
3 { lappend stats(columns) "$entry" } \
4 { lappend stats(data) "$entry" } \
6 { lappend stats(next) "$entry" }
}
}
continue
}
}
}
}
# player scouting info
if { $type == "scout" } {
if { [regexp {Honours and Awards} $line] } { break }
if { [regexp {<b>Age:</b>} $line] } { regexp {</b> ?(.*?)</td>} $line match player(age) }
if { [regexp {<b>HT:</b>} $line] } {
regexp {HT:</b> ?(.*?) <b>} $line match player(height)
regexp {WT:</b> ?(.*?)</td>} $line match player(weight)
}
if { [regexp {<b>... Seasons: ?</b>} $line] } { regexp {</b> ?(.*?)</td>} $line match player(exp) }
if { [regexp {Assets} $line] } { set scout(grab) 1; continue }
if { [regexp {Flaws} $line] } { set scout(grab) 2; continue }
if { [regexp {Career potential} $line] } { set scout(grab) 3; continue }
if { $scout(grab) == 1 } { regexp {>(.*?)</td>} $line match scout(assets); set scout(grab) 0 }
if { $scout(grab) == 2 } { regexp {>(.*?)</td>} $line match scout(flaws); set scout(grab) 0 }
if { $scout(grab) == 3 } { regexp {>(.*?)</td>} $line match scout(potential); set scout(grab) 0 }
}
}
# create final output
set output ""
if { [string index $player(number) end] != "-" } {
if { (($input(year) == 0) || ($type == "history") || ($type == "photo")) && ($player(city) != "") && ($player(team) != "") } {
set output "$player(city) $player(team) \002$player(number) $player(name)\002"
} {
set output "\002$player(number) $player(name)\002"
}
} {
if { (($input(year) == 0) || ($type == "history") || ($type == "photo")) && ($player(city) != "") && ($player(team) != "") } {
set output "$player(city) $player(team) \002$player(name)\002"
} {
set output "\002$player(name)\002"
}
}
if { $type == "photo" } {
if { $player(photo) == "" } {
puthelp "PRIVMSG $chan :No profile photo found for \002$player(name)\002."
return
}
puthelp "PRIVMSG $chan :$output Profile photo: $player(photo)"
return
}
if { $type == "core" } {
set output "$output \[$player(height) $player(weight)lbs\]"
if { $player(age) != "" } { set output "$output $player(age)yo" }
if { ($player(hand) != "") && ($sport != "mlb") } { set output "$output $player(hand)-handed" }
if { $player(position) != "" } { set output "$output $player(position)" }
if { $player(hometown) != "" } { set output "$output from $player(hometown)" }
set output "$output."
if { ($player(hand) != "") && ($sport == "mlb") } {
set output "$output Throws $player(hand), bats $player(handbat)."
}
if { ($player(birthday) != "") && ($player(birthplace) != "") } {
set output "$output Born $player(birthday) in $player(birthplace)."
}
if { $player(draft) != "" } {
set output "$output $player(draft)"
if { $player(college) != "" } { set output "$output out of $player(college)" }
set output "$output."
}
if { $player(signed) != "" } { set output "$output $player(signed)." }
if { $player(exp) != "" } { set output "$output Has played $player(exp) seasons." }
puthelp "PRIVMSG $chan :[string trim $output]"
return
}
if { $type == "history" } {
if { $history(data) == "" } {
set output "No injuries, transactions or awards found for \002$player(name)\002 in $input(year)."
} {
if { $stats(status) != "" } {
set output "$output \[Status: $stats(status)\]"
}
set output "$output $history(data)"
}
puthelp "PRIVMSG $chan :$output"
return
}
if { ($type == "stats") || ($type == "playoffs") } {
if { $type == "stats" } {
if { ([llength $stats(columns)] <= 0) || ([llength $stats(data)] <= 0) } {
if { $input(year) == 0 } {
set output "No current season stats were found for \002$input(name)\002."
} {
set output "No season $input(year) stats were found for \002$input(name)\002."
}
puthelp "PRIVMSG $chan :$output"
return
}
} {
if { ([llength $playoffs(columns)] <= 0) || ([llength $playoffs(data)] <= 0) } {
set output "No $input(year) playoff stats were found for \002$input(name)\002."
puthelp "PRIVMSG $chan :$output"
return
}
}
if { $input(year) == 0 } {
set output "$output Status($stats(status))"
} {
set output ""
if { [string index $player(number) end] != "-" } {
set output "$player(number) $player(name)"
} {
set output "$player(name)"
}
}
set col 0
set row 0
set outrun 0
while { $outrun != 2 } {
set runtype $type
if { $outrun == 1 } {
set col 0
set row 0
set runtype "playoffs"
}
if { $runtype == "stats" } {
set out(columns) $stats(columns)
set out(data) $stats(data)
set outrun 1
} {
if { ($playoffs(columns) == "") || ($playoffs(data) == "") } {
break
}
set out(columns) $playoffs(columns)
set out(data) $playoffs(data)
set outrun 2
}
foreach entry $stats(data) {
incr col
incr row
if { $input(year) == 0 } {
if { $col == 1 } {
if { ($runtype == "playoffs") } {
set output "$output \[Playoffs [lindex $out(data) 1]\] [lindex $out(data) 0]"
} {
set output "$output \[[lindex $out(data) 1]\] [lindex $out(data) 0]"
}
} {
if { $col < [llength $out(columns)] } {
set output "$output [lindex $out(columns) $col]([lindex $out(data) $row])"
}
}
continue
} {
if { $col == 1 } {
if { $sport == "nfl" } {
set output "$output \002\[[lindex $out(data) [expr { $row-1 }]] [lindex $out(data) $row]\]\002"
incr col
incr row
} {
if { $runtype == "playoffs" } {
set output "$output \002\[Playoffs [lindex $out(data) [expr { $row-1 }]] ([lindex $out(data) [expr { $row+1 }]]) [lindex $out(data) $row]\]\002"
} {
set output "$output \002\[[lindex $out(data) [expr { $row-1 }]] ([lindex $out(data) [expr { $row+1 }]]) [lindex $out(data) $row]\]\002"
}
incr col 2
incr row 2
}
}
if { ($col < [llength $out(columns)]) && ($row < [llength $out(data)]) } {
set output "$output [lindex $out(columns) $col]([lindex $out(data) $row])"
} {
if { $input(year) == 0 } { break }
if { $row >= [expr { [llength $out(data)] }] } { break }
set col 0
}
}
}
}
if { ($type != "playoffs") && ($history(data) != "") } {
set output "$output $history(data)"
}
puthelp "PRIVMSG $chan :[string trim $output]"
return
}
if { $type == "scout" } {
if { ($scout(assets) == "") && ($scout(flaws) == "") && ($scout(potential) == "") } {
puthelp "PRIVMSG $chan :Sorry, no scouting report for \002$player(name)\002 is available."
return
}
set output "$output \[$player(height) $player(weight)lbs"
if { $player(age) != "" } { set output "$output $player(age)yo" }
if { $player(exp) != "" } { set output "$output $player(exp)-seasons" }
set output "$output\] Scouting report:"
if { $scout(potential) != "" } { set output "$output $scout(potential)" }
puthelp "PRIVMSG $chan :$output"
if { $scout(assets) != "" } { puthelp "PRIVMSG $chan :Assets: $scout(assets)" }
if { $scout(flaws) != "" } { puthelp "PRIVMSG $chan :Flaws: $scout(flaws)" }
return
}
puthelp "PRIVMSG $chan :[string trim $output]"
return
}
proc tsn:checkyear { year yearalt input } {
if { ([string compare "$year" "$input"] != 0) &&
([string first "$yearalt" "$input"] < 0) } {
if { [string index $input end] == ":" } {
if { [string length $year] == 2 } {
if { [string compare $year [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }
}
if { [string length $year] == 4 } {
if { [string compare [string range $year 2 3] [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }
}
if { [string length $year] == 5 } {
if { [string compare [string range $year 0 1] [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }
# if { [string compare [string range $year 3 4] [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }
}
if { [string length $year] == 7 } {
if { [string compare [string range $year 2 3] [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }
if { [string compare [string range $year 5 6] [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }
}
if { ([string length $yearalt] == 5) && ([string index $yearalt 2] == "-") } {
if { [string compare [string range $yearalt 0 1] [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }
if { [string compare [string range $yearalt 3 4] [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }
}
} {
if { [string length $input] == 4 } {
if { ([string length $yearalt] == 5) && ([string index $yearalt 2] == "-") } {
if { [string compare [string range $yearalt 0 1] [string range $input [expr { [string length $input]-2 }] end]] == 0 } { return 1 }
if { [string compare [string range $yearalt 3 4] [string range $input [expr { [string length $input]-2 }] end]] == 0 } { return 1 }
}
}
}
return 0
}
return 1
}
putlog "tsnstats.tcl v0.6 by AkiraX <#AnimeFiends@EFnet> loaded!"
|
Last edited by Cletus on Fri Aug 18, 2006 3:00 pm; edited 1 time in total |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Tue Aug 15, 2006 6:39 pm Post subject: |
|
|
Post the results of '.set errorInfo'. _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
Cletus Voice
Joined: 06 Aug 2006 Posts: 19
|
Posted: Tue Aug 15, 2006 11:05 pm Post subject: |
|
|
I'm sorry I don't know what that means, or how to give that info, can you help me further maybe?
I can say that the partyline gives me no error info, from simply idling on it while trying to use the broken part of the script.
Here's an example of what I type in channel and the response I get:
(21:56:29) (~Cletus) .nflscout randy moss
(21:56:32) (&OJ) Couldn't find Moss, Randy in the database. |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Tue Aug 15, 2006 11:25 pm Post subject: |
|
|
all scripts that fetch info from webpages eventually get broken as those pages change in structure and authors are no longer around to update their hardcoded stuff; that is your case as well
you won't get the help you need - why? because in order to update this script, someone would have to bother to: 1. study the script's logic 2. study the html structure of changed webpage and 3. come up with a patch that would handle the new structure - efforts that most if not all people here won't be willing to make
hint: ditch this thing, find RSS feed serving your needs, use RSS news script _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
Cletus Voice
Joined: 06 Aug 2006 Posts: 19
|
Posted: Wed Aug 16, 2006 8:32 pm Post subject: |
|
|
| OK, I do use rss news feeds but they will never be able to do what this script does. Too bad nobody will be able to help, I didn't realize it was gonna be that complicated of a process, but I don't know crap about writing these things either. I guess I'll just continue to search for the author. |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Wed Aug 16, 2006 10:52 pm Post subject: |
|
|
Or do what I did.. Learn tcl =)
Only took a coupla weeks. |
|
| Back to top |
|
 |
Cletus Voice
Joined: 06 Aug 2006 Posts: 19
|
Posted: Thu Aug 17, 2006 11:36 am Post subject: |
|
|
| Yeah but people who know tcl can't seem to help me, here or in requests, so i'm thinking just my knowing tcl isn't going to help me write a script this elaborate in a couple weeks, altho, i do want to learn. |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Thu Aug 17, 2006 12:25 pm Post subject: |
|
|
...or offer a small fee; if you can spend like 10-15 bucks for that, I guess some of our younger friends here would be willing to take on it (I myself am not interested) _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Thu Aug 17, 2006 3:13 pm Post subject: |
|
|
| Cletus wrote: | | Yeah but people who know tcl can't seem to help me, here or in requests, so i'm thinking just my knowing tcl isn't going to help me write a script this elaborate in a couple weeks, altho, i do want to learn. |
That's because, as Demond pointed out, it would require a lot of analysis (mostly for the webpages that it's trying to grab). Which isn't necessarily difficult, it's just not a project people have shown an interest in. Since you are interested in this script, take it over and fix it and release a new version. I've done that with several very complex scripts.
It's a good way to learn tcl  |
|
| Back to top |
|
 |
incith Master

Joined: 23 Apr 2005 Posts: 275 Location: Canada
|
Posted: Fri Aug 18, 2006 11:18 am Post subject: |
|
|
Removing these would be a start:
| Code: | if { $sport == "nfl" } { set input(lookupurl) "http://www.tsn.ca/nfl/player_list.asp?letter=[string index $input(name) 0]" }
if { $sport == "pga" } { set input(lookupurl) "http://www.tsn.ca/golf/player_list.asp?letter=[string index $input(name) 0]" } |
At least from what I can tell, the tsn page doesn't use player_list.asp anymore for NFL & Golf, and uses the same format of /players/?letter=<name>
Good luck.
Correction: NFL uses /teams/players/?letter=<name>
So changing if {$sport == "nfl"} to use tsn.ca/nfl/teams/players/?letter=blah blah blah.. should work, in theory. _________________ ; Answer a few unanswered posts! |
|
| Back to top |
|
 |
incith Master

Joined: 23 Apr 2005 Posts: 275 Location: Canada
|
Posted: Fri Aug 18, 2006 11:27 am Post subject: |
|
|
Oops, it was easier than I thought: tsnstats-0.7-unofficial.tar.gz
| Quote: | (09:25:20) (@incith) !pga duke
(09:25:22) <@visitant> Ken Duke [6-1 205lbs] 37yo. Born Jan 29, 1969 in Hope, AR. |
| Quote: | (09:24:29) (@incith) !nfl dan
(09:24:31) <@visitant> Found 8 matches: Owen Daniels, P.J. Daniels, Phillip Daniels, Torrance Daniels, Travis Daniels, Lane Danielsen, Karlos Dansby, Woodrow Dantzler |
The changes made were the ones mentioned in the above post more or less. _________________ ; Answer a few unanswered posts!
Last edited by incith on Thu Oct 05, 2006 6:20 pm; edited 1 time in total |
|
| Back to top |
|
 |
Cletus Voice
Joined: 06 Aug 2006 Posts: 19
|
Posted: Fri Aug 18, 2006 2:57 pm Post subject: |
|
|
| You the man incith, thanks a bunch! I use a lot of your other scripts too, I really appreciate it. |
|
| Back to top |
|
 |
Jonathan1683 Voice
Joined: 29 Jul 2008 Posts: 10
|
Posted: Sun Oct 18, 2009 11:27 pm Post subject: |
|
|
is there any way to get a new copy of this script? I really doubt it works if its three years old and the newest link was dead  |
|
| Back to top |
|
 |
|
|
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
|
|