This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

blu-ray.com script by dalys (current: blu-ray.com_1.2.tcl)

Support & discussion of released scripts, and announcements of new releases.
E
Elfriede
Halfop
Posts: 67
Joined: Tue Aug 07, 2007 4:21 am

Post by Elfriede »

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
d
dalys
Voice
Posts: 9
Joined: Sun Oct 05, 2008 9:37 am
Location: Gothenburg, Sweden / QuakeNet

Post by dalys »

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
Hello! Glad to hear users like it. :D

What do you mean with line separator? Like a %breakline variable to use in the output style that will split the output in two messages? That should be doable I think! Will have to look in to it for the next version. :)

About making a search with dots as separators, like "The.Dark.Knight", work you can fix it easily!

On line 103 in v1.1 of the script you find this line:

Code: Select all

        set bluray_keywords [string map { " " "+" "%" "+" "&" "+" "*" "+"} $bluray_keywords]
And all you have to do is add "." "+" in the end of the inside of the braces, so the line will look like this instead:

Code: Select all

        set bluray_keywords [string map { " " "+" "%" "+" "&" "+" "*" "+" "." "+"} $bluray_keywords]

(This will transform the search "The.Dark.Knight" into "The+Dark+Knight", and the blu-ray.com search function interprets plus signs, +, as spaces.)

Good luck. :P
E
Elfriede
Halfop
Posts: 67
Joined: Tue Aug 07, 2007 4:21 am

Post by Elfriede »

Thank you ! I'll try this ASAP :)

With line seperator i mean to split the output-lines

Details for The Dark Knight (+ Digital Copy and BD Live) (Blu-ray)

Video: Video codec: VC-1/Video resolution: 1080p/Aspect ratio: 2.40:1

Audio: English: Dolby TrueHD 5.1/English: Dolby Digital 5.1/English: Dolby Digital 2.0/French: Dolby Digital 5.1 Subs: English SDH, English, French,

Spanish Disc: 50GB Blu-ray Disc/Three-disc set/Digital copy
M
MiNdErAsR
Voice
Posts: 17
Joined: Sat Nov 27, 2004 10:13 am

Post by MiNdErAsR »

Working like a charm. Thanks!

8)
j
jjnerd
Voice
Posts: 3
Joined: Sat Feb 24, 2007 9:48 am

Post by jjnerd »

"Could not fetch any search result or error message. The script is probably outdated."

Looks like smth has changed. Fix would be awesome, love the script.
d
dalys
Voice
Posts: 9
Joined: Sun Oct 05, 2008 9:37 am
Location: Gothenburg, Sweden / QuakeNet

Post by dalys »

Hello all! I have updated the script now and everything should work fine again. I was working on a 1.2 version in 2009 with some simple new features but I can not access that file now. :oops:

Direct download for 1.2: http://github.com/dalys/Blu-ray.com-egg ... om_1.2.tcl
R
Ragman
Voice
Posts: 5
Joined: Sun Jun 06, 2010 4:57 pm

Post by Ragman »

I updated to version 1.2 of the script but I still get the error message "Could not fetch any search result or error message. The script is probably outdated.".
Have they updated their site again?
c
cbsjanten1
Voice
Posts: 4
Joined: Fri Jun 18, 2010 10:51 am

Post by cbsjanten1 »

hey im still running version 1.1
just replace ur url line with

Code: Select all

set bluray_url "http://www.blu-ray.com/search/?quicksearch=1&section=movies&quicksearch_keyword=$bluray_keywords&searchbutton.x=0&searchbutton.y=0"
works really fine...great script
R
Ragman
Voice
Posts: 5
Joined: Sun Jun 06, 2010 4:57 pm

Post by Ragman »

cbsjanten1 wrote:hey im still running version 1.1
just replace ur url line with

Code: Select all

set bluray_url "http://www.blu-ray.com/search/?quicksearch=1&section=movies&quicksearch_keyword=$bluray_keywords&searchbutton.x=0&searchbutton.y=0"
works really fine...great script
I updated v1.2 with the above line and now it works like a charm.
THANKS A LOT! :)
c
cbsjanten1
Voice
Posts: 4
Joined: Fri Jun 18, 2010 10:51 am

Post by cbsjanten1 »

seems the changed something on blu-ray.com again :(
R
Ragman
Voice
Posts: 5
Joined: Sun Jun 06, 2010 4:57 pm

Post by Ragman »

Anyone manage to fix the script again?
d
dalys
Voice
Posts: 9
Joined: Sun Oct 05, 2008 9:37 am
Location: Gothenburg, Sweden / QuakeNet

Post by dalys »

Ragman wrote:Anyone manage to fix the script again?
Hey-o! I'm actually working on it right now. Expect a new version today or at least this weekend. :)
R
Ragman
Voice
Posts: 5
Joined: Sun Jun 06, 2010 4:57 pm

Post by Ragman »

Hooray!
Tack i förväg ;)
Z
Znuff
Voice
Posts: 9
Joined: Mon May 17, 2010 1:00 am

Post by Znuff »

impatiently waiting

(would be nice to see the .diff)
Z
Znuff
Voice
Posts: 9
Joined: Mon May 17, 2010 1:00 am

Post by Znuff »

Couldn't wait for an update from dalys so I updated it to suit my needs. I removed the -details switch because there was way too much work to adapt it for the changes on blu-ray.com.

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&section=movies&keyword=$bluray_keywords&sortby=popularity"
    set bluray_url "http://www.blu-ray.com/search/?quicksearch=1&section=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"
edit: forgot to edit 2 lines.
Post Reply