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 

TVmaze.com Eggdrop Script (Version 1.25 / 2015-10-03)
Goto page Previous  1, 2, 3, 4, 5, 6
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
Get_A_Fix
Master


Joined: 07 May 2005
Posts: 206
Location: New Zealand

PostPosted: Sun Mar 05, 2017 3:07 pm    Post subject: Reply with quote

Votex wrote:
is it possible to add some coloring , or showing us how to do it ?


Did you search the forums? You can find basic colour/control code syntax here
_________________
We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
fr0g
Voice


Joined: 29 Apr 2017
Posts: 1

PostPosted: Sat Apr 29, 2017 4:21 pm    Post subject: Reply with quote

ballz wrote:
*snip*

this is exactly what I was missing! gunna mod it to allow specifying date. thank you!
Back to top
View user's profile Send private message
wuseman
Voice


Joined: 24 Nov 2019
Posts: 1

PostPosted: Sun Nov 24, 2019 8:22 pm    Post subject: Reply with quote

Works great, thanks alot for this script.
Back to top
View user's profile Send private message Send e-mail
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 260
Location: /dev/null

PostPosted: Wed Mar 25, 2020 12:52 pm    Post subject: Reply with quote

Hello,

Hope its allright. I made some modifications to the script Smile
credit is in inatact Smile

And made the output danish, so just change it to your needs Smile

Output:


Code:
##############################[ TVmaze.com Eggdrop Script ]######################
#                                                                               #
variable tvmazeversion 1.25
#                                                                               #
# Author   : x0x a.k.a. ericNL (freenode + EFnet)                               #
# Source   : http://forum.egghelp.org/viewtopic.php?t=20045                     #
#            Latest version of this script always in the 1st post of the topic! #
#                                                                               #
# Activate : Party line command: .chanset #channel +tvmaze                      #
# Commands : !tv or !t <show>    !last or !l <show>    !next or !n <show>       #
#                                                                               #
# Credits  : GaveUp, dlx, Znuff, speechles, nrt, Chokladkakan                   #
#            Viper (Jan Milants), thommey, GPenguin                             #
#                                                                               #
# Greets   : Everyone over at http://forum.egghelp.org                          #
#            The freenode #eggdrop crowd                                        #
#            My friends in #<translate-shark-to-dutch> on EFnet ;)              #
#                                                                               #
#                                                                               #
# Changelog  : Made it so it shows danish time and date output                  #
#              We read date a little different :)                               #
#                                                                               #
#################################################################################

# We'll be needing these to run the script.
package require http
package require json

# Don't forget to activate the script by setting .chanset #channel +tvmaze
setudef flag tvmaze

# The channel triggers.
bind pub - !tv tv
bind pub - !last tvlast
bind pub - !next tvnext

