line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::LinkEmbedder::Link::Video::Vimeo; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Mojolicious::Plugin::LinkEmbedder::Link::Video::Vimeo - vimeo.com video |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
This class inherit from L. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
404
|
use Mojo::Base 'Mojolicious::Plugin::LinkEmbedder::Link::Text::HTML'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head2 media_id |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Returns the the digit from the url L. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head2 provider_name |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has media_id => sub { |
26
|
|
|
|
|
|
|
my $self = shift; |
27
|
|
|
|
|
|
|
my $media_id = $self->url->path->[-1]; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
$media_id =~ s!\.html$!!; |
30
|
|
|
|
|
|
|
$media_id; |
31
|
|
|
|
|
|
|
}; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
0
|
1
|
|
sub provider_name {'Vimeo'} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 METHODS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 learn |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub learn { |
42
|
0
|
|
|
0
|
1
|
|
my ($self, $c, $cb) = @_; |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
return $self->SUPER::learn($c, $cb) unless $self->media_id; |
45
|
0
|
|
|
|
|
|
$self->$cb; |
46
|
0
|
|
|
|
|
|
$self; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 to_embed |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Returns the HTML code for an iframe embedding this movie. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub to_embed { |
56
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
57
|
0
|
0
|
|
|
|
|
my $media_id = $self->media_id or return $self->SUPER::to_embed; |
58
|
0
|
|
|
|
|
|
my $src = Mojo::URL->new('//player.vimeo.com/video/86404451?portrait=0&color=ffffff'); |
59
|
0
|
|
|
|
|
|
my %args = @_; |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
0
|
|
|
|
$self->_iframe( |
|
|
|
0
|
|
|
|
|
62
|
|
|
|
|
|
|
src => "//player.vimeo.com/video/$media_id?portrait=0&color=ffffff", |
63
|
|
|
|
|
|
|
class => 'link-embedder video-vimeo', |
64
|
|
|
|
|
|
|
width => $args{width} || 500, |
65
|
|
|
|
|
|
|
height => $args{height} || 281 |
66
|
|
|
|
|
|
|
); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 AUTHOR |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Marcus Ramberg |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |