-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTVShows2iTunes
executable file
·81 lines (71 loc) · 1.59 KB
/
TVShows2iTunes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/perl
use strict;
use Getopt::Long;
use Contents::Main::Transcode;
use Contents::Main::GetSubtitles;
use Contents::Main::TVs2iT;
use Contents::Main::help qw(help help_lang);
my $same_specie;
my $help_lang;
my $help;
my $input;
my $TVShow2iTunes;
my $Subtitles;
my @lang;
my $transcode;
GetOptions(
"i=s" => \$input,
"input=s" => \$input,
"help" => \$help,
"l=s" => \@lang,
"lang=s" => \@lang,
"help-lang" => \$help_lang,
"t=s" => \$transcode,
"transcode=s" => \$transcode
);
if($input){
#input is a file
if (-f $input) {
$TVShow2iTunes=Contents::Main::TVs2iT->new(
input=> $input,
lang=>@lang,
transcode=>$transcode
);
$Subtitles=Contents::Main::GetSubtitles->new($TVShow2iTunes);
$Subtitles->login($TVShow2iTunes);
$TVShow2iTunes->main();
$Subtitles->logout($TVShow2iTunes);
}
# #input is a folder
elsif(-d $input){
opendir ( DIR, $input ) || die "Error in opening dir $input\n";
my @dir=readdir(DIR);
print "LOG :: Reading the folder $input\n";
my $loginc_cont=0;
foreach my $filename (@dir){
if($filename !~ /^\./){
$loginc_cont++;
$TVShow2iTunes=Contents::Main::TVs2iT->new(
input=> $input."/". $filename,
lang=>@lang,
transcode=>$transcode
);
$Subtitles=Contents::Main::GetSubtitles->new($TVShow2iTunes);
$Subtitles->login($TVShow2iTunes);
$TVShow2iTunes->main();
$Subtitles->logout($TVShow2iTunes);
}
}
close DIR;
}
else{
Contents::Main::Help->help();
}
}elsif($help){
Contents::Main::Help->help();
}elsif($help_lang){
Contents::Main::Help->help_lang();
}
else{
Contents::Main::Help->help();
}