MP4Meta/MusicVideo.pm

filter: Statementstmt 55.2% 21 / 38 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 66.6% 6 / 9 Podpod 100% 2 / 2 totaltotal 50.0% 29 / 58 CC 4 SCAR 15.4
CC
4
Cov
47%
apply_meta
12.0
_parse_filename
6.0
new
2.0
CRAP 4.7
« MP4Meta/Source/Data/Base.pm ↑ Summary MP4Meta/Source/OMDB.pm »
1 2 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package App::MP4Meta::MusicVideo;
6 {
7 2 $App::MP4Meta::MusicVideo::VERSION = '1.153340';
8 }
9  
10 # ABSTRACT: Add metadata to a music video
11  
12 2 ▶use App::MP4Meta::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 our @ISA = 'App::MP4Meta::Base';
14  
15 2 ▶use File::Spec '3.33';
Subroutine BEGIN: called CC=1 SCAR=0.0
16 2 ▶use AtomicParsley::Command::Tags;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
19 0 my $class = shift;
20 0 my $args = shift;
21  
22 0 my $self = $class->SUPER::new($args);
23  
24 0 $self->{'media_type'} = 'Music Video';
25  
26 0 return $self;
27 }
28  
29 0 ▶sub apply_meta {
Subroutine apply_meta: not called CC=3 SCAR=24.8
Pod documented
30 0 my ( $self, $path ) = @_;
31  
32 # get the file name
33 0 my ( $volume, $directories, $file ) = File::Spec->splitpath($path);
34  
35 # parse the filename for the film title and optional year
36 0 my ( $artist, $title ) = $self->_parse_filename($file);
37  
38 # TODO: check we have a title and artist
39  
40 my $tags = AtomicParsley::Command::Tags->new(
41 artist => $artist,
42 albumArtist => $artist,
43 title => $self->{'title'} // $title,
44 stik => $self->{'media_type'},
45 genre => $self->{'genre'},
46 0 ▶ artwork => $self->{'coverfile'}
Condition0%0/3
$self->{"title"} // $title
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"title"} // $title
$self->{"title"} $title
Truth table0%0/3
A // B
A= $self->{"title"}B= $title
ABresult
1X1
011
000
47 );
48  
49 0 my $error = $self->_write_tags( $path, $tags );
50 0 ▶ return $error if $error;
Branch: 1 branch
BranchTrueFalseTotal
if $error 0 0 0
51  
52 0 return $self->_add_to_itunes( File::Spec->rel2abs($path) );
53 }
54  
55 # Parse the filename and returns the videos artist and title.
56 0 ▶sub _parse_filename {
Subroutine _parse_filename: not called CC=2 SCAR=17.9
57 0 my ( $self, $file ) = @_;
58  
59 # strip suffix
60 0 $file = $self->_strip_suffix($file);
61  
62 0 ▶ if ( $file =~ /^(.*) - (.*)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($file =~ /^(.*) - (.*)$/) 0 0 0
63 0 return ( $self->_clean_title($1), $self->_clean_title($2) );
64 }
65  
66 0 return;
67 }
68  
69 2 1;
70  
71 __END__
« MP4Meta/Source/Data/Base.pm ↑ Summary MP4Meta/Source/OMDB.pm »