| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::LinkEmbedder::Link::Video::Dbtv; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Mojolicious::Plugin::LinkEmbedder::Link::Video::Dbtv - dbtv.no video |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
This class inherit from L. |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
|
12
|
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
646
|
use Mojo::Base 'Mojolicious::Plugin::LinkEmbedder::Link::Video'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
8
|
|
|
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 $url = $self->url; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
$url->query->param('vid') || $url->path->[-1]; |
|
30
|
|
|
|
|
|
|
}; |
|
31
|
|
|
|
|
|
|
|
|
32
|
0
|
|
|
0
|
1
|
|
sub provider_name {'Dagbladet'} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 METHODS |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 learn |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub learn { |
|
41
|
0
|
|
|
0
|
1
|
|
my ($self, $c, $cb) = @_; |
|
42
|
|
|
|
|
|
|
|
|
43
|
0
|
0
|
|
|
|
|
if ($self->media_id) { |
|
44
|
0
|
|
|
|
|
|
$self->$cb; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
else { |
|
47
|
0
|
|
|
|
|
|
$self->SUPER::learn($c, $cb); |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
return $self; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 pretty_url |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Returns a pretty version of the L. |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub pretty_url { |
|
60
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
61
|
0
|
0
|
|
|
|
|
my $media_id = $self->media_id or return $self->SUPER::to_embed; |
|
62
|
0
|
|
|
|
|
|
my $url = $self->url->clone; |
|
63
|
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
$url->fragment(undef); |
|
65
|
0
|
|
|
|
|
|
$url->query(vid => $media_id); |
|
66
|
0
|
|
|
|
|
|
$url; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 to_embed |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Returns the HTML code for an iframe embedding this movie. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub to_embed { |
|
76
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
77
|
0
|
|
|
|
|
|
my $src = Mojo::URL->new('http://beta.dbtv.no/player'); |
|
78
|
0
|
|
|
|
|
|
my %args = @_; |
|
79
|
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
push @{$src->path}, $self->media_id; |
|
|
0
|
|
|
|
|
|
|
|
81
|
0
|
0
|
|
|
|
|
$src->query({autoplay => $args{autoplay} ? 'true' : 'false'}); |
|
82
|
|
|
|
|
|
|
|
|
83
|
0
|
|
0
|
|
|
|
$self->_iframe( |
|
|
|
|
0
|
|
|
|
|
|
84
|
|
|
|
|
|
|
src => $src, |
|
85
|
|
|
|
|
|
|
class => 'link-embedder video-dbtv', |
|
86
|
|
|
|
|
|
|
width => $args{width} || 980, |
|
87
|
|
|
|
|
|
|
height => $args{height} || 551 |
|
88
|
|
|
|
|
|
|
); |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 AUTHOR |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Marcus Ramberg |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |