Subtitles for Scene Releases

By zenx on Jul 13, 2012

Downloads subtitles for scene releases from addic7ed.com, requires curl & lwp::simple
./subs.pl Anger.Management.S01E04.PROPER.720p.HDTV.x264-2HD

#!/usr/bin/perl
# ./subs.pl Anger.Management.S01E04.PROPER.720p.HDTV.x264-2HD
use LWP::Simple;

if ( $#ARGV < 0 ) { print "usage: $0 <release> \n"; exit; }
$rls = @ARGV[0]; $orig = $rls;

@del = ("readnfo","repack","proper","extended","theatrical","limited","dc","rerip","dubbed","docu","unrated","festival","ac3","720p","1080p");
foreach (@del) { $rls =~ s/\.$_//i; }

if ($rls =~ /(.*)\.S([0-9]+)E([0-9]+)\./i) {
        $show = $1; $season = $2; $episode = $3; $show =~ s/\./ /g;
        tv("$show","$season","$episode");
} elsif ($rls =~ /(.*)\.([0-9]+)x([0-9]+)\./) {
        $show = $1; $season = $2; $episode = $3; $show =~ s/\./ /g;
        tv("$show","$season","$episode");
}

print "\n";

sub tv {
        $show = $_[0]; $show =~ s/ /_/g;
        @url = split("\n", get("http://www.addic7ed.com/serie/$show/$_[1]/$_[2]/x"));
        foreach (@url) {
                if ($_ =~ /English&nbsp;.*saveFavorite\(([0-9]+)/) {
                        $sub = "curl -s -H 'Referer: http://www.addic7ed.com/' http://www.addic7ed.com/original/$1/1 -o ./$orig.srt";
                        system("$sub");
                        exit;
                }
        }
}

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.