# Handle the !tv and !t triggers.
proc tv { nick host hand chan arg } {

        # Basic warez scene formatting support.
        # Translate 'The.Big.Bang.Theory.S09E01.720p.HDTV.X264-DIMENSION' to 'The Big Bang Theory' so that TVmaze understands your query.
        regsub -nocase -all {(\.| )([[:digit:]]{4}(\.| )|)(S[[:digit:]]{2}E[[:digit:]]{2}(\.| )|)(INTERNAL|INT|1080p|720p|HDTV|x264|WEBRip|REPACK|REAL|PROPER)(\.| ).*} $arg "" arg
        regsub -all "\\." $arg " " arg

        # This is where we contact TVmaze.
        set url "http://api.tvmaze.com/singlesearch/shows?[::http::formatQuery q $arg embed\[\] nextepisode embed\[\] previousepisode]"
        set timeout "5000"

        if {[catch { ::http::geturl $url -timeout $timeout } token]} {
        putquick "privmsg $chan :$nick, there was a fatal error :$token."
        return 0
        }

        if {![string equal -nocase [::http::status $token] "ok"] || ![string equal [::http::ncode $token] 200]} {
        putquick "privmsg $chan :\0034Fejl i din søgning, brug !tv <navn>\003"
        http::cleanup $token
        return 0
        }

        # Translate the TVmaze JSON data to Tcl dict which makes it possible for us to display the requested info in the IRC channel(s).
        set tvmaze [::json::json2dict [::http::data $token]]
        ::http::cleanup $token

        dict with tvmaze {

        # Set the network name.
        # Is the show you're looking for available on Amazon/Netflix etc. or a network like ABC/HBO/Showtime etc.?
        if {[string equal "null" $webChannel]} { set network [dict get $tvmaze network name] } else { set network [dict get $tvmaze webChannel name] }

        # If there is any info on a next episode, make sure we can use that info later on.
        if { [dict exists $tvmaze _embedded nextepisode url] } { set nextepurl [dict get $tvmaze _embedded nextepisode url] }
        if { [dict exists $tvmaze _embedded nextepisode name] } { set nextepname [dict get $tvmaze _embedded nextepisode name] }
        if { [dict exists $tvmaze _embedded nextepisode season] } { set nextepseason [dict get $tvmaze _embedded nextepisode season] }
        if { [dict exists $tvmaze _embedded nextepisode number] } { set nextepnumber [dict get $tvmaze _embedded nextepisode number] }
        if { [dict exists $tvmaze _embedded nextepisode airdate] } { set nextepairdate [dict get $tvmaze _embedded nextepisode airdate] }
        if { [dict exists $tvmaze _embedded nextepisode airtime] } { set nextepairtime [dict get $tvmaze _embedded nextepisode airtime] }
        if { [dict exists $tvmaze _embedded nextepisode runtime] } { set nextepruntime [dict get $tvmaze _embedded nextepisode runtime] }
        if { [dict exists $tvmaze _embedded nextepisode summary] } { set nextepsummary [dict get $tvmaze _embedded nextepisode summary] }

        # Same as above but now for the last/previous episode.
        if { [dict exists $tvmaze _embedded previousepisode url] } { set prevepurl [dict get $tvmaze _embedded previousepisode url] }
        if { [dict exists $tvmaze _embedded previousepisode name] } { set prevepname [dict get $tvmaze _embedded previousepisode name] }
        if { [dict exists $tvmaze _embedded previousepisode season] } { set prevepseason [dict get $tvmaze _embedded previousepisode season] }
        if { [dict exists $tvmaze _embedded previousepisode number] } { set prevepnumber [dict get $tvmaze _embedded previousepisode number] }
        if { [dict exists $tvmaze _embedded previousepisode airdate] } { set prevepairdate [dict get $tvmaze _embedded previousepisode airdate] }
        if { [dict exists $tvmaze _embedded previousepisode airtime] } { set prevepairtime [dict get $tvmaze _embedded previousepisode airtime] }
        if { [dict exists $tvmaze _embedded previousepisode runtime] } { set prevepruntime [dict get $tvmaze _embedded previousepisode runtime] }
        if { [dict exists $tvmaze _embedded previousepisode summary] } { set prevepsummary [dict get $tvmaze _embedded previousepisode summary] }

        # Set the airtime (if exists) and reformat the 24-hour clock data supplied by TVmaze to a 12-hour clock format.
        # Changed it to output the time and date, danish fasion way
        if { [dict exists $tvmaze _embedded nextepisode airstamp] } {
        set airstamp [clock scan [dict get $tvmaze _embedded nextepisode airstamp] -format {%Y-%m-%dT%H:%M:%S%z}]
        set airstampnyc [clock format $airstamp -format {%d-%m-%Y kl: %H:%M} -timezone :America/New_York]
        }

        if { [dict exists $tvmaze _embedded previousepisode airstamp] } {
        set airstamp [clock scan [dict get $tvmaze _embedded previousepisode airstamp] -format {%Y-%m-%dT%H:%M:%S%z}]
        set prevepairdate [clock format $airstamp -format {%d-%m-%Y} -timezone :America/New_York]
        }
   
        set premiere [clock scan $premiered -format {%Y-%m-%d}]
        set premiered [clock format $premiere -format {%d-%m-%Y}]

        if { ![info exists name] } {
                putquick "privmsg $chan :\0034Prøv at søg på en anden måde!\003"
                return 0
        }

        # Add a leading 0 if the season number is 1-9. Do the same for episode numbers 1-9. This formats S1E1 to S01E01 to match warez scene formatting.
        if { [info exists prevepseason] } { set prevepseason [format S%02d\0034X\003 $prevepseason] }
        if { [info exists prevepnumber] } { set prevepnumber [format E%02d $prevepnumber] }
        if { [info exists nextepseason] } { set nextepseason [format S%02d\0034X\003 $nextepseason] }
        if { [info exists nextepnumber] } { set nextepnumber [format E%02d $nextepnumber] }

        if { [info exists nextepname] && [info exists prevepname] && ![llength $genres] == 1 } {
                putquick "privmsg $chan :Title:\002\0034 $name\002\003 \u2022 Network: $network"
                putquick "privmsg $chan :Premiere: $premiered \u2022 Status: $status \u2022 URL: $url"
                putquick "privmsg $chan :Tidligere episode: $prevepseason$prevepnumber Startede: $prevepairdate \u2022 Næste episode: $nextepseason$nextepnumber Starter: $airstampnyc"
                return 0
                }
        if { [info exists nextepname] && [info exists prevepname] } {
                putquick "privmsg $chan :Title:\002\0034 $name\002\003 \u2022 Network: $network \u2022 Genre: $genres"
                putquick "privmsg $chan :Premiere: $premiered \u2022 Status: $status \u2022 URL: $url"
                putquick "privmsg $chan :Tidligere episode: $prevepseason$prevepnumber Startede: $prevepairdate \u2022 Næste episode: $nextepseason$nextepnumber Starter: $airstampnyc"
                return 0
                }

        if { ![info exists nextepname] && [info exists prevepname] && ![llength $genres] == 1 } {
                putquick "privmsg $chan :Title:\002\0034 $name\002\003 \u2022 Network: $network"
                putquick "privmsg $chan :Premiere: $premiered \u2022 Status: $status \u2022 URL: $url"
                putquick "privmsg $chan :Last: $prevepseason$prevepnumber startede: $prevepairdate"
                return 0
        }

        if { ![info exists nextepname] && [info exists prevepname] } {
                putquick "privmsg $chan :Title:\002\0034 $name\002\003 \u2022 Network: $network \u2022 Genre: $genres"
                putquick "privmsg $chan :Premiere: $premiered \u2022 Status: $status \u2022 URL: $url"
                putquick "privmsg $chan :Last: $prevepseason$prevepnumber startede: $prevepairdate"
                return 0
                }

        if { [info exists nextepname] && ![info exists prevepname] && ![llength $genres] == 1 } {
                putquick "privmsg $chan :Show:\002\0034 $name\002\003 \u2022 Network: $network"
                putquick "privmsg $chan :Premiere: $premiered \u2022 Status: $status \u2022 URL: $url"
                putquick "privmsg $chan :Næste episode: $nextepseason$nextepnumber Starter: $airstampnyc"
                return 0
                }

        if { [info exists nextepname] && ![info exists prevepname] } {
                putquick "privmsg $chan :Title:\002\0034 $name\002\003 \u2022 Network: $network \u2022 Genre: $genres"
                putquick "privmsg $chan :Premiere: $premiered \u2022 Status: $status \u2022 URL: $url"
                putquick "privmsg $chan :Næste episode: $nextepseason$nextepnumber Starter: $airstampnyc"
                return 0
                }

        if { ![info exists nextepname] && ![info exists previousepname] && ![llength $genres] == 1 } {
                putquick "privmsg $chan :Title: \002\0034$name\002\003 \u2022 Network: $network"
                putquick "privmsg $chan :Status: $status \u2022 URL: $url"
                return 0
                }

        if { ![info exists nextepname] && ![info exists previousepname] } {
                putquick "privmsg $chan :Title: \002$name\002 \u2022 Network: $network \u2022 Genre: $genres"
                putquick "privmsg $chan :Status: $status \u2022 URL: $url"
                return 0
                }

        }

}

