Jump to content
chain

IRC Pre Bot v2.1

Recommended Posts

  • Administrators

his script accesses www.orlydb.com and pulls the newest Scene Releases and posts them on the channel.

Added Search function: !pre Release Name

Added where you can omit languages that you do not want to show.

Added option to turn the Pre announce on or off through the party line ".pre" in the party line will toggle settings

Fixed issue with program crashing after a few hours of running.

Fixed issue with search not working

 

## Displys Scene Releases that have been Pred on the website www.orlydb.com ##

namespace eval pre {
  variable language "FRENCH|GERMAN|SWEDISH|DANSIH|DUTCH|FINNISH|NORWEGIAN|SPANiSH"
  #"APPS 0DAY MOBILE ANiME AUDiOBOOKS COVERS DOX EBOOKS IMAGESET SAMPLES UNKNOWN MP3 MVIDS MDVDR TV TV-BLURAY TV-DVDR TV-DVDRiP TV-HR TV-x264 TV-XViD VCD BLURAY x264 XViD SVCD TRAILERS SUBPACK DiVX DVDR Wii XBOX XBOX360 GAMEBOY GAMECUBE GAMES DREAMCAST NDS PS1 PS2 PS3 PSP PSX PSXPSP XXX XXX-IMGSET"
  variable types "APPS 0DAY MOBILE MP3 TV-DVDR TV-DVDRiP TV-HR TV-x264 TV-XViD x264 XViD XXX XXX-IMGSET"
  #Set to channel to show Pre information
  variable chan "#Chan"
  #Change preNum to how many Search Results you want shown  
  variable Num 5
}
set PreNew ""

#Change to (on/off) to turn on pre bot
set status "on"

bind pub - !pre presearch
bind dcc - pre pre:change

proc pre {} {
  global PreNew status
  if {$status == "on"} {
    set PreOld $PreNew
    set url "http://www.orlydb.com"
    set page [web2data $url]
    if {$page!=0} {
      regexp {"timestamp">(.*?)<\/span>} $page a stamp
      regexp {"section"><a.*?>(.*?)<\/a>} $page a section
      regexp {"release">(.*?)<\/span>} $page a release
      if {[info exists release]} { set PreNew "$stamp $section $release"
          if {![regexp -nocase $pre::language $release] && [regexp -nocase $section $pre::types] && $PreNew != $PreOld} { putquick "PRIVMSG $pre::chan :\00308(\00315PRE\00308)\00315 $stamp \00308(\00315$section\00308)\00315 $release" }
      }
    }
  }
  utimer 2 pre
}

proc pre:change {hand idx arg} {
  global status
  if {$status == "on"} { set status "off"
  } else { set status "on" } 
  putdcc $idx "Pre status changed to: $status"
}
proc presearch { nick host hand chan arg } { 
  set arg [string map { " " "+" } $arg]
  set url "http://www.orlydb.com/?q=$arg"
  set page [web2data $url]
  set temp 1
  while {$temp <= $pre::Num && [regexp {<div>(.*?)<\/div>} $page a result]} {
    if {[info exists result]} {
      regexp {"timestamp">(.*?)<\/span>} $result a stamp
      regexp {"section"><a.*?>(.*?)<\/a>} $result a section
      regexp {"release">(.*?)<\/span>} $result a release   
      regsub {<div>(.*?)<\/div>} $page "" page

      if {![regexp -nocase $pre::language $release]} {
        if {[info exists release]} { incr temp
          putquick "PRIVMSG $chan :\00304(\00315PRE\00304)\00315 $stamp \00304(\00315$section\00304)\00315 $release"
          unset stamp section release 
        }
      }
    }
  }
  if {$temp==0} { putquick "PRIVMSG $chan :\00304(\00315PRE\00304)\00315 Nothing Found" }
}
proc web2data { website } {
    package require http
    if { [catch { set token [http::geturl $website -timeout 100000]} error] } {  return 0
     } elseif { [http::ncode $token] == "404" } { return 0
     } elseif { [http::status $token] == "ok" } { set data [http::data $token]
     } elseif { [http::status $token] == "timeout" } {  return 0
     } elseif { [http::status $token] == "error" } {  return 0 }
    http::cleanup $token
    if { [info exists data] } { return $data
    } else { return 0 }
}

utimer 2 pre

putlog "\00308(\00315PRE\00308)"

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...