Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # --------------------------------------
- # SCC Auto Download Script for Irssi
- # version 1.3+debug by cyb
- # --------------------------------------
- use Net::SSLeay;
- use LWP::Simple;
- use Irssi;
- use Irssi::Irc;
- # your passkey goes here
- $passkey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
- # default place torrents will be downloaded to
- $torrentdir = "/home/narayan/Downloads/";
- # Debug
- $debug = 1;
- # Retry delay in seconds
- $retry = 30;
- # [ Define categories to download below. ]
- #
- # Please remove the seperator(/ or -, dont worry about _ like Music_Videos can be left as is) from the category ie, tv/xvid becomes $tvxvid = 1;
- # Movies/Xvid becomes $moviesxvid =1; etc... and make sure it is in lowercase.
- #$tvx264 = 1;
- #$moviesxvid = 1;
- #$tvxvid = 1;
- $mp3 = 1;
- $moviespacks = 1;
- $gamespacks = 1;
- $xxxpacks = 1;
- $musicpacks = 1;
- $tvpacks = 1;
- $gamespc = 1;
- #$apps0day = 1;
- #$tvdvdrip = 1;
- # [ Inclusion and Exclusion Filters ]
- # NOTE: If NO filters are defined, the script will download ALL torrents from the category.
- # You can have zero, one or more filters.
- # Define inclusion filters
- #
- # Same as defining categories, remove category seperator and make sure its lowercase with the keyword 'filter' added to the
- # end of the category name
- $gamespcfilter = "RELOADED|SKIDROW|ViTALiTY|FLT";
- # Define exclusion filter (NOT filter)
- #
- # Same as above, keyword for this filter is 'not', add 'not' to end of the category name for this filter to be active
- # $tvxvidnot = "Greys.Anatomy|Smallville";
- #$moviesxvidnot = "internal";
- # [ Size filters ]
- #
- # Define the max size of torrents... the keyword to add this time to the category name is 'size'
- # NOTE: Put size in MB
- #$tvpacksmax = 20000;
- # Define min size of torrents
- # Add min to the end of the category
- #$tvpacksmin = 1000;
- #$mp3min = 100;
- #$apps0daymin = 300;
- # [ Specific directory for a category ]
- #
- # Add 'dir' to the end of the category name... if this isnt defined, the default place to download torrnets will be used
- #$apps0daydir = "/home/cyb/t/appz";
- #$mp3dir = "/home/cyb/t/mp3";
- #$tvpacksdir = "/home/cyb/t/packs";
- #---------------------------------------------------------------------------------
- # END OF CONFIG
- #---------------------------------------------------------------------------------
- my $url = "https://sceneaccess.eu";
- my $aurl = " ";
- my $botnick = "SCC";
- use vars qw($VERSION %IRSSI);
- $VERSION="1.3";
- %IRSSI = (
- authors=> 'cyb',
- name=> 'SCCauto',
- description=> 'SCC Auto download script',
- license=> 'GPL',
- );
- Irssi::print ("%_SCC Auto Download Script v1.3 Loaded%:%_by cyb");
- sub event_privmsg {
- my ($server, $data, $nick, $address) = @_;
- my ($target, $text) = split(/ :/, $data, 2);
- $text =~ s/\x03\d?\d?(,\d?\d?)?|\x02|\x1f|\x16|\x06|\x07//g;
- my $match = qr/NEW in (.*): -> (.*) \((.*) (MB|GB)\) \- .*details\.php\?id=(.*)\)/i;
- if ($text =~ $match)
- {
- $disptype = $1;
- $type = $1;
- $release = $2;
- $rlssize = $3;
- $mborgb = $4;
- $relid = $5;
- }
- $type =~ s/[\/,\-]//;
- # $type =~ s/\///;
- $type = lc $type;
- $release =~ s/\s.*$//;
- $filter = "$type" . "filter";
- $notfilter = "$type" . "not";
- $sizecheck = "$type" . "max";
- $minsize = "$type" . "min";
- $typedir = "$type" . "dir";
- if ($mborgb =~ /GB/) { $rlssize = $rlssize * 1024; }
- if ($type =~ /.*packs/) { $aurl = "downloadbig2.php"; } else { $aurl = "download2.php"; }
- $furl = "$url/$aurl/$relid/$passkey/$release" . ".torrent";
- # Irssi::print("$$typedir");
- if (defined($$typedir)) {
- $filename = "$$typedir" . "/$release" . ".torrent";
- } else {
- $filename = "$torrentdir" . "/$release" . ".torrent";
- }
- my $failed = 0;
- if (($nick =~ /$botnick/) && (defined($$type) && $$type == 1) && (!(-e $filename))) {
- if ($debug == 1) { Irssi::print("Passed: botnick check, category defined, file doesnt exist");
- $w = filter($release, $$filter);
- $x = notfilter($release, $$notfilter);
- $y = sizefilter($rlssize, $$sizecheck);
- $z = minsize($rlssize, $$minsize);
- Irssi::print("Filter: $w Notfilter: $x Max size: $y Min size: $z");
- Irssi::print("Filter: ($release/$$filter) Notfilter: ($release/$$notfilter) Maxsize: ($rlssize/$$sizecheck) Minsize: ($rlssize/$$minsize)");
- }
- if (filter($release, $$filter) == 1 && notfilter($release, $$notfilter) == 1 && sizefilter($rlssize, $$sizecheck) == 1 && minsize($rlssize, $$minsize) == 1) {
- my ($dltype, $length, $mod,$expires, $server) = head($furl);
- if ((download($furl,$filename,0) == 1) && ($dltype eq "application/x-bittorrent")) {
- Irssi::print("%G[$disptype]%n $release downloaded successfully from %p$botnick%n");
- }
- elsif (download($furl, $filename, $retry) == 1) {
- Irssi::print("%B[$disptype]%n $release downloaded on retry ($retry s) from %p$botnick%n");
- } else {
- Irssi::print("%R[$disptype]%n $release failed to download, giving up");
- }
- }
- }
- }
- sub filter {
- if (defined($_[1]) && $_[0] =~ /$_[1]/i) {
- return 1;
- }
- elsif (!defined($_[1])) {
- return 1;
- }
- else {
- return 0;
- }
- }
- sub notfilter {
- if (defined($_[1]) && $_[0] =~ /$_[1]/i) {
- return 0;
- }
- elsif (!defined($_[1])) {
- return 1;
- }
- else {
- return 1;
- }
- }
- sub sizefilter {
- if (defined($_[1]) && ($_[1] > $_[0])) {
- return 1;
- }
- elsif (!defined($_[1])) {
- return 1;
- }
- else {
- return 0;
- }
- }
- sub minsize {
- if (defined($_[1]) && ($_[1] < $_[0])) {
- return 1;
- }
- elsif (!defined($_[1])) {
- return 1;
- }
- else {
- return 0;
- }
- }
- sub download {
- sleep ($_[2]);
- if ($debug == 1) { Irssi::print("Downloading: $_[0] Saving to: $_[1]"); }
- my $status = getstore($_[0], $_[1]);
- if (is_success($status)) { return 1; } else { return 0; }
- }
- Irssi::signal_add("event privmsg", "event_privmsg")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement