| 1 | package Music::Tag::MP3; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use strict; use warnings; use utf8; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | our $VERSION = '0.4101'; | |||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | # Copyright © 2007,2010 Edward Allen III. Some rights reserved. | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # You may distribute under the terms of either the GNU General Public | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # License or the Artistic License, as specified in the README file. | ||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use MP3::Tag; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use MP3::Info; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use base qw(Music::Tag::Generic); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | ▶ | sub default_options { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_options: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | { apic_cover => 1, }; | |||||||||||||||||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | sub _decode_uni { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_decode_uni: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | my $in = shift; | |||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | my $c = unpack( "U", substr( $in, 0, 1 ) ); | |||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | if ( ($c) && ( $c == 255 ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$c and $c == 255
MC/DC0%0/2
$c and $c == 255
$c
$c == 255
Truth table0%0/3
A and B
A= $cB= $c == 255
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | $in = decode( "UTF-16LE", $in ); | |||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | #$in =~ s/^[^A-Za-z0-9]*//; | ||||||||||||||||||||||||||||||||||||||||||
| 25 | #$in =~ s/ \/ //g; | ||||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | return $in; | |||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 122 | ▶ | sub mp3 { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mp3: called CC=4 SCAR=14.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 122 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 32 | 122 | ▶ | unless ( ( exists $self->{'_mp3'} ) && ( ref $self->{'_mp3'} ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $self->{"_mp3"} and ref $self->{"_mp3"}
MC/DC50%1/2
exists $self->{"_mp3"} and ref $self->{"_mp3"}
exists $self->{"_mp3"}
ref $self->{"_mp3"}
Truth table66%2/3
A and B
A= exists $self->{"_mp3"}B= ref $self->{"_mp3"}
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 2 | ▶ | if ( $self->info->get_data('filename') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 2 | $self->{'_mp3'} = MP3::Tag->new( $self->info->get_data('filename') ); | |||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||
| 36 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||
| 40 | 122 | return $self->{'_mp3'}; | |||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | 3 | ▶ | sub _auto_methods_map { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_auto_methods_map: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | return { | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 3 | bitrate => { | |||||||||||||||||||||||||||||||||||||||||
| 46 | method => 'bitrate_kbps', | ||||||||||||||||||||||||||||||||||||||||||
| 47 | decode_uni => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 48 | inspect => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 49 | readonly => 1 | ||||||||||||||||||||||||||||||||||||||||||
| 50 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 51 | duration => { | ||||||||||||||||||||||||||||||||||||||||||
| 52 | method => 'total_millisecs_int', | ||||||||||||||||||||||||||||||||||||||||||
| 53 | decode_uni => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 54 | inspect => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 55 | readonly => 1 | ||||||||||||||||||||||||||||||||||||||||||
| 56 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 57 | frequency => { | ||||||||||||||||||||||||||||||||||||||||||
| 58 | method => 'frequency_Hz', | ||||||||||||||||||||||||||||||||||||||||||
| 59 | decode_uni => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 60 | inspect => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 61 | readonly => 1 | ||||||||||||||||||||||||||||||||||||||||||
| 62 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 63 | stereo => { | ||||||||||||||||||||||||||||||||||||||||||
| 64 | method => 'is_stereo', | ||||||||||||||||||||||||||||||||||||||||||
| 65 | decode_uni => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 66 | inspect => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 67 | readonly => 1 | ||||||||||||||||||||||||||||||||||||||||||
| 68 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 69 | bytes => { | ||||||||||||||||||||||||||||||||||||||||||
| 70 | method => 'size_bytes', | ||||||||||||||||||||||||||||||||||||||||||
| 71 | decode_uni => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 72 | inspect => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 73 | readonly => 1 | ||||||||||||||||||||||||||||||||||||||||||
| 74 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 75 | frames => { | ||||||||||||||||||||||||||||||||||||||||||
| 76 | method => 'frames', | ||||||||||||||||||||||||||||||||||||||||||
| 77 | decode_uni => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 78 | inspect => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 79 | readonly => 1 | ||||||||||||||||||||||||||||||||||||||||||
| 80 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 81 | 'framesize' => { | ||||||||||||||||||||||||||||||||||||||||||
| 82 | method => 'frame_len', | ||||||||||||||||||||||||||||||||||||||||||
| 83 | decode_uni => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 84 | inspect => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 85 | readonly => 1 | ||||||||||||||||||||||||||||||||||||||||||
| 86 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 87 | vbr => { | ||||||||||||||||||||||||||||||||||||||||||
| 88 | method => 'is_vbr', | ||||||||||||||||||||||||||||||||||||||||||
| 89 | decode_uni => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 90 | inspect => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 91 | readonly => 1 | ||||||||||||||||||||||||||||||||||||||||||
| 92 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 93 | title => { method => 'title', decode_uni => 1, inspect => 1 }, | ||||||||||||||||||||||||||||||||||||||||||
| 94 | artist => { method => 'artist', decode_uni => 1, inspect => 1 }, | ||||||||||||||||||||||||||||||||||||||||||
| 95 | album => { method => 'album', decode_uni => 1, inspect => 1 }, | ||||||||||||||||||||||||||||||||||||||||||
| 96 | comment => { method => 'comment', decode_uni => 1, inspect => 1 }, | ||||||||||||||||||||||||||||||||||||||||||
| 97 | year => { method => 'year', decode_uni => 1, inspect => 1 }, | ||||||||||||||||||||||||||||||||||||||||||
| 98 | genre => { method => 'genre', decode_uni => 1, inspect => 1 }, | ||||||||||||||||||||||||||||||||||||||||||
| 99 | tracknum => { method => 'track', decode_uni => 0, inspect => 0 }, | ||||||||||||||||||||||||||||||||||||||||||
| 100 | composer => { | ||||||||||||||||||||||||||||||||||||||||||
| 101 | method => 'composer', | ||||||||||||||||||||||||||||||||||||||||||
| 102 | decode_uni => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 103 | inspect => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 104 | readonly => 1 | ||||||||||||||||||||||||||||||||||||||||||
| 105 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 106 | performer => { | ||||||||||||||||||||||||||||||||||||||||||
| 107 | method => 'performer', | ||||||||||||||||||||||||||||||||||||||||||
| 108 | decode_uni => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 109 | inspect => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 110 | readonly => 1 | ||||||||||||||||||||||||||||||||||||||||||
| 111 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 112 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | 3 | ▶ | sub _id3v2_frame_map { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_id3v2_frame_map: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | return { | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 3 | discnum => [ { frame => 'TPOS', description => '' } ], | |||||||||||||||||||||||||||||||||||||||||
| 118 | label => [ { frame => 'TPUB', description => '' } ], | ||||||||||||||||||||||||||||||||||||||||||
| 119 | sortname => [ | ||||||||||||||||||||||||||||||||||||||||||
| 120 | { frame => 'XSOP', description => '' }, | ||||||||||||||||||||||||||||||||||||||||||
| 121 | { frame => 'TPE1', description => '' } | ||||||||||||||||||||||||||||||||||||||||||
| 122 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 123 | mb_trackid => [ | ||||||||||||||||||||||||||||||||||||||||||
| 124 | { frame => 'TXXX', description => 'MusicBrainz Track Id' }, | ||||||||||||||||||||||||||||||||||||||||||
| 125 | { frame => 'UFID', field => '_Data', description => '' } | ||||||||||||||||||||||||||||||||||||||||||
| 126 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 127 | asin => [ { frame => 'TXXX', description => 'ASIN' } ], | ||||||||||||||||||||||||||||||||||||||||||
| 128 | sortname => [ { frame => 'TXXX', description => 'Sortname' } ], | ||||||||||||||||||||||||||||||||||||||||||
| 129 | albumartist_sortname => [ | ||||||||||||||||||||||||||||||||||||||||||
| 130 | { frame => 'TXXX', | ||||||||||||||||||||||||||||||||||||||||||
| 131 | description => 'MusicBrainz Album Artist Sortname' | ||||||||||||||||||||||||||||||||||||||||||
| 132 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 133 | { frame => 'TXXX', description => 'ALBUMARTISTSORT' } | ||||||||||||||||||||||||||||||||||||||||||
| 134 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 135 | albumartist => [ | ||||||||||||||||||||||||||||||||||||||||||
| 136 | { frame => 'TXXX', description => 'MusicBrainz Album Artist' } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 138 | countrycode => [ | ||||||||||||||||||||||||||||||||||||||||||
| 139 | { frame => 'TXXX', | ||||||||||||||||||||||||||||||||||||||||||
| 140 | description => 'MusicBrainz Album Release Country' | ||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||
| 142 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 143 | mb_artistid => | ||||||||||||||||||||||||||||||||||||||||||
| 144 | [ { frame => 'TXXX', description => 'MusicBrainz Artist Id' } ], | ||||||||||||||||||||||||||||||||||||||||||
| 145 | mb_albumid => | ||||||||||||||||||||||||||||||||||||||||||
| 146 | [ { frame => 'TXXX', description => 'MusicBrainz Album Id' } ], | ||||||||||||||||||||||||||||||||||||||||||
| 147 | album_type => [ | ||||||||||||||||||||||||||||||||||||||||||
| 148 | { frame => 'TXXX', description => 'MusicBrainz Album Status' } | ||||||||||||||||||||||||||||||||||||||||||
| 149 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 150 | artist_type => | ||||||||||||||||||||||||||||||||||||||||||
| 151 | [ { frame => 'TXXX', description => 'MusicBrainz Artist Type' } ], | ||||||||||||||||||||||||||||||||||||||||||
| 152 | mip_puid => [ { frame => 'TXXX', description => 'MusicIP PUID' } ], | ||||||||||||||||||||||||||||||||||||||||||
| 153 | artist_start => | ||||||||||||||||||||||||||||||||||||||||||
| 154 | [ { frame => 'TXXX', description => 'Artist Begins' } ], | ||||||||||||||||||||||||||||||||||||||||||
| 155 | artist_end => [ { frame => 'TXXX', description => 'Artist Ends' } ], | ||||||||||||||||||||||||||||||||||||||||||
| 156 | ean => [ { frame => 'TXXX', description => 'EAN/UPC' } ], | ||||||||||||||||||||||||||||||||||||||||||
| 157 | mip_puid => [ { frame => 'TXXX', description => 'MusicMagic Data' } ], | ||||||||||||||||||||||||||||||||||||||||||
| 158 | mip_fingerprint => | ||||||||||||||||||||||||||||||||||||||||||
| 159 | [ { frame => 'TXXX', description => 'MusicMagic Fingerprint' } ], | ||||||||||||||||||||||||||||||||||||||||||
| 160 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | sub set_values { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_values: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 165 | return ( | ||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | keys %{ $self->_auto_methods_map }, | |||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | keys %{ $self->_id3v2_frame_map }, | |||||||||||||||||||||||||||||||||||||||||
| 168 | 'picture', 'lyrics', 'encoder', 'label' | ||||||||||||||||||||||||||||||||||||||||||
| 169 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | sub saved_values { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
saved_values: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 174 | return ( | ||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | keys %{ $self->_auto_methods_map }, | |||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | keys %{ $self->_id3v2_frame_map }, | |||||||||||||||||||||||||||||||||||||||||
| 177 | 'picture', 'lyrics', 'encoder', 'label' | ||||||||||||||||||||||||||||||||||||||||||
| 178 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | 2 | ▶ | sub get_tag { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_tag: called CC=27 SCAR=36.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 183 | 2 | ▶ | return unless ( $self->mp3 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | 2 | $self->mp3->config( id3v2_mergepadding => 0 ); | |||||||||||||||||||||||||||||||||||||||||
| 185 | 2 | $self->mp3->config( autoinfo => "ID3v2", "ID3v1" ); | |||||||||||||||||||||||||||||||||||||||||
| 186 | 2 | ▶ | return unless $self->mp3; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 2 | $self->info->datamethods('filetype'); | |||||||||||||||||||||||||||||||||||||||||
| 189 | 2 | $self->info->datamethods('mip_fingerprint'); | |||||||||||||||||||||||||||||||||||||||||
| 190 | 2 | $self->info->set_data('filetype','mp3'); | |||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | 2 | $self->mp3->get_tags; | |||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | 2 | my $mt_to_mp3 = $self->_auto_methods_map(); | |||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | 2 | ▶ | while ( my ( $mt, $mp3 ) = each %{$mt_to_mp3} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | 34 | my $method = $mp3->{method}; | |||||||||||||||||||||||||||||||||||||||||
| 198 | 34 | $self->info->set_data($mt, $self->mp3->$method ); | |||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||
| 200 | 2 | my $frame_map = $self->_id3v2_frame_map(); | |||||||||||||||||||||||||||||||||||||||||
| 201 | 2 | ▶ | if ( exists $self->mp3->{ID3v2} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | 2 | ▶ | while ( my ( $mt, $mp3d ) = each %{$frame_map} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 203 | 34 | foreach my $mp3 ( @{$mp3d} ) { | |||||||||||||||||||||||||||||||||||||||||
| 204 | my $t = | ||||||||||||||||||||||||||||||||||||||||||
| 205 | $self->mp3->{ID3v2} | ||||||||||||||||||||||||||||||||||||||||||
| 206 | ->frame_select( $mp3->{frame}, $mp3->{description}, | ||||||||||||||||||||||||||||||||||||||||||
| 207 | 35 | [''] ); | |||||||||||||||||||||||||||||||||||||||||
| 208 | 35 | ▶ | if ( ( ref $t ) && ( exists $mp3->{field} ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
ref $t and exists $mp3->{"field"}
MC/DC0%0/2
ref $t and exists $mp3->{"field"}
ref $t
exists $mp3->{"field"}
Truth table33%1/3
A and B
A= ref $tB= exists $mp3->{"field"}
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | $self->info->set_data($mt,$t->{ $mp3->{field} } ); | |||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||
| 212 | elsif ($t) { | ||||||||||||||||||||||||||||||||||||||||||
| 213 | 13 | $self->info->set_data($mt,$t); | |||||||||||||||||||||||||||||||||||||||||
| 214 | 13 | last; | |||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | 2 | ▶ | my $day = $self->mp3->{ID3v2}->get_frame('TDAT') || ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->mp3->{'ID3v2'}->get_frame('TDAT') || ''
MC/DC100%1/1
$self->mp3->{'ID3v2'}->get_frame('TDAT') || ''
$self->mp3->{'ID3v2'}->get_frame('TDAT')
Truth table100%2/2
A
A= $self->mp3->{'ID3v2'}->get_frame('TDAT')
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | 2 | ▶ | if ( ( $day =~ /(\d\d)(\d\d)/ ) && ( $self->mp3->year ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$day =~ /(\d\d)(\d\d)/ and $self->mp3->year
MC/DC50%1/2
$day =~ /(\d\d)(\d\d)/ and $self->mp3->year
$day =~ /(\d\d)(\d\d)/
$self->mp3->year
Truth table66%2/3
A and B
A= $day =~ /(\d\d)(\d\d)/B= $self->mp3->year
| |||||||||||||||||||||||||||||||||||||||||||
| 221 | 1 | my $releasedate = $self->mp3->year . "-" . $1 . "-" . $2; | |||||||||||||||||||||||||||||||||||||||||
| 222 | 1 | ▶ | my $time = $self->mp3->{ID3v2}->get_frame('TIME') || ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->mp3->{'ID3v2'}->get_frame('TIME') || ''
MC/DC0%0/1
$self->mp3->{'ID3v2'}->get_frame('TIME') || ''
$self->mp3->{'ID3v2'}->get_frame('TIME')
Truth table50%1/2
A
A= $self->mp3->{'ID3v2'}->get_frame('TIME')
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | 1 | ▶ | if ( $time =~ /(\d\d)(\d\d)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | 1 | $releasedate .= " " . $1 . ":" . $2; | |||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||
| 226 | 1 | print STDERR "Reading releasedate of $releasedate\n"; | |||||||||||||||||||||||||||||||||||||||||
| 227 | 1 | $self->info->set_data('releasetime',$releasedate); | |||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | 2 | my $lyrics = $self->mp3->{ID3v2}->get_frame('USLT'); | |||||||||||||||||||||||||||||||||||||||||
| 231 | 2 | ▶ | if ( ref $lyrics ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 232 | 2 | $self->info->set_data('lyrics', $lyrics->{Text} ); | |||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||
| 234 | 2 | ▶ | if ( $self->mp3->{ID3v2}->get_frame('TENC') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 1 | $self->info->set_data('encoded_by', $self->mp3->{ID3v2}->get_frame('TENC') ); | |||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | 2 | ▶ | if ( ref $self->mp3->{ID3v2}->get_frame('USER') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | if ( $self->mp3->{ID3v2}->get_frame('USER')->{Language} eq "Cop" ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | { | ||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | $self->status("Emusic mistagged file found"); | |||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | $self->info->set_data('encoded_by','emusic'); | |||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | 2 | ▶ | if (( not $self->options->{ignore_apic} ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
not $self->options->{"ignore_apic"} and $self->mp3->{"ID3v2"}->frame_select("APIC", "", "Cover (front)") and not $self->info->has_data("picture")
not $self->options->{"ignore_apic"} and $self->mp3->{"ID3v2"}->frame_select("APIC", "", "Cover (front)")
MC/DC33%1/3
not $self->options->{"ignore_apic"} and $self->mp3->{"ID3v2"}->frame_select("APIC", "", "Cover (front)") and not $self->info->has_data("picture")
not $self->options->{"ignore_apic"}
$self->mp3->{"ID3v2"}->frame_select("APIC", "", "Cover (front)")
not $self->info->has_data("picture")
Truth table50%2/4
not(A) and B and not(C)
A= not $self->options->{"ignore_apic"}B= $self->mp3->{"ID3v2"}->frame_select("APIC", "", "Cover (front)")C= not $self->info->has_data("picture")
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | && ( $self->mp3->{ID3v2} | ||||||||||||||||||||||||||||||||||||||||||
| 248 | ->frame_select( 'APIC', '', 'Cover (front)' ) ) | ||||||||||||||||||||||||||||||||||||||||||
| 249 | && ( not $self->info->has_data('picture') ) | ||||||||||||||||||||||||||||||||||||||||||
| 250 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 251 | $self->info->picture( | ||||||||||||||||||||||||||||||||||||||||||
| 252 | 1 | $self->mp3->{ID3v2}->get_frame( 'APIC', '', 'Cover (front)' ) | |||||||||||||||||||||||||||||||||||||||||
| 253 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | 2 | ▶ | if ( $self->info->get_data('comment') =~ /^Amazon.com/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | $self->info->set_data('encoded_by','Amazon.com'); | |||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||
| 259 | 2 | ▶ | if ( $self->info->get_data('comment') =~ /^cdbaby.com/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | $self->info->set_data('encoded_by','cdbaby.com'); | |||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||
| 265 | 2 | $self->{mp3info} = MP3::Info::get_mp3info( $self->info->get_data('filename') ); | |||||||||||||||||||||||||||||||||||||||||
| 266 | 2 | ▶ | if ( $self->{mp3info}->{LAME} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | 2 | $self->info->set_data('pregap', $self->{mp3info}->{LAME}->{start_delay} ); | |||||||||||||||||||||||||||||||||||||||||
| 268 | 2 | $self->info->set_data('postgap', $self->{mp3info}->{LAME}->{end_padding} ); | |||||||||||||||||||||||||||||||||||||||||
| 269 | 2 | ▶ | if ( $self->{mp3info}->{LAME}->{encoder_version} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | $self->info->set_data('encoder', | ||||||||||||||||||||||||||||||||||||||||||
| 271 | 2 | $self->{mp3info}->{LAME}->{encoder_version} ); | |||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||
| 275 | 2 | ▶ | if ( $self->mp3->mpeg_version() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | 2 | $self->info->set_data('codec', "MPEG Version " | |||||||||||||||||||||||||||||||||||||||||
| 277 | . $self->mp3->mpeg_version() | ||||||||||||||||||||||||||||||||||||||||||
| 278 | . " Layer " | ||||||||||||||||||||||||||||||||||||||||||
| 279 | . $self->mp3->mpeg_layer() ); | ||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | 2 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | sub calculate_gapless { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
calculate_gapless: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | my $file = shift; | |||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | my $gap = {}; | |||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | require MP3::Info; | |||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | require Math::Int64; | |||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | $MP3::Info::get_framelengths = 1; | |||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | my $info = MP3::Info::get_mp3info($file); | |||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | ▶ | if ( ($info) && ( $info->{LAME}->{end_padding} ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$info and $info->{"LAME"}{"end_padding"}
MC/DC0%0/2
$info and $info->{"LAME"}{"end_padding"}
$info
$info->{"LAME"}{"end_padding"}
Truth table0%0/3
A and B
A= $infoB= $info->{"LAME"}{"end_padding"}
| |||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | $gap->{gaplesstrackflag} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | $gap->{pregap} = $info->{LAME}->{start_delay}; | |||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | $gap->{postgap} = $info->{LAME}->{end_padding}; | |||||||||||||||||||||||||||||||||||||||||
| 297 | $gap->{samplecount} = | ||||||||||||||||||||||||||||||||||||||||||
| 298 | $info->{FRAME_SIZE} * scalar( $info->{FRAME_LENGTHS} ) | ||||||||||||||||||||||||||||||||||||||||||
| 299 | - $gap->{pregap} | ||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | - $gap->{postgap}; | |||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | my $finaleight = 0; | |||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | ▶ | for ( my $n = 1; $n <= 8; $n++ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | $finaleight += $info->{FRAME_LENGTHS}->[ -1 * $n ]; | |||||||||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||||||||
| 305 | $gap->{gaplessdata} = | ||||||||||||||||||||||||||||||||||||||||||
| 306 | Math::Int64::uint64( $info->{SIZE} ) | ||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | - Math::Int64::uint64($finaleight); | |||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | return $gap; | |||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | ▶ | sub strip_tag { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
strip_tag: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | $self->status("Stripping current tags"); | |||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | ▶ | if ( exists $self->mp3->{ID3v2} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | $self->mp3->{ID3v2}->remove_tag; | |||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | $self->mp3->{ID3v2}->write_tag; | |||||||||||||||||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | ▶ | if ( exists $self->mp3->{ID3v1} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | $self->mp3->{ID3v1}->remove_tag; | |||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | 1 | ▶ | sub set_tag { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_tag: called CC=24 SCAR=35.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 326 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 327 | 1 | my $filename = $self->info->get_data('filename'); | |||||||||||||||||||||||||||||||||||||||||
| 328 | 1 | $self->status("Updating MP3"); | |||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | 1 | my $mt_to_mp3 = $self->_auto_methods_map(); | |||||||||||||||||||||||||||||||||||||||||
| 331 | 1 | ▶ | while ( my ( $mt, $mp3 ) = each %{$mt_to_mp3} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | 17 | my $method = $mp3->{method} . '_set'; | |||||||||||||||||||||||||||||||||||||||||
| 333 | 17 | ▶ | next if ( ( exists $mp3->{readonly} ) && ( $mp3->{readonly} ) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $mp3->{"readonly"} and $mp3->{"readonly"}
MC/DC50%1/2
exists $mp3->{"readonly"} and $mp3->{"readonly"}
exists $mp3->{"readonly"}
$mp3->{"readonly"}
Truth table66%2/3
A and B
A= exists $mp3->{"readonly"}B= $mp3->{"readonly"}
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | 7 | $self->mp3->$method( $self->info->get_data($mt), 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | 1 | my $id3v1; | |||||||||||||||||||||||||||||||||||||||||
| 338 | my $id3v2; | ||||||||||||||||||||||||||||||||||||||||||
| 339 | 1 | ▶ | if ( $self->mp3->{ID3v2} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | 1 | $id3v2 = $self->mp3->{ID3v2}; | |||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||
| 342 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | $id3v2 = $self->mp3->new_tag("ID3v2"); | |||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||
| 345 | 1 | ▶ | if ( $self->mp3->{ID3v1} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 346 | 1 | $id3v1 = $self->mp3->{ID3v1}; | |||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||
| 348 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | $id3v1 = $self->mp3->new_tag("ID3v1"); | |||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | 1 | $self->status("Writing ID3v2 Tag"); | |||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||
| 354 | 1 | my $frame_map = $self->_id3v2_frame_map(); | |||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | 1 | ▶ | while ( my ( $mt, $mp3d ) = each %{$frame_map} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 357 | 17 | my $mp3 = $mp3d->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 358 | 17 | ▶ | next if ( ( exists $mp3->{readonly} ) && ( $mp3->{readonly} ) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $mp3->{"readonly"} and $mp3->{"readonly"}
MC/DC0%0/2
exists $mp3->{"readonly"} and $mp3->{"readonly"}
exists $mp3->{"readonly"}
$mp3->{"readonly"}
Truth table33%1/3
A and B
A= exists $mp3->{"readonly"}B= $mp3->{"readonly"}
| |||||||||||||||||||||||||||||||||||||||||||
| 359 | 17 | ▶ | if ( $self->info->has_data($mt) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 360 | 11 | my $val = $self->info->get_data($mt); | |||||||||||||||||||||||||||||||||||||||||
| 361 | 11 | ▶ | if ( ( not ref $val ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not ref $val and exists $mp3->{"field"} and $mp3->{"field"}
not ref $val and exists $mp3->{"field"}
MC/DC0%0/3
not ref $val and exists $mp3->{"field"} and $mp3->{"field"}
not ref $val
exists $mp3->{"field"}
$mp3->{"field"}
Truth table25%1/4
not(A) and B and C
A= not ref $valB= exists $mp3->{"field"}C= $mp3->{"field"}
| |||||||||||||||||||||||||||||||||||||||||||
| 362 | && ( exists $mp3->{field} ) | ||||||||||||||||||||||||||||||||||||||||||
| 363 | && ( $mp3->{field} ) ) { | ||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | $val = { $mp3->{field} => $self->info->get_data($mt) }; | |||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||
| 366 | #else { | ||||||||||||||||||||||||||||||||||||||||||
| 367 | $id3v2->frame_select( $mp3->{frame}, $mp3->{description}, | ||||||||||||||||||||||||||||||||||||||||||
| 368 | 11 | [''], $val ); | |||||||||||||||||||||||||||||||||||||||||
| 369 | #} | ||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | 1 | ▶ | if ( $self->info->has_data('lyrics') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 374 | 1 | $id3v2->remove_frame('USLT'); | |||||||||||||||||||||||||||||||||||||||||
| 375 | 1 | $id3v2->add_frame( 'USLT', 0, "ENG", "Lyrics", $self->info->get_data('lyrics') ); | |||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||
| 377 | 1 | ▶ | if ( $self->info->has_data('encoded_by') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 378 | 1 | $id3v2->remove_frame('TENC'); | |||||||||||||||||||||||||||||||||||||||||
| 379 | 1 | $id3v2->add_frame( 'TENC', 0, $self->info->get_data('encoded_by') ); | |||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||
| 381 | 1 | ▶ | if (( $self->info->has_data('releasetime') ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->info->has_data("releasetime") and $self->info->get_data("releasetime") =~ /(\d\d\d\d)-?(\d\d)?-?(\d\d)? ?(\d\d)?:?(\d\d)?/
MC/DC0%0/2
$self->info->has_data("releasetime") and $self->info->get_data("releasetime") =~ /(\d\d\d\d)-?(\d\d)?-?(\d\d)? ?(\d\d)?:?(\d\d)?/
$self->info->has_data("releasetime")
$self->info->get_data("releasetime") =~ /(\d\d\d\d)-?(\d\d)?-?(\d\d)? ?(\d\d)?:?(\d\d)?/
Truth table33%1/3
A and B
A= $self->info->has_data("releasetime")B= $self->info->get_data("releasetime") =~ /(\d\d\d\d)-?(\d\d)?-?(\d\d)? ?(\d\d)?:?(\d\d)?/
| |||||||||||||||||||||||||||||||||||||||||||
| 382 | && ( $self->info->get_data('releasetime') | ||||||||||||||||||||||||||||||||||||||||||
| 383 | =~ /(\d\d\d\d)-?(\d\d)?-?(\d\d)? ?(\d\d)?:?(\d\d)?/ ) | ||||||||||||||||||||||||||||||||||||||||||
| 384 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 385 | 1 | my $year = $1; | |||||||||||||||||||||||||||||||||||||||||
| 386 | 1 | ▶ | my $day = sprintf( "%02d%02d", $2 || 0, $3 || 0 ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$2 || 0
$3 || 0
MC/DC0%0/1
$2 || 0
$2
MC/DC0%0/1
$3 || 0
$3
Truth table50%1/2
A
A= $2
Truth table50%1/2
A
A= $3
| |||||||||||||||||||||||||||||||||||||||||||
| 387 | 1 | ▶ | my $time = sprintf( "%02d%02d", $4 || 0, $5 || 0 ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$4 || 0
$5 || 0
MC/DC0%0/1
$4 || 0
$4
MC/DC0%0/1
$5 || 0
$5
Truth table50%1/2
A
A= $4
Truth table50%1/2
A
A= $5
| |||||||||||||||||||||||||||||||||||||||||||
| 388 | 1 | $id3v2->remove_frame('TDAT'); | |||||||||||||||||||||||||||||||||||||||||
| 389 | 1 | $id3v2->add_frame( 'TDAT', 0, $day ); | |||||||||||||||||||||||||||||||||||||||||
| 390 | 1 | $id3v2->remove_frame('TIME'); | |||||||||||||||||||||||||||||||||||||||||
| 391 | 1 | $id3v2->add_frame( 'TIME', 0, $time ); | |||||||||||||||||||||||||||||||||||||||||
| 392 | 1 | $self->mp3->year_set($year); | |||||||||||||||||||||||||||||||||||||||||
| 393 | 1 | print STDERR "Writing releasedate: $day and time: $time\n"; | |||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||
| 395 | 1 | ▶ | if ( !$self->options->{ignore_apic} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 396 | 1 | $id3v2->remove_frame('APIC'); | |||||||||||||||||||||||||||||||||||||||||
| 397 | 1 | ▶ | if ( ( $self->options->{apic_cover} ) && ( $self->info->has_data('picture') ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->options->{"apic_cover"} and $self->info->has_data("picture")
MC/DC0%0/2
$self->options->{"apic_cover"} and $self->info->has_data("picture")
$self->options->{"apic_cover"}
$self->info->has_data("picture")
Truth table33%1/3
A and B
A= $self->options->{"apic_cover"}B= $self->info->has_data("picture")
| |||||||||||||||||||||||||||||||||||||||||||
| 398 | 1 | $self->status("Saving Cover to APIC frame"); | |||||||||||||||||||||||||||||||||||||||||
| 399 | 1 | $id3v2->add_frame( 'APIC', _apic_encode( $self->info->get_data('picture') ) ); | |||||||||||||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||
| 402 | 1 | eval { $id3v2->write_tag(); }; | |||||||||||||||||||||||||||||||||||||||||
| 403 | 1 | eval { $id3v1->write_tag(); }; | |||||||||||||||||||||||||||||||||||||||||
| 404 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | 2 | ▶ | sub close { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
close: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 408 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 409 | 2 | ▶ | if ( $self->mp3 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | 2 | $self->mp3->close(); | |||||||||||||||||||||||||||||||||||||||||
| 411 | 2 | $self->mp3->{ID3v2} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 412 | 2 | $self->mp3->{ID3v1} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 413 | 2 | $self->{'_mp3'} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||
| 417 | 1 | ▶ | sub _apic_encode { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_apic_encode: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||
| 418 | 1 | my $code = shift; | |||||||||||||||||||||||||||||||||||||||||
| 419 | return ( | ||||||||||||||||||||||||||||||||||||||||||
| 420 | 0, $code->{"MIME type"}, | ||||||||||||||||||||||||||||||||||||||||||
| 421 | $code->{"Picture Type"} || 'Cover (front)', | ||||||||||||||||||||||||||||||||||||||||||
| 422 | $code->{"Description"}, | ||||||||||||||||||||||||||||||||||||||||||
| 423 | $code->{_Data} | ||||||||||||||||||||||||||||||||||||||||||
| 424 | 1 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$code->{'Picture Type'} || 'Cover (front)'
MC/DC0%0/1
$code->{'Picture Type'} || 'Cover (front)'
$code->{'Picture Type'}
Truth table50%1/2
A
A= $code->{'Picture Type'}
| |||||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | ▶ | sub _url_encode { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_url_encode: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | my $url = shift; | |||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | return ($url); | |||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||
| 432 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | # vim: tabstop=4 | ||||||||||||||||||||||||||||||||||||||||||
| 435 | __END__ | ||||||||||||||||||||||||||||||||||||||||||