| 1 | package Catalyst::Plugin::Upload::Audio::File; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 2 | ▶ | use Catalyst::Request::Upload; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 2 | our $VERSION = '0.01'; | |||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | { | ||||||||||||||||||||
| 9 | package Catalyst::Request::Upload; | ||||||||||||||||||||
| 10 | 2 | ▶ | use Audio::File; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | # Get the actual Audio::File object | ||||||||||||||||||||
| 13 | 0 | ▶ | sub audio_file { return shift->_load_audio_file; } | ||||||||||||||||||
|
Subroutine
audio_file: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | # Get values in the AudioProperties of the file | ||||||||||||||||||||
| 16 | 3 | ▶ | sub length { return shift->_get_property('length'); } | ||||||||||||||||||
|
Subroutine
length: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 17 | 3 | ▶ | sub bitrate { return shift->_get_property('bitrate'); } | ||||||||||||||||||
|
Subroutine
bitrate: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 18 | 3 | ▶ | sub sample_rate { return shift->_get_property('sample_rate'); } | ||||||||||||||||||
|
Subroutine
sample_rate: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 19 | 3 | ▶ | sub channels { return shift->_get_property('channels'); } | ||||||||||||||||||
|
Subroutine
channels: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | # Get values in the Tags of the file | ||||||||||||||||||||
| 22 | 3 | ▶ | sub title { return shift->_get_tag('title'); } | ||||||||||||||||||
|
Subroutine
title: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 23 | 3 | ▶ | sub artist { return shift->_get_tag('artist'); } | ||||||||||||||||||
|
Subroutine
artist: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 24 | 3 | ▶ | sub album { return shift->_get_tag('album'); } | ||||||||||||||||||
|
Subroutine
album: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 25 | 3 | ▶ | sub comment { return shift->_get_tag('comment'); } | ||||||||||||||||||
|
Subroutine
comment: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 26 | 3 | ▶ | sub genre { return shift->_get_tag('genre'); } | ||||||||||||||||||
|
Subroutine
genre: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 27 | 3 | ▶ | sub year { return shift->_get_tag('year'); } | ||||||||||||||||||
|
Subroutine
year: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 28 | 3 | ▶ | sub track { return shift->_get_tag('track'); } | ||||||||||||||||||
|
Subroutine
track: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 29 | 3 | ▶ | sub total { return shift->_get_tag('total'); } | ||||||||||||||||||
|
Subroutine
total: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | 12 | ▶ | sub _get_property { | ||||||||||||||||||
|
Subroutine
_get_property: called CC=2 SCAR=7.2
| |||||||||||||||||||||
| 32 | 12 | my ($self, $property) = (shift, @_); | |||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | $self->_load_audio_file | ||||||||||||||||||||
| 35 | 12 | ▶ | ? return $self->{__audio_file}->audio_properties->all->{$property} | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 36 | : undef; | ||||||||||||||||||||
| 37 | } | ||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | 24 | ▶ | sub _get_tag { | ||||||||||||||||||
|
Subroutine
_get_tag: called CC=2 SCAR=7.2
| |||||||||||||||||||||
| 40 | 24 | my ($self, $tag) = (shift, @_); | |||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | $self->_load_audio_file | ||||||||||||||||||||
| 43 | 24 | ▶ | ? return $self->{__audio_file}->tag->all->{$tag} | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 44 | : undef; | ||||||||||||||||||||
| 45 | } | ||||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | 36 | ▶ | sub _load_audio_file { | ||||||||||||||||||
|
Subroutine
_load_audio_file: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 48 | 36 | my $self = shift; | |||||||||||||||||||
| 49 | 36 | eval { | |||||||||||||||||||
| 50 | 36 | ▶ | $self->{__audio_file} ||= Audio::File->new($self->filename); | ||||||||||||||||||
|
Condition66%2/3
$self->{"__audio_file"} ||= "Audio::File"->new($self->filename)
MC/DC0%0/2
$self->{"__audio_file"} ||= "Audio::File"->new($self->filename)
$self->{"__audio_file"}
"Audio::File"->new($self->filename)
Truth table66%2/3
A ||= B
A= $self->{"__audio_file"}B= "Audio::File"->new($self->filename)
| |||||||||||||||||||||
| 51 | }; | ||||||||||||||||||||
| 52 | 36 | return $self->{__audio_file}; | |||||||||||||||||||
| 53 | } | ||||||||||||||||||||
| 54 | } | ||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | 2 | 1; | |||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | __END__ | ||||||||||||||||||||