line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::LinkEmbedder::Link::Video::Dbtv; |
2
|
1
|
|
|
1
|
|
2918
|
use Mojo::Base 'Mojolicious::Plugin::LinkEmbedder::Link::Video'; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
7
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
has media_id => sub { |
5
|
|
|
|
|
|
|
my $self = shift; |
6
|
|
|
|
|
|
|
my $url = $self->url; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$url->query->param('vid') || $url->path->[-1]; |
9
|
|
|
|
|
|
|
}; |
10
|
|
|
|
|
|
|
|
11
|
0
|
|
|
0
|
0
|
|
sub provider_name {'Dagbladet'} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub learn { |
14
|
0
|
|
|
0
|
0
|
|
my ($self, $c, $cb) = @_; |
15
|
|
|
|
|
|
|
|
16
|
0
|
0
|
|
|
|
|
if ($self->media_id) { |
17
|
0
|
|
|
|
|
|
$self->$cb; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
else { |
20
|
0
|
|
|
|
|
|
$self->SUPER::learn($c, $cb); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
return $self; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub pretty_url { |
27
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
28
|
0
|
0
|
|
|
|
|
my $media_id = $self->media_id or return $self->SUPER::to_embed; |
29
|
0
|
|
|
|
|
|
my $url = $self->url->clone; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
$url->fragment(undef); |
32
|
0
|
|
|
|
|
|
$url->query(vid => $media_id); |
33
|
0
|
|
|
|
|
|
$url; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub to_embed { |
37
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
38
|
0
|
|
|
|
|
|
my $src = Mojo::URL->new('http://beta.dbtv.no/player'); |
39
|
0
|
|
|
|
|
|
my %args = @_; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
push @{$src->path}, $self->media_id; |
|
0
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
$src->query({autoplay => $args{autoplay} ? 'true' : 'false'}); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$self->_iframe( |
45
|
|
|
|
|
|
|
src => $src, |
46
|
|
|
|
|
|
|
class => 'link-embedder video-dbtv', |
47
|
|
|
|
|
|
|
width => $args{width} || 980, |
48
|
0
|
|
0
|
|
|
|
height => $args{height} || 551 |
|
|
|
0
|
|
|
|
|
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |