Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; ===============================
- ; TVRage Script v1 by ES and hxck
- ; ===============================
- on *:LOAD: {
- /echo -s TVRage v1 :: $chr(91) ES & hxck $chr(93) has been loaded. Type !tvhelp for a list of commands. http://www.hawkee.com/snippet/8822/
- }
- on *:TEXT:!tvhelp:#: {
- msg # !n|!next - Get next episode information (ie !n Dexter)
- msg # !l|!last - Get last episode information (ie !l Dexter)
- msg # !tv - Get general show information (ie !tv Dexter)
- msg # !ep seasonXepisode show - Get episode summary (ie !ep 1x2 Dexter)
- msg # !show - Get show summary (ie !show Dexter)
- }
- menu Channel,Status {
- .$iif($group(#TVR) == On,$style(1)) ES/hxck
- ..$iif($group(#TVR) == On,$style(2)) TVRage On: .enable #TVR
- ..$iif($group(#TVR) == Off,$style(2)) TVRage Off: .disable #TVR
- }
- #TVR on
- on *:TEXT:!*:#: {
- ; ===========================
- ; Close sockets if we need to
- ; ===========================
- if ($sock(tvrage)) { sockclose tvrage }
- if ($sock(tvrage2)) { sockclose tvrage2 }
- if ($sock(tvrage3)) { sockclose tvrage3 }
- ; ===========================
- ; Set different triggers here
- ; ===========================
- if (($1 == !n) || ($1 == !next)) {
- if (!$2) { msg # Syntax: !n <show name> }
- if ($2) {
- set %tvr.output next
- set %tvr.show $replace($2-,$chr(32),$chr(37) $+ 20)
- sockopen -n tvrage services.tvrage.com 80
- sockmark tvrage msg #
- }
- }
- if (($1 == !l) || ($1 == !last)) {
- if (!$2) { msg # Syntax: !l <show name> }
- if ($2) {
- set %tvr.output last
- set %tvr.show $replace($2-,$chr(32),$chr(37) $+ 20)
- sockopen -n tvrage services.tvrage.com 80
- sockmark tvrage msg #
- }
- }
- if ($1 == !tv) {
- if (!$2) { msg # Syntax: !tv <show name> }
- if ($2) {
- set %tvr.output info
- set %tvr.show $replace($2-,$chr(32),$chr(37) $+ 20)
- sockopen -n tvrage services.tvrage.com 80
- sockmark tvrage msg #
- }
- }
- if ($1 == !ep) {
- if (!$2) { msg # Syntax: !ep <ep number, eg 1x1> <show name> | halt }
- if (!$3) { msg # Syntax: !ep <ep number, eg 1x1> <show name> | halt }
- else {
- set %tvr.output.nick $nick
- set %tvr.output epsummary
- set %tvr.show $replace($3-,$chr(32),$chr(37) $+ 20)
- set %tvr.epnum $2
- sockopen -n tvrage services.tvrage.com 80
- }
- }
- if ($1 == !show) {
- if (!$2) { msg # Syntax: !show <show name> }
- else {
- set %tvr.output.nick $nick
- set %tvr.show $replace($2-,$chr(32),$chr(37) $+ 20)
- set %tvr.output showsummary
- sockopen -n tvrage services.tvrage.com 80
- sockmark tvrage msg #
- }
- }
- else halt
- }
- ; ===========================
- ; Handle sockopen events here
- ; ===========================
- on *:SOCKOPEN:tvrage: {
- var %s sockwrite -n $sockname
- if ($sockerr) { $sock(tvrage).mark Socket Error: $sock(tvrage).wsmsg }
- %s GET /tools/quickinfo.php?show= $+ %tvr.show $+ &ep= $+ %tvr.epnum HTTP/1.1
- %s Host: services.tvrage.com
- %s Connection: close
- %s $crlf
- }
- on *:SOCKOPEN:tvrage2: {
- var %s sockwrite -n $sockname
- if ($sockerr) { $sock(tvrage2).mark Socket Error: $sock(tvrage2).wsmsg }
- %s GET %tvr.epsumurl HTTP/1.1
- %s Host: www.tvrage.com
- %s Connection: close
- %s $crlf
- }
- on *:SOCKOPEN:tvrage3: {
- var %s sockwrite -n $sockname
- if ($sockerr) { $sock(tvrage3).mark Socket Error: $sock(tvrage3).wsmsg }
- %s GET /myfeeds/showinfo.php?key=sqsTSaJG4qJagM6ldpKZ&sid= $+ %tvr.showid HTTP/1.1
- %s Host: services.tvrage.com
- %s Connection: close
- %s $crlf
- }
- ; ===========================
- ; Handle sockread events here
- ; ===========================
- on *:SOCKREAD:tvrage: {
- if ($sockerr) { $sock(tvrage).mark Socket Error: $sock(tvrage).wsmsg }
- var %tvrtemp
- sockread %tvrtemp
- ; ============================
- ; Set !n !l !tv variables here
- ; ============================
- if ((%tvr.output == next) || (%tvr.output == last) || (%tvr.output == info)) {
- if (Show Name isin %tvrtemp) { set %tvr.showname $gettok(%tvrtemp,2,64) }
- if (Show URL isin %tvrtemp) { set %tvr.url $gettok(%tvrtemp,2,64) }
- if (Premiered isin %tvrtemp) { set %tvr.premiered $gettok(%tvrtemp,2,64) }
- if (Started isin %tvrtemp) { set %tvr.started $gettok(%tvrtemp,2,64) }
- if (Ended isin %tvrtemp) { set %tvr.ended $gettok(%tvrtemp,2,64) }
- if (Country isin %tvrtemp) { set %tvr.country $gettok(%tvrtemp,2,64) }
- if (Status isin %tvrtemp) { set %tvr.status $gettok(%tvrtemp,2,64) }
- if (Classification isin %tvrtemp) { set %tvr.class $gettok(%tvrtemp,2,64) }
- if (Genres isin %tvrtemp) { set %tvr.genres $gettok(%tvrtemp,2,64) }
- if (Network isin %tvrtemp) { set %tvr.network $gettok(%tvrtemp,2,64) }
- if (Airtime isin %tvrtemp) { set %tvr.airtime $gettok(%tvrtemp,2,64) }
- if (Runtime isin %tvrtemp) { set %tvr.runtime $gettok(%tvrtemp,2,64) }
- if (Next Episode isin %tvrtemp) {
- set %tvr.nextemp $gettok(%tvrtemp,2,64)
- set %tvr.nextepnum $gettok(%tvr.nextemp,1,94)
- set %tvr.nextepname $gettok(%tvr.nextemp,2,94)
- set %tvr.nextepday $gettok(%tvr.nextemp,3,94)
- }
- if (Latest Episode isin %tvrtemp) {
- set %tvr.lastemp $gettok(%tvrtemp,2,64)
- set %tvr.lastepnum $gettok(%tvr.lastemp,1,94)
- set %tvr.lastepname $gettok(%tvr.lastemp,2,94)
- set %tvr.lastepday $gettok(%tvr.lastemp,3,94)
- }
- if (GMT+0 NODST isin %tvrtemp) { set %tvr.airnextepcmt $calc($gettok(%tvrtemp,2,64) - 36004 - $gmt) }
- if (%tvr.country == Australia) {
- set %tvr.airnextepcmt $calc($gettok(%tvrtemp,2,64) - 28800 - $gmt)
- }
- }
- ; ==============================
- ; Set 1st !tvinfo variables here
- ; ==============================
- if (%tvr.output == showsummary) {
- if (Show ID isin %tvrtemp) { set %tvr.showid $gettok(%tvrtemp,2,64) }
- if (Show Name isin %tvrtemp) { set %tvr.showname $gettok(%tvrtemp,2,64) }
- if (Show URL isin %tvrtemp) { set %tvr.url $gettok(%tvrtemp,2,64) }
- }
- ; ==========================
- ; Set 1st !ep variables here
- ; ==========================
- if (%tvr.output == epsummary) {
- if (Episode URL isin %tvrtemp) {
- set %tvr.url $gettok(%tvrtemp,2,64)
- set %tvr.epsumurl $remove($gettok(%tvrtemp,2,64),http://www.tvrage.com)
- }
- if (Episode info isin %tvrtemp) {
- set %tvr.epnumout $gettok($gettok(%tvrtemp,2,64),1,94)
- set %tvr.epname $gettok($gettok(%tvrtemp,2,64),2,94)
- set %tvr.epair $gettok($gettok(%tvrtemp,2,64),3,94)
- }
- if (Show Name isin %tvrtemp) { set %tvr.showname $gettok(%tvrtemp,2,64) }
- }
- }
- on *:SOCKREAD:tvrage2: {
- if ($sockerr) { $sock(tvrage).mark Socket Error: $sock(tvrage2).wsmsg }
- ; ==========================
- ; Set 2nd !ep variables here
- ; ==========================
- var %tvrtemp2
- sockread %tvrtemp2
- if (%tvr.epsum.temp == 1) {
- set %tvr.epsum %tvrtemp2
- set %tvr.epsum.temp 0
- }
- if (<div class='show_synopsis'> isin %tvrtemp2) { set %tvr.epsum.temp 1 }
- }
- on *:SOCKREAD:tvrage3: {
- if ($sockerr) { $sock(tvrage).mark Socket Error: $sock(tvrage3).wsmsg }
- ; ==============================
- ; Set 2nd !tvinfo variables here
- ; ==============================
- var %tvrtemp3
- sockread %tvrtemp3
- if (<image> isin %tvrtemp3) { set %tvr.showpic $between(%tvrtemp3,<image>,</image>,1) }
- if (<summary> isin %tvrtemp3) { set %tvr.showsummary $between(%tvrtemp3,<summary>,</summary>,1) }
- }
- ; ============================
- ; Handle sockclose events here
- ; ============================
- on *:SOCKCLOSE:tvrage: {
- ; ============================
- ; Next Episode
- ; ============================
- if (%tvr.output == next) {
- if ((%tvr.nextemp != $null) && (%tvr.nextepday == TBA)) {
- $sock(tvrage).mark $chr(91) 07 $+ %tvr.showname $+ $chr(93) :: $chr(91) 6 $+ Airs %tvr.airtime on %tvr.network $+ $chr(93) :: $chr(91) $+ 7 %tvr.nextepnum $+ $chr(93) :: $chr(91) 7 $+ %tvr.nextepname $+ $chr(93) :: $chr(91) 7 $+ %tvr.nextepday $+ $chr(93)
- unset %tvr.* | halt
- }
- if (%tvr.nextemp != $null) && (Season isin %tvr.nextepname) && (%tvr.nextepday == TBA) {
- $sock(tvrage).mark $chr(91) 07 $+ %tvr.showname $+ $chr(93) :: $chr(91) 6 $+ Airs %tvr.airtime on %tvr.network $+ $chr(93) :: $chr(91) $+ 7 %tvr.nextepnum $+ $chr(93) :: $chr(91) 7 $+ %tvr.nextepname $+ $chr(93) :: $chr(91) 7 $+ %tvr.nextepday $+ $chr(93)
- unset %tvr.* | halt
- }
- if (%tvr.nextemp != $null) && (Season isin %tvr.nextepname) && (/ isin %tvr.nextepday) {
- $sock(tvrage).mark $chr(91) 07 $+ %tvr.showname $+ $chr(93) :: $chr(91) 6 $+ Airs %tvr.airtime on %tvr.network $+ $chr(93) :: $chr(91) $+ 7 %tvr.nextepnum $+ $chr(93) :: $chr(91) 7 $+ %tvr.nextepname $+ $chr(93) $iif($left(%tvr.airnextepcmt,1) != -,:: $chr(91) 7 $+ %tvr.nextepday $+ $chr(93) :: $chr(91) 6 $+ Airing in: $betterduration(%tvr.airnextepcmt) $+ $chr(93),:: $chr(91) 7 $+ %tvr.nextepday $+ $chr(93) 6 $+ Aired: $betterduration(%tvr.airnextepcmt) ago. )
- unset %tvr.* | halt
- }
- if (%tvr.nextemp != $null) {
- $sock(tvrage).mark $chr(91) 07 $+ %tvr.showname $+ $chr(93) :: $chr(91) 6 $+ Airs %tvr.airtime on %tvr.network $+ $chr(93) :: $chr(91) $+ 7 %tvr.nextepnum $+ $chr(93) :: $chr(91) 7 $+ %tvr.nextepname $+ $chr(93) $iif($left(%tvr.airnextepcmt,1) != -,:: $chr(91) 7 $+ %tvr.nextepday $+ $chr(93) :: $chr(91) 6 $+ Airing in: $betterduration(%tvr.airnextepcmt) $+ $chr(93),:: $chr(91) 7 $+ %tvr.nextepday $+ $chr(93) 6 $+ Aired: $betterduration(%tvr.airnextepcmt) ago. )
- unset %tvr.* | halt
- }
- if (%tvr.nextemp == $null) {
- $sock(tvrage).mark Next episode information for %tvr.showname is unavailable.
- unset %tvr.* | halt
- }
- }
- ; ============================
- ; Last Episode
- ; ============================
- if (%tvr.output == last) {
- if (%tvr.lastemp != $null) {
- $sock(tvrage).mark $chr(91) 07 $+ %tvr.showname $+ $chr(93) :: $chr(91) $iif(%tvr.ended != $null,06 $+ Aired,06 $+ Airs) %tvr.airtime on %tvr.network $+ $chr(93) :: $chr(91) 07 $+ %tvr.lastepnum $chr(93) :: $chr(91) 07 $+ %tvr.lastepname $+ $chr(93) :: $chr(91) 06 $+ %tvr.lastepday $+ $chr(93) :: $chr(91) 07 $+ https://broadcasthe.net/torrents.php?searchstr= $+ $replace(%tvr.showname,$chr(32),$chr(43)) $+ $chr(43) $+ s $+ $replace(%tvr.lastepnum,x,e) $+ $chr(93)
- unset %tvr.* | halt
- }
- if (%tvr.nextemp == $null) {
- $sock(tvrage).mark Last episode information for 07 $+ $replace(%tvr.show,$chr(37) $+ 20,$chr(32)) is unavailable.
- unset %tvr.* | halt
- }
- }
- ; ============================
- ; Show Information
- ; ============================
- if (%tvr.output == info) {
- ; msg %tvr.output.chan
- if (%tvr.showname != $null) {
- $sock(tvrage).mark $chr(91) 07 $+ %tvr.showname $+ $chr(93) :: 06 $+ %tvr.url $+
- if (%tvr.ended != $null) {
- $sock(tvrage).mark 07 $+ Premiered: $+ 06 $+ %tvr.started - 07 $+ Ended: $+ %tvr.ended $+
- }
- else {
- $sock(tvrage).mark 07 $+ Premiered: $+ 6 $+ %tvr.started $+ - 6 $+ %tvr.status 7 $+ ( $+ %tvr.country $+ ) $+
- }
- $sock(tvrage).mark 7 $+ Airs $+ 6 $+ %tvr.airtime $+ 7 $+ on $+ 6 $+ %tvr.network $+ 7 $+ ( $+ %tvr.runtime min $+ ) $+
- $sock(tvrage).mark 6 $+ %tvr.genres $+
- $sock(tvrage).mark 7 $+ Classification: $+ 6 $+ %tvr.class $+
- unset %tvr.* | halt
- }
- if (%tvr.showname == $null) {
- $sock(tvrage).mark Show does not exist. Please check your spelling and try again.
- unset %tvr.* | halt
- }
- }
- ; ============================
- ; Ep Information
- ; ============================
- if (%tvr.output == epsummary) {
- sockopen -n tvrage2 www.tvrage.com 80
- }
- ; ============================
- ; TVinfo Information
- ; ============================
- if (%tvr.output == showsummary) {
- sockopen -n tvrage3 services.tvrage.com 80
- }
- }
- on *:SOCKCLOSE:tvrage2: {
- ; ============================
- ; Ep Information
- ; ============================
- if (Click Here To Add isin %tvr.epsum) { notice %tvr.output.nick Sorry, no summary availible for episode %tvr.epnumout of %tvr.showname }
- else {
- notice %tvr.output.nick $chr(91) 7 $+ %tvr.showname $+ $chr(93) $chr(91) $+ 7 %tvr.epnumout - %tvr.epname $+ $chr(93) $chr(91) $+ 7 %tvr.epair $+ $chr(93) 6 $+ %tvr.url $+
- notice %tvr.output.nick $nohtml(%tvr.epsum)
- ;unset %tvr.* | halt
- }
- }
- on *:SOCKCLOSE:tvrage3: {
- ; ============================
- ; Show Summary
- ; ============================
- query %tvr.output.nick $chr(91) 7 $+ %tvr.showname $chr(93) 6 $+ %tvr.url $+
- query %tvr.output.nick $replace(%tvr.showsummary,",")
- query %tvr.output.nick $chr(91) 7 $+ Show image $+ $chr(93) %tvr.showpic
- /close -m %tvr.output.nick
- unset %tvr.* | halt
- }
- ; ===========================
- ; Aliases
- ; ===========================
- alias -l nohtml {
- var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, )
- return %x
- }
- alias between { noop $regex($1,/\Q $+ $2 $+ \E(.*?)\Q $+ $3 $+ \E/gi) | return $regml($4) }
- ; ==============================================
- ; Thanks to http://www.nealirc.org/IRC/mIRC.html
- ; ==============================================
- alias betterduration {
- var %lifeseconds = $abs($1)
- var %age, %years, %months, %days, %hours, %minutes, %seconds, %temp
- %years = $int($calc(%lifeseconds / 31557600))
- if (%years != 0) %age = %years year $+ $iif(%years > 1,s) $+ ,
- %temp = $calc(%lifeseconds - (%years * 31557600))
- %months = $int($calc(%temp / 2678400))
- if (%months != 0) %age = %age %months month $+ $iif(%months > 1,s) $+ ,
- %temp = $calc(%temp - (%months * 2678400))
- %weeks = $int($calc(%temp / 604800))
- if (%weeks != 0) %age = %age %weeks week $+ $iif(%weeks > 1,s) $+ ,
- %temp = $calc(%temp - (%weeks * 604800))
- %days = $int($calc(%temp / 86400))
- if (%days != 0) %age = %age %days day $+ $iif(%days > 1,s) $+ ,
- %temp = $calc(%temp - (%days * 86400))
- %hours = $int($calc(%temp / 3600))
- if (%hours != 0) %age = %age %hours hour $+ $iif(%hours > 1,s) $+ ,
- %temp = $calc(%temp - (%hours * 3600))
- %minutes = $int($calc(%temp / 60))
- if (%minutes != 0) %age = %age %minutes minute $+ $iif(%minutes > 1,s)
- %seconds = $calc(%temp % 60)
- if (%seconds != 0) %age = %age and %seconds second $+ $iif(%seconds > 1,s)
- if ($right(%age, 1) == $chr(44)) return $left(%age, -1)
- return %age
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement