Hello! Glad to hear users like it.Elfriede wrote:Great Script My Users love to use it, but
i think a line seperator would be useful
And one question:
Is it difficult to "change" the search, that if u use for eg
!bluray The.Dark.Knight also results are coming ?
greets
Code: Select all
set bluray_keywords [string map { " " "+" "%" "+" "&" "+" "*" "+"} $bluray_keywords]
Code: Select all
set bluray_keywords [string map { " " "+" "%" "+" "&" "+" "*" "+" "." "+"} $bluray_keywords]
Code: Select all
set bluray_url "http://www.blu-ray.com/search/?quicksearch=1§ion=movies&quicksearch_keyword=$bluray_keywords&searchbutton.x=0&searchbutton.y=0"
I updated v1.2 with the above line and now it works like a charm.cbsjanten1 wrote:hey im still running version 1.1
just replace ur url line withworks really fine...great scriptCode: Select all
set bluray_url "http://www.blu-ray.com/search/?quicksearch=1§ion=movies&quicksearch_keyword=$bluray_keywords&searchbutton.x=0&searchbutton.y=0"
Code: Select all
######################################################################################
# Blu-ray.com script made by dalys that search the website #
# http://www.blu-ray.com for movie titles and fetch info #
######################################################################################
#
# Bugs/Suggestions/Whatever contact: dalys@chokladboll.se
#
# <dalys> !bluray the dark knight
# <bot> "The Dark Knight (Blu-ray)" Release date: Dec 09, 2008 (Year: 2008 Length: 152 mins Rating: Rated PG-13 Studio: Warner Bros.)
#
# Requirements: http.tcl, uri.tcl
#
# Tested on eggdrop 1.6.18 & 1.6.19 & 1.6.20
#
# 1.3coconut 2010-09-23 / znuffy@gmail.com
# - Removed the -details option, too much work to maintain it between the layout changes
# of blu-ray.com
# - Fixed and added new stuff for the layout/code changes of blu-ray.com.
# - Lowered default timeout value to 10seconds
#
# 1.2 2010-02-01
# - Blu-ray.com has been updated (with a better search function it seems)
# and so has the script.
# - Moved the project to github.
#
# 1.1 2008-10-26
# - Fixed a broken regexp due to changes in blu-ray.com's html code
# - Replaced the replacevar function with regsub (replacevar was not part of standard TCL)
# Thanks to speechles for taking his time and helping out with the above!
#
# 1.0 2008-10-05
# First release.
#
#
# Known issues:
# - Found one title with the release date set to "2009", which the script will mistake
# for the year the movie was made which is also just four digits.
#
#### CONFIG ####
# Channels were script can be used (the only config line you HAVE to change)
set bluray_availchans "#test1"
# Channels were the result will be sent in PM
set bluray_quitechans "#chan2 #chan4"
# Output style
#
# IRC markup: bold = \002, underline = \037, reverse(italic in some clients) = \026
# Example: %title is coming out \002%releasedate\002!
#
# Normal search (!bluray <title>)
# Variables available: %title %studio %year %releasedate %rating %length
# Default: "\"%title\" Release date: \002%releasedate\002 \(Year: %year Length: %length Rating: %rating Studio: %studio\)"
set bluray_outputstyle "\"%title\" Release date: \002%releasedate\002 \(Year: %year Length: %length Rating: %rating Studio: %studio\)"
# Timeout, in ms (default: "20000")
set bluray_timeout "10000"
# What commands to respond to (default: !bluray !bd !br)
bind pub - !bluray bluray_pub
bind pub - !blu-ray bluray_pub
bind pub - !bd bluray_pub
bind pub - !br bluray_pub
#### END OF CONFIG ####
#### DO NOT EDIT BELOW, UNLESS YOU ACTUALLY KNOW WHAT YOU ARE DOING ####
set bluray_version "1.3coconut"
package require http
package require uri
proc geturl_followRedirects {url args} {
array set URI [::uri::split $url] ;# Need host info from here
foreach x {1 2 3 4 5} {
set token [eval [list http::geturl $url] $args]
if {![string match {30[1237]} [::http::ncode $token]]} {return $token}
array set meta [set ${token}(meta)]
if {![info exist meta(Location)]} {
return $token
}
array set uri [::uri::split $meta(Location)]
unset meta
if {$uri(host) == ""} { set uri(host) $URI(host) }
# problem w/ relative versus absolute paths
set url [eval ::uri::join [array get uri]]
}
}
proc bluray_pub {nick uhost hand chan text} {
global bluray_availchans bluray_quitechans bluray_timeout bluray_outputstyle
set bluray_keywords $text
set bluray_output $bluray_outputstyle
if {([lsearch -exact $bluray_availchans $chan] == -1) && ($chan != "privmsg")} {return}
if {([lsearch -exact $bluray_quitechans $chan] != -1) || ($chan == "privmsg")} {set chan $nick}
if {[string match $text ""]} {
puthelp "PRIVMSG $chan :Usage: !bluray <movie title>"
return
} else { set bluray_keywords [lrange $text 0 end] }
set bluray_keywords [string map { " " "+" "%" "+" "&" "+" "*" "+" "." "+"} $bluray_keywords]
# set bluray_url "http://www.blu-ray.com/search/?quicksearch=1§ion=movies&keyword=$bluray_keywords&sortby=popularity"
set bluray_url "http://www.blu-ray.com/search/?quicksearch=1§ion=movies&quicksearch_keyword=$bluray_keywords&searchbutton.x=0&searchbutton.y=0"
catch {set page [geturl_followRedirects $bluray_url -timeout $bluray_timeout]} error
if {[string match -nocase "*couldn't open socket*" $error]} {
puthelp "PRIVMSG $chan :Error: Could not open socket to blu-ray.com, please try again later."
::http::cleanup $page
return
}
if {[::http::status $page] == "timeout" } {
puthelp "PRIVMSG $chan :Error: Timed out connecting to blu-ray.com, please try again later."
::http::cleanup $page
return
}
set html [::http::data $page]
::http::cleanup $page
set html [string map { "\r\n" "" "\n" "" "\\n" "" } $html]
if {[regexp {<h3>(.*?)</h3></a>} $html match bluray_title] } {
if {[regexp {<br><small style=\"color: #666666\">(.*?)</small><br>} $html match bluray_info] } {
set bluray_infosplit [split $bluray_info "|"]
set bluray_info_year "N/A"
set bluray_info_studio "N/A"
set bluray_info_releasedate "N/A"
set bluray_info_rating "N/A"
set bluray_info_length "N/A"
for { set i 0 } { $i < 5 } { incr i } {
set bluray_currentinfo [string trimleft [lindex $bluray_infosplit $i]]
set bluray_currentinfo [string trimright $bluray_currentinfo]
if {[regexp {^[0-9]{1,4}$} $bluray_currentinfo]} {
set bluray_info_year $bluray_currentinfo
}
if {[regexp {^[0-9]{1,5}\smin$} $bluray_currentinfo]} {
set bluray_info_length $bluray_currentinfo
}
if {[regexp {((Q[0-9]\s|[A-z]{3}\s[0-9]{2},\s)[0-9]{4}|No\sRelease\sDate)} $bluray_currentinfo]} {
set bluray_info_releasedate $bluray_currentinfo
}
if {[regexp {^.*(R|r)ated.*$} $bluray_currentinfo]} {
set bluray_info_rating $bluray_currentinfo
}
if {![regexp {^[0-9]{4}$} $bluray_currentinfo] && ![regexp {^[0-9]*\smin$} $bluray_currentinfo] && ![regexp {^[A-z]{3}\s[0-9]{1,2},\s[0-9]{4}} $bluray_currentinfo] && ![regexp {^.*(R|r)ated.*$} $bluray_currentinfo] && ![regexp {((Q[0-9]\s|[A-z]{3}\s[0-9]{2},\s)[0-9]{4}|No\sRelease\sDate)} $bluray_currentinfo] && [regexp {[A-z0-9]{2,60}} $bluray_currentinfo]} {
set bluray_info_studio $bluray_currentinfo
}
}
regsub -all -nocase "%title" $bluray_output $bluray_title bluray_output
regsub -all -nocase "%studio" $bluray_output $bluray_info_studio bluray_output
regsub -all -nocase "%year" $bluray_output $bluray_info_year bluray_output
regsub -all -nocase "%length" $bluray_output $bluray_info_length bluray_output
regsub -all -nocase "%rating" $bluray_output $bluray_info_rating bluray_output
regsub -all -nocase "%releasedate" $bluray_output $bluray_info_releasedate bluray_output
puthelp "PRIVMSG $chan :$bluray_output"
} else {
puthelp "PRIVMSG $chan :Could not retrieve coconut about $bluray_title"
}
} elseif {[regexp {<h2 class="title">(.*?)</h2>} $html match bluray_title]} {
if {[regexp {<span class="subheading" style="color: #666666">(.*?)</span><br><br>} $html matched bluray_info]} {
regsub -all {<[^>]+>} $bluray_info { } bluray_info_stripped
set bluray_infosplit [split $bluray_info_stripped "|"]
set bluray_info_year "N/A"
set bluray_info_studio "N/A"
set bluray_info_releasedate "N/A"
set bluray_info_rating "N/A"
set bluray_info_length "N/A"
for { set i 0 } { $i < 5 } { incr i } {
set bluray_currentinfo [string trimleft [lindex $bluray_infosplit $i]]
set bluray_currentinfo [string trimright $bluray_currentinfo]
if {[regexp {^[0-9]{1,4}$} $bluray_currentinfo]} {
set bluray_info_year $bluray_currentinfo
}
if {[regexp {^[0-9]{1,5}\smin$} $bluray_currentinfo]} {
set bluray_info_length $bluray_currentinfo
}
if {[regexp {((Q[0-9]\s|[A-z]{3}\s[0-9]{2},\s)[0-9]{4}|No\sRelease\sDate)} $bluray_currentinfo]} {
set bluray_info_releasedate $bluray_currentinfo
}
if {[regexp {^.*(R|r)ated.*$} $bluray_currentinfo]} {
set bluray_info_rating $bluray_currentinfo
}
if {![regexp {^[0-9]{4}$} $bluray_currentinfo] && ![regexp {^[0-9]*\smin$} $bluray_currentinfo] && ![regexp {^[A-z]{3}\s[0-9]{1,2},\s[0-9]{4}} $bluray_currentinfo] && ![regexp {^.*(R|r)ated.*$} $bluray_currentinfo] && ! [regexp {((Q[0-9]\s|[A-z]{3}\s[0-9]{2},\s)[0-9]{4}|No\sRelease\sDate)} $bluray_currentinfo] && [regexp {[A-z0-9]{2,60}} $bluray_currentinfo]} {
set bluray_info_studio $bluray_currentinfo
}
}
regsub -all -nocase "%title" $bluray_output $bluray_title bluray_output
regsub -all -nocase "%studio" $bluray_output $bluray_info_studio bluray_output
regsub -all -nocase "%year" $bluray_output $bluray_info_year bluray_output
regsub -all -nocase "%length" $bluray_output $bluray_info_length bluray_output
regsub -all -nocase "%rating" $bluray_output $bluray_info_rating bluray_output
regsub -all -nocase "%releasedate" $bluray_output $bluray_info_releasedate bluray_output
puthelp "PRIVMSG $chan :$bluray_output"
} else {
puthelp "PRIVMSG $chan :The coconut is broken."
}
} else {
if {[regexp {alt=\"United\sKingdom\"\stitle=\"United\sKingdom\"\s\/><br><br>(.{100,250}?)<br><br><h5>} $html match bluray_noresult] } {
set bluray_noresult [string map {"<b>" "\002" "</b>" "\002"} $bluray_noresult]
regsub -all "results" $bluray_noresult "coconuts" bluray_coconuts
puthelp "PRIVMSG $chan :$bluray_coconuts"
} else {
puthelp "PRIVMSG $chan :Could not fetch any search result or error message. The coconut is probably outdated."
}
}
}
putlog "Blu-ray.com script $bluray_version by dalys LOADED"