line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::Media::Sort; |
2
|
2
|
|
|
2
|
|
119279
|
use strict; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
59
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
BEGIN { |
5
|
2
|
|
|
2
|
|
8
|
use Exporter; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
63
|
|
6
|
2
|
|
|
2
|
|
8
|
use vars qw($VERSION @ISA @EXPORT_OK); |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
156
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
13
|
$VERSION = '0.066'; |
9
|
2
|
|
|
|
|
25
|
@ISA = qw(Exporter); |
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
|
|
304
|
@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
|
69
|
my $type = shift; |
34
|
3
|
50
|
|
|
|
10
|
die "Type not supported\n" unless exists($media_re{$type}); |
35
|
3
|
|
|
|
|
4
|
my @files = @_; |
36
|
|
|
|
|
|
|
|
37
|
3
|
|
|
|
|
5
|
my @results; |
38
|
3
|
|
|
|
|
6
|
for my $file(@files) { |
39
|
3
|
50
|
|
|
|
87
|
if($file =~ m/$media_re{$type}->{regex}/) { |
40
|
3
|
|
|
|
|
8
|
push(@results, $file); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
3
|
|
|
|
|
15
|
return @results; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |