line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
3577
|
use 5.010; |
|
1
|
|
|
|
|
3
|
|
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
46
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package App::MP4Meta::MusicVideo; |
6
|
|
|
|
|
|
|
{ |
7
|
|
|
|
|
|
|
$App::MP4Meta::MusicVideo::VERSION = '1.153340'; |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: Add metadata to a music video |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
6
|
use App::MP4Meta::Base; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
48
|
|
13
|
|
|
|
|
|
|
our @ISA = 'App::MP4Meta::Base'; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
5
|
use File::Spec '3.33'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
16
|
1
|
|
|
1
|
|
5
|
use AtomicParsley::Command::Tags; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
3
|
|
|
3
|
1
|
119484
|
my $class = shift; |
20
|
3
|
|
|
|
|
6
|
my $args = shift; |
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
|
|
22
|
my $self = $class->SUPER::new($args); |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
$self->{'media_type'} = 'Music Video'; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
return $self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub apply_meta { |
30
|
0
|
|
|
0
|
1
|
|
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
|
|
0
|
|
|
|
artwork => $self->{'coverfile'} |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
my $error = $self->_write_tags( $path, $tags ); |
50
|
0
|
0
|
|
|
|
|
return $error if $error; |
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
|
|
|
|
|
|
|
sub _parse_filename { |
57
|
0
|
|
|
0
|
|
|
my ( $self, $file ) = @_; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# strip suffix |
60
|
0
|
|
|
|
|
|
$file = $self->_strip_suffix($file); |
61
|
|
|
|
|
|
|
|
62
|
0
|
0
|
|
|
|
|
if ( $file =~ /^(.*) - (.*)$/ ) { |
63
|
0
|
|
|
|
|
|
return ( $self->_clean_title($1), $self->_clean_title($2) ); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
return; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__END__ |