line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::Media::Sort; |
2
|
2
|
|
|
2
|
|
129211
|
use strict; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
60
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
BEGIN { |
5
|
2
|
|
|
2
|
|
8
|
use Exporter; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
75
|
|
6
|
2
|
|
|
2
|
|
10
|
use vars qw($VERSION @ISA @EXPORT_OK); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
158
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
7
|
$VERSION = '0.068'; |
9
|
2
|
|
|
|
|
32
|
@ISA = qw(Exporter); |
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
|
|
287
|
@EXPORT_OK = qw( |
12
|
|
|
|
|
|
|
media_sort |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my %media_re = ( |
17
|
|
|
|
|
|
|
tv => { |
18
|
|
|
|
|
|
|
regex => '(?i)([S0-9]+)?([E0-9]+)(.*TV)', |
19
|
|
|
|
|
|
|
# location => \@episodes, |
20
|
|
|
|
|
|
|
}, |
21
|
|
|
|
|
|
|
mvid => { |
22
|
|
|
|
|
|
|
regex => '.*([_-]+)x264-[0-9]{4}', |
23
|
|
|
|
|
|
|
# location => \@mvids, |
24
|
|
|
|
|
|
|
}, |
25
|
|
|
|
|
|
|
music => { |
26
|
|
|
|
|
|
|
regex => '.+(?:-|_-_)\w+-(?:[0-9]+CD?-)?(?:[0-9]{4}-)?(?:\w+)?', |
27
|
|
|
|
|
|
|
# location => \@music, |
28
|
|
|
|
|
|
|
}, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub media_sort { |
33
|
3
|
|
|
3
|
1
|
74
|
my $type = shift; |
34
|
3
|
50
|
|
|
|
10
|
die "Type not supported\n" unless exists($media_re{$type}); |
35
|
3
|
|
|
|
|
7
|
my @files = @_; |
36
|
|
|
|
|
|
|
|
37
|
3
|
|
|
|
|
4
|
my @results; |
38
|
3
|
|
|
|
|
5
|
for my $file(@files) { |
39
|
3
|
50
|
|
|
|
91
|
if($file =~ m/$media_re{$type}->{regex}/) { |
40
|
3
|
|
|
|
|
11
|
push(@results, $file); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
3
|
|
|
|
|
19
|
return @results; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |