4 use Getopt::Long qw/:config gnu_getopt/;
6 if(!defined($ARGV[0])) {
7 print STDERR "usage: anndl SERIES\n";
11 unless($id = Anime::ANN::getid $ARGV[0]) {
12 print STDERR "anndl: could not find $ARGV[0]\n";
16 %info = %{Anime::ANN::getseries $id};
18 if(!defined $info{"eps"}) {
19 print "could not find number of eps\n";
21 if(!(<STDIN> =~ /^y/i)) {
26 $name = $info{"name"};
27 print "canonical name [$name]: ";
28 chomp($newname = <STDIN>);
29 $name = $newname if $newname ne "";
30 $dirname = $ENV{"HOME"} . "/dc/autodl/cur/" . $name;
31 mkdir $dirname || die "could not create $dirname: $!";
32 mkdir "$dirname/.autodl" || die "could not create $dirname/.autodl: $!";
33 open FH, ">$dirname/.autodl/disabled" || die "could not create $dirname/.autodl/disabled: $!";
35 open FH, ">$dirname/nextep" || die "could not create nextep: $!";
38 open FH, ">$dirname/.autodl/uarg" || die "could not create $dirname/.autodl/uarg: $!";
39 if(defined $info{"eps"}) {
40 $melen = length $info{"eps"}
44 print FH ("rename:auto:$name:$melen:move:../autodl/cur/$name\n");
48 $sexpr = "\"L~$sexpr\[^0-9]*0*%i([^0-9]*(\\[[^]]*\\]|\\([^\\)]*\\)|v2))*[^0-9]*\\.(avi|ogm|mkv|mp4)\$\"";
49 open FH, ">$dirname/.autodl/sexpr" || die "could not create $dirname/.autodl/sexpr: $!";
52 print "sexpr: $sexpr\n";
54 if(!(<STDIN> =~ /^y/i)) {
55 system $ENV{"EDITOR"}, "$dirname/.autodl/sexpr";
57 open FH, ">$dirname/.autodl/curep" || die "could not create $dirname/.autodl/curep: $!";
60 if(defined $info{"eps"}) {
61 open FH, ">$dirname/.autodl/maxep" || die "could not create $dirname/.autodl/maxep: $!";
62 print FH ($info{"eps"} . "\n");
66 if(<STDIN> =~ /^y/i) {
67 unlink "$dirname/.autodl/disabled";