| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Filename::Type::Audio; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
337472
|
use 5.010001; |
|
|
1
|
|
|
|
|
4
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
127
|
|
|
5
|
1
|
|
|
1
|
|
14
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
115
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
7
|
use Exporter qw(import); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
334
|
|
|
8
|
|
|
|
|
|
|
our @EXPORT_OK = qw(check_audio_filename); |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
|
11
|
|
|
|
|
|
|
our $DATE = '2024-12-20'; # DATE |
|
12
|
|
|
|
|
|
|
our $DIST = 'Filename-Type-Audio'; # DIST |
|
13
|
|
|
|
|
|
|
our $VERSION = '0.005'; # VERSION |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# sorted by length then asciibetical |
|
16
|
|
|
|
|
|
|
our $STR_RE = "mpega|aifc|aiff|flac|midi|mpga|opus|aif|amr|awb|axa|csd|gsm|kar|m3u|m4a|mid|mp2|mp3|oga|ogg|orc|pls|ram|sco|sd2|sid|snd|spx|wav|wax|wma|au|ra|rm"; # STR_RE |
|
17
|
|
|
|
|
|
|
our $RE = qr(\.(?:$STR_RE)\z)i; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our %SPEC; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
$SPEC{check_audio_filename} = { |
|
22
|
|
|
|
|
|
|
v => 1.1, |
|
23
|
|
|
|
|
|
|
summary => 'Check whether filename indicates being an audio file', |
|
24
|
|
|
|
|
|
|
description => <<'MARKDOWN', |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
MARKDOWN |
|
28
|
|
|
|
|
|
|
args => { |
|
29
|
|
|
|
|
|
|
filename => { |
|
30
|
|
|
|
|
|
|
schema => 'filename*', |
|
31
|
|
|
|
|
|
|
req => 1, |
|
32
|
|
|
|
|
|
|
pos => 0, |
|
33
|
|
|
|
|
|
|
}, |
|
34
|
|
|
|
|
|
|
# XXX recurse? |
|
35
|
|
|
|
|
|
|
#ci => { |
|
36
|
|
|
|
|
|
|
# summary => 'Whether to match case-insensitively', |
|
37
|
|
|
|
|
|
|
# schema => 'bool', |
|
38
|
|
|
|
|
|
|
# default => 1, |
|
39
|
|
|
|
|
|
|
#}, |
|
40
|
|
|
|
|
|
|
}, |
|
41
|
|
|
|
|
|
|
result_naked => 1, |
|
42
|
|
|
|
|
|
|
result => { |
|
43
|
|
|
|
|
|
|
schema => ['any*', of=>['bool*', 'hash*']], |
|
44
|
|
|
|
|
|
|
description => <<'MARKDOWN', |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Return false if no archive suffixes detected. Otherwise return a hash of |
|
47
|
|
|
|
|
|
|
information. |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
MARKDOWN |
|
50
|
|
|
|
|
|
|
}, |
|
51
|
|
|
|
|
|
|
examples => [ |
|
52
|
|
|
|
|
|
|
{ |
|
53
|
|
|
|
|
|
|
args => {filename => 'foo.txt'}, |
|
54
|
|
|
|
|
|
|
naked_result => 0, |
|
55
|
|
|
|
|
|
|
}, |
|
56
|
|
|
|
|
|
|
{ |
|
57
|
|
|
|
|
|
|
args => {filename => 'foo.mp4'}, |
|
58
|
|
|
|
|
|
|
naked_result => 0, |
|
59
|
|
|
|
|
|
|
}, |
|
60
|
|
|
|
|
|
|
{ |
|
61
|
|
|
|
|
|
|
args => {filename => 'foo.wav'}, |
|
62
|
|
|
|
|
|
|
naked_result => {}, |
|
63
|
|
|
|
|
|
|
}, |
|
64
|
|
|
|
|
|
|
{ |
|
65
|
|
|
|
|
|
|
args => {filename => 'foo.MP3'}, |
|
66
|
|
|
|
|
|
|
naked_result => {}, |
|
67
|
|
|
|
|
|
|
}, |
|
68
|
|
|
|
|
|
|
], |
|
69
|
|
|
|
|
|
|
}; |
|
70
|
|
|
|
|
|
|
sub check_audio_filename { |
|
71
|
0
|
|
|
0
|
1
|
|
my %args = @_; |
|
72
|
|
|
|
|
|
|
|
|
73
|
0
|
0
|
|
|
|
|
$args{filename} =~ $RE ? {} : 0; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |
|
77
|
|
|
|
|
|
|
# ABSTRACT: Check whether filename indicates being an audio file |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |