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