| 1 | package WWW::Deezer::Track; | ||
| 2 | |||
| 3 | 5 | our $VERSION = '0.03'; | |
| 4 | |||
| 5 | 5 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 5 | ▶ | use Moose::Util::TypeConstraints; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 5 | extends 'WWW::Deezer::Obj'; | |
| 9 | |||
| 10 | 5 | ▶ | use WWW::Deezer::Album; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 5 | ▶ | use WWW::Deezer::Artist; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | # http://developers.deezer.com/api/track | ||
| 14 | |||
| 15 | 5 | has 'id' => ( is => 'ro', isa => 'Int' ); | |
| 16 | |||
| 17 | 5 | has 'readable' => ( | |
| 18 | is => 'ro', | ||
| 19 | isa => 'JSONBoolean', | ||
| 20 | coerce => 1 | ||
| 21 | ); | ||
| 22 | |||
| 23 | 5 | has 'unseen' => ( | |
| 24 | is => 'ro', | ||
| 25 | isa => 'JSONBoolean', | ||
| 26 | coerce => 1 | ||
| 27 | ); | ||
| 28 | |||
| 29 | 5 | has 'title' => ( is => 'ro', isa => 'Str' ); | |
| 30 | 5 | has 'title_short' => ( is => 'ro', isa => 'Str' ); | |
| 31 | 5 | has 'title_version' => ( is => 'ro', isa => 'Str' ); | |
| 32 | 5 | has 'isrc' => ( is => 'ro', isa => 'Str' ); | |
| 33 | |||
| 34 | 5 | has 'link' => ( is => 'ro', isa => 'Str' ); | |
| 35 | 5 | has 'share' => ( is => 'ro', isa => 'Str' ); | |
| 36 | 5 | has 'duration' => ( is => 'ro', isa => 'Int' ); | |
| 37 | |||
| 38 | 5 | has 'track_position' => ( is => 'ro', isa => 'Int' ); | |
| 39 | |||
| 40 | 5 | has 'disk_number' => ( is => 'ro', isa => 'Int' ); | |
| 41 | |||
| 42 | 5 | has 'rank' => ( is => 'ro', isa => 'Int' ); | |
| 43 | |||
| 44 | 5 | has 'release_date' => ( is => 'ro', isa => 'Num' ); | |
| 45 | 5 | has 'bpm' => ( is => 'ro', isa => 'Num' ); | |
| 46 | 5 | has 'gain' => ( is => 'ro', isa => 'Num' ); | |
| 47 | |||
| 48 | 5 | has 'explicit_lyrics' => ( | |
| 49 | is => 'ro', | ||
| 50 | isa => 'JSONBoolean', | ||
| 51 | coerce => 1, | ||
| 52 | ); | ||
| 53 | |||
| 54 | 5 | has 'preview' => ( is => 'ro', isa => 'Str' ); # URL | |
| 55 | |||
| 56 | 5 | has 'artist' => ( | |
| 57 | is => 'rw', | ||
| 58 | isa => 'Ref', | ||
| 59 | ); # 2do: change Ref to Object | ||
| 60 | |||
| 61 | 5 | has 'album' => ( | |
| 62 | is => 'rw', | ||
| 63 | isa => 'Ref', | ||
| 64 | ); # 2do: change Ref to Object | ||
| 65 | |||
| 66 | 5 | has 'deezer_obj' => ( | |
| 67 | is => 'rw', | ||
| 68 | isa => 'Ref' | ||
| 69 | ); | ||
| 70 | |||
| 71 | 0 | ▶ | sub count { |
|
Subroutine
count: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 72 | 0 | my $self = shift; | |
| 73 | 0 | return scalar @{$self->data}; | |
| 74 | } | ||
| 75 | |||
| 76 | 0 | ▶ | sub first { |
|
Subroutine
first: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 77 | 0 | my $self = shift; | |
| 78 | 0 | return $self->data->[0]; | |
| 79 | } | ||
| 80 | |||
| 81 | 0 | ▶ | sub set_artist { |
|
Subroutine
set_artist: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 82 | 0 | my ($self, $data) = @_; | |
| 83 | 0 | my $artist = WWW::Deezer::Artist->new($data); | |
| 84 | 0 | $artist->deezer_obj($self->deezer_obj); | |
| 85 | 0 | $self->artist($artist); | |
| 86 | 0 | return $self; | |
| 87 | } | ||
| 88 | |||
| 89 | 0 | ▶ | sub set_album { |
|
Subroutine
set_album: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 90 | 0 | my ($self, $data) = @_; | |
| 91 | 0 | my $album = WWW::Deezer::Album->new($data); | |
| 92 | 0 | $album->deezer_obj($self->deezer_obj); | |
| 93 | 0 | $self->album($album); | |
| 94 | 0 | return $self; | |
| 95 | } | ||
| 96 | |||
| 97 | 5 | 1; | |