# Handle the !next and !n triggers.
proc tvnext { nick host hand chan arg } {

        set url "http://api.tvmaze.com/singlesearch/shows?[::http::formatQuery q $arg embed\[\] nextepisode embed\[\] previousepisode]"
        set timeout "5000"

        if {[catch { ::http::geturl $url -timeout $timeout } token]} {
        putquick "privmsg $chan :$nick, there was a fatal error :$token."
        return 0
        }

        if {![string equal -nocase [::http::status $token] "ok"] || ![string equal [::http::ncode $token] 200]} {
        putquick "privmsg $chan :\0034Fejl i din søgning, brug !next <navn>\003"
        http::cleanup $token
        return 0
        }

        set tvmaze [::json::json2dict [::http::data $token]]
        ::http::cleanup $token

        dict with tvmaze {

        if {[string equal "null" $webChannel]} { set network [dict get $tvmaze network name] } else { set network [dict get $tvmaze webChannel name] }

        if { [dict exists $tvmaze _embedded nextepisode url] } { set nextepurl [dict get $tvmaze _embedded nextepisode url] }
        if { [dict exists $tvmaze _embedded nextepisode name] } { set nextepname [dict get $tvmaze _embedded nextepisode name] }
        if { [dict exists $tvmaze _embedded nextepisode season] } { set nextepseason [dict get $tvmaze _embedded nextepisode season] }
        if { [dict exists $tvmaze _embedded nextepisode number] } { set nextepnumber [dict get $tvmaze _embedded nextepisode number] }
        if { [dict exists $tvmaze _embedded nextepisode airdate] } { set nextepairdate [dict get $tvmaze _embedded nextepisode airdate] }
        if { [dict exists $tvmaze _embedded nextepisode airtime] } { set nextepairtime [dict get $tvmaze _embedded nextepisode airtime] }
        if { [dict exists $tvmaze _embedded nextepisode runtime] } { set nextepruntime [dict get $tvmaze _embedded nextepisode runtime] }
        if { [dict exists $tvmaze _embedded nextepisode summary] } { set nextepsummary [dict get $tvmaze _embedded nextepisode summary] }

        if { [dict exists $tvmaze _embedded nextepisode airstamp] } {
        set airstamp [clock scan [dict get $tvmaze _embedded nextepisode airstamp] -format {%Y-%m-%dT%H:%M:%S%z}]
        set airstampnyc [clock format $airstamp -format {%d-%m-%Y kl: %H:%M} -timezone :America/New_York]
        }

        if { ![info exists nextepname] } {
                putquick "privmsg $chan :\0034Fandt ingen info om næste episode.\003"
                        return 0
                }

                set nextepseason [format S%02d\0034X\003 $nextepseason]
                set nextepnumber [format E%02d $nextepnumber]

        putquick "privmsg $chan :Title:\002\0034 $name\002\003 \u2022 Næste episode: $nextepseason$nextepnumber \"$nextepname\" Starter: $airstampnyc"

        }

}

