| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package MHFS::FS v0.7.0; |
|
2
|
1
|
|
|
1
|
|
19
|
use 5.014; |
|
|
1
|
|
|
|
|
4
|
|
|
3
|
1
|
|
|
1
|
|
30
|
use strict; use warnings; |
|
|
1
|
|
|
1
|
|
3
|
|
|
|
1
|
|
|
|
|
31
|
|
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
59
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use feature 'say'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
126
|
|
|
5
|
1
|
|
|
1
|
|
8
|
use Cwd qw(abs_path); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
93
|
|
|
6
|
1
|
|
|
1
|
|
8
|
use File::Basename qw(fileparse); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
631
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub lookup { |
|
9
|
0
|
|
|
0
|
0
|
|
my ($self, $name, $sid) = @_; |
|
10
|
|
|
|
|
|
|
|
|
11
|
0
|
0
|
|
|
|
|
if(! exists $self->{'sources'}{$sid}) { |
|
12
|
0
|
|
|
|
|
|
return undef; |
|
13
|
|
|
|
|
|
|
} |
|
14
|
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
my $src = $self->{'sources'}{$sid}; |
|
16
|
0
|
0
|
|
|
|
|
if($src->{'type'} ne 'local') { |
|
17
|
0
|
|
|
|
|
|
say "unhandled src type ". $src->{'type'}; |
|
18
|
0
|
|
|
|
|
|
return undef; |
|
19
|
|
|
|
|
|
|
} |
|
20
|
0
|
|
|
|
|
|
my $location = $src->{'folder'}; |
|
21
|
0
|
|
|
|
|
|
my $absolute = abs_path($location.'/'.$name); |
|
22
|
0
|
0
|
|
|
|
|
return undef if( ! $absolute); |
|
23
|
0
|
0
|
|
|
|
|
return undef if ($absolute !~ /^$location/); |
|
24
|
0
|
|
|
|
|
|
return _media_filepath_to_src_file($absolute, $location); |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _media_filepath_to_src_file { |
|
28
|
0
|
|
|
0
|
|
|
my ($filepath, $flocation) = @_; |
|
29
|
0
|
|
|
|
|
|
my ($name, $loc, $ext) = fileparse($filepath, '\.[^\.]*'); |
|
30
|
0
|
|
|
|
|
|
$ext =~ s/^\.//; |
|
31
|
0
|
|
|
|
|
|
return { 'filepath' => $filepath, 'name' => $name, 'containingdir' => $loc, 'ext' => $ext, 'fullname' => substr($filepath, length($flocation)+1), 'root' => $flocation}; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub new { |
|
35
|
0
|
|
|
0
|
0
|
|
my ($class, $sources) = @_; |
|
36
|
0
|
|
|
|
|
|
my %self = ('sources' => $sources); |
|
37
|
0
|
|
|
|
|
|
bless \%self, $class; |
|
38
|
0
|
|
|
|
|
|
return \%self; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |