| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
10
|
use v5.37.9; |
|
|
1
|
|
|
|
|
2
|
|
|
2
|
1
|
|
|
1
|
|
3
|
use feature 'class'; |
|
|
1
|
|
|
|
|
11
|
|
|
|
1
|
|
|
|
|
94
|
|
|
3
|
1
|
|
|
1
|
|
4
|
no warnings 'experimental::class'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
72
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Video::NRK::Cache::Ytdlp 3.02; # Dist::Zilla doesn't know about class yet |
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
370
|
class Video::NRK::Cache::Ytdlp :isa(Video::NRK::Cache::Store) { |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
42
|
|
|
8
|
|
|
|
|
|
|
# ABSTRACT: Store NRK Video on Demand cache using yt-dlp |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use List::Util qw( min ); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
303
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
field @ytdlp_args = qw( |
|
15
|
|
|
|
|
|
|
--write-sub |
|
16
|
|
|
|
|
|
|
--all-subs |
|
17
|
|
|
|
|
|
|
--abort-on-unavailable-fragment |
|
18
|
|
|
|
|
|
|
--compat-options no-direct-merge |
|
19
|
|
|
|
|
|
|
); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# :reader |
|
22
|
|
|
|
|
|
|
method ytdlp_args () { @ytdlp_args } |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our @FORMATS = qw( |
|
26
|
|
|
|
|
|
|
worst/worstvideo+worstaudio/worst* |
|
27
|
|
|
|
|
|
|
worst[height>240]/worstvideo[height>240]+bestaudio/best/bestvideo+bestaudio/best* |
|
28
|
|
|
|
|
|
|
worst[height>320]/worstvideo[height>320]+bestaudio/best/bestvideo+bestaudio/best* |
|
29
|
|
|
|
|
|
|
worst[height>480]/worstvideo[height>480]+bestaudio/best/bestvideo+bestaudio/best* |
|
30
|
|
|
|
|
|
|
worst[height>640]/worstvideo[height>640]+bestaudio/best/bestvideo+bestaudio/best* |
|
31
|
|
|
|
|
|
|
worst[height>960]/worstvideo[height>960]+bestaudio/best/bestvideo+bestaudio/best* |
|
32
|
|
|
|
|
|
|
best/bestvideo+bestaudio/best* |
|
33
|
|
|
|
|
|
|
); |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
method format () { |
|
37
|
|
|
|
|
|
|
my $format = $FORMATS[min( $self->quality, $#FORMATS )]; |
|
38
|
|
|
|
|
|
|
return $format, '--format-sort', 'hasvid,ext,fps,res'; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
method download () { |
|
43
|
|
|
|
|
|
|
push @ytdlp_args, '--output', '' . $self->dir_mp4; |
|
44
|
|
|
|
|
|
|
push @ytdlp_args, '--format', $self->format(); |
|
45
|
|
|
|
|
|
|
push @ytdlp_args, '--limit-rate', $self->rate . 'K' if $self->rate; |
|
46
|
|
|
|
|
|
|
$self->run_ytdlp; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
method run_ytdlp () { |
|
51
|
|
|
|
|
|
|
$self->system( 'yt-dlp', $self->ytdlp_args, '--', $self->url ); |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
} # Work around perl5#20888 for v5.37.9 compatibility |
|
56
|
|
|
|
|
|
|
1; |