# Handle the !last and !l triggers.
proc tvlast { nick host hand chan arg } {

        set url "http://api.tvmaze.com/singlesearch/shows?[::http::formatQuery q $arg embed\[\] nextepisode embed\[\] previousepisode]"
        set timeout "5000"

        if {[catch { ::http::geturl $url -timeout $timeout } token]} {
        putquick "privmsg $chan :$nick, there was a fatal error :$token."
        return 0
        }

        if {![string equal -nocase [::http::status $token] "ok"] || ![string equal [::http::ncode $token] 200]} {
        putquick "privmsg $chan :\0034Fejl i din søgning, brug !last <navn>\003"
        http::cleanup $token
        return 0
        }

        set tvmaze [::json::json2dict [::http::data $token]]
        ::http::cleanup $token

        dict with tvmaze {

        if {[string equal "null" $webChannel]} { set network [dict get $tvmaze network name] } else { set network [dict get $tvmaze webChannel name] }

        if { [dict exists $tvmaze _embedded previousepisode url] } { set prevepurl [dict get $tvmaze _embedded previousepisode url] }
        if { [dict exists $tvmaze _embedded previousepisode name] } { set prevepname [dict get $tvmaze _embedded previousepisode name] }
        if { [dict exists $tvmaze _embedded previousepisode season] } { set prevepseason [dict get $tvmaze _embedded previousepisode season] }
        if { [dict exists $tvmaze _embedded previousepisode number] } { set prevepnumber [dict get $tvmaze _embedded previousepisode number] }
        if { [dict exists $tvmaze _embedded previousepisode airdate] } { set prevepairdate [dict get $tvmaze _embedded previousepisode airdate] }
        if { [dict exists $tvmaze _embedded previousepisode airtime] } { set prevepairtime [dict get $tvmaze _embedded previousepisode airtime] }
        if { [dict exists $tvmaze _embedded previousepisode runtime] } { set prevepruntime [dict get $tvmaze _embedded previousepisode runtime] }
        if { [dict exists $tvmaze _embedded previousepisode summary] } { set prevepsummary [dict get $tvmaze _embedded previousepisode summary] }

        if { [dict exists $tvmaze _embedded previousepisode airstamp] } {
        set airstamp [clock scan [dict get $tvmaze _embedded previousepisode airstamp] -format {%Y-%m-%dT%H:%M:%S%z}]
        set prevepairdate [clock format $airstamp -format {%d-%m-%Y kl: %H:%M} -timezone :America/New_York]
        }
       
        if { ![info exists prevepname] } {
                putquick "privmsg $chan :\0034Fandt ingen info om sidste episode.\003"
                        return 0
                }

                set prevepseason [format S%02d\0034X\003 $prevepseason]
                set prevepnumber [format E%02d $prevepnumber]

                putquick "privmsg $chan :Title:\0034\002 $name\002\003 \u2022 Sidste episode: $prevepseason$prevepnumber \"$prevepname\" Startede: $prevepairdate"

        }

}

putlog "TVmaze.com Eggdrop Script by x0x/ericNL version $tvmazeversion loaded! - Modded By: Fire-Fox"

_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text
Back to top
View user's profile Send private message MSN Messenger
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 Previous  1, 2, 3, 4, 5, 6
Page 6 of 6

 
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