| 1 | # $Id: Depend.pm 2377 2009-02-22 18:49:50Z joern $ | ||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||
| 3 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||
| 4 | # Copyright (C) 2001-2006 Jörn Reder <joern AT zyn.de>. | ||||||||||||||||||||||||||||||
| 5 | # All Rights Reserved. See file COPYRIGHT for details. | ||||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||||
| 7 | # This program is part of Video::DVDRip, which is free software; you can | ||||||||||||||||||||||||||||||
| 8 | # redistribute it and/or modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||
| 9 | #----------------------------------------------------------------------- | ||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||
| 11 | package Video::DVDRip::Depend; | ||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use Locale::TextDomain qw (video.dvdrip); | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||
| 14 | 1 | @ISA = qw ( Video::DVDRip::Base ); | |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||
| 16 | 1 | my $DEBUG = 0; | |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||
| 21 | 1 | my @DVDRIP_BIN_FILES = qw ( | |||||||||||||||||||||||||||||
| 22 | dvdrip execflow | ||||||||||||||||||||||||||||||
| 23 | dvdrip-master dvdrip-multitee | ||||||||||||||||||||||||||||||
| 24 | dvdrip-progress dvdrip-splitpipe | ||||||||||||||||||||||||||||||
| 25 | dvdrip-subpng | ||||||||||||||||||||||||||||||
| 26 | ); | ||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||
| 28 | 1 | my @DVDRIP_MASTER_BIN_FILES = qw ( | |||||||||||||||||||||||||||||
| 29 | execflow | ||||||||||||||||||||||||||||||
| 30 | dvdrip-master | ||||||||||||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||
| 33 | 1 | my $OBJECT; | |||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||
| 35 | 1 | my $ORDER = 0; | |||||||||||||||||||||||||||||
| 36 | my %TOOLS = ( | ||||||||||||||||||||||||||||||
| 37 | "dvd::rip" => { | ||||||||||||||||||||||||||||||
| 38 | order => ++$ORDER, | ||||||||||||||||||||||||||||||
| 39 | command => "dvdrip", | ||||||||||||||||||||||||||||||
| 40 | comment => __ "All internal command files", | ||||||||||||||||||||||||||||||
| 41 | optional => 0, | ||||||||||||||||||||||||||||||
| 42 | dont_cache => 1, | ||||||||||||||||||||||||||||||
| 43 | exists => 1, | ||||||||||||||||||||||||||||||
| 44 | 1 | ▶ | get_version => sub { | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=24.9
| |||||||||||||||||||||||||||||||
| 45 | 1 | my $missing_file_cnt = 0; | |||||||||||||||||||||||||||||
| 46 | 1 | ▶ | my @files = $Video::DVDRip::ISMASTER ? | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 47 | @DVDRIP_MASTER_BIN_FILES : @DVDRIP_BIN_FILES; | ||||||||||||||||||||||||||||||
| 48 | 1 | foreach my $dvdrip_file ( @files ) { | |||||||||||||||||||||||||||||
| 49 | 7 | ▶ | if ( !__PACKAGE__->get_full_path($dvdrip_file) ) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 50 | 0 | ++$missing_file_cnt; | |||||||||||||||||||||||||||||
| 51 | 0 | ▶ | print STDERR __x( "ERROR: '{file}' not found in PATH\n", | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 52 | file => $dvdrip_file ) | ||||||||||||||||||||||||||||||
| 53 | unless $Video::DVDRip::MAKE_TEST; | ||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||
| 56 | 1 | ▶ | return $missing_file_cnt == @DVDRIP_BIN_FILES ? "" | ||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||
| 57 | : $missing_file_cnt == 0 ? $Video::DVDRip::VERSION | ||||||||||||||||||||||||||||||
| 58 | : "incomplete"; | ||||||||||||||||||||||||||||||
| 59 | }, | ||||||||||||||||||||||||||||||
| 60 | convert => 'default', | ||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | __convert => sub { | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||
| 62 | 0 | my ($version) = @_; | |||||||||||||||||||||||||||||
| 63 | 0 | ▶ | return $version eq '' ? 0 | ||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||
| 64 | : $version eq 'incomplete' ? 0 | ||||||||||||||||||||||||||||||
| 65 | : $Video::DVDRip::VERSION; | ||||||||||||||||||||||||||||||
| 66 | }, | ||||||||||||||||||||||||||||||
| 67 | min => $Video::DVDRip::VERSION, | ||||||||||||||||||||||||||||||
| 68 | suggested => $Video::DVDRip::VERSION, | ||||||||||||||||||||||||||||||
| 69 | installed => undef, # set by ->new | ||||||||||||||||||||||||||||||
| 70 | installed_num => undef, # set by ->new | ||||||||||||||||||||||||||||||
| 71 | min_num => undef, # set by ->new | ||||||||||||||||||||||||||||||
| 72 | suggested_num => undef, # set by ->new | ||||||||||||||||||||||||||||||
| 73 | installed_ok => undef, # set by ->new | ||||||||||||||||||||||||||||||
| 74 | }, | ||||||||||||||||||||||||||||||
| 75 | transcode => { | ||||||||||||||||||||||||||||||
| 76 | order => ++$ORDER, | ||||||||||||||||||||||||||||||
| 77 | command => "transcode", | ||||||||||||||||||||||||||||||
| 78 | comment => __ "dvd::rip is nothing without transcode", | ||||||||||||||||||||||||||||||
| 79 | optional => 0, | ||||||||||||||||||||||||||||||
| 80 | version_cmd => "transcode -v", | ||||||||||||||||||||||||||||||
| 81 | 1 | ▶ | get_version => sub { | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 82 | 1 | my ($cmd) = @_; | |||||||||||||||||||||||||||||
| 83 | 1 | qx[$cmd 2>&1] =~ /v(\d+\.\d+\.\d+(\.\d+)?)/i; | |||||||||||||||||||||||||||||
| 84 | 1 | return $1; | |||||||||||||||||||||||||||||
| 85 | }, | ||||||||||||||||||||||||||||||
| 86 | convert => 'default', | ||||||||||||||||||||||||||||||
| 87 | min => "0.6.14", | ||||||||||||||||||||||||||||||
| 88 | max => undef, | ||||||||||||||||||||||||||||||
| 89 | suggested => "1.0.2", | ||||||||||||||||||||||||||||||
| 90 | installed => undef, # set by ->new | ||||||||||||||||||||||||||||||
| 91 | installed_num => undef, # set by ->new | ||||||||||||||||||||||||||||||
| 92 | min_num => undef, # set by ->new | ||||||||||||||||||||||||||||||
| 93 | suggested_num => undef, # set by ->new | ||||||||||||||||||||||||||||||
| 94 | installed_ok => undef, # set by ->new | ||||||||||||||||||||||||||||||
| 95 | cluster => 1, | ||||||||||||||||||||||||||||||
| 96 | }, | ||||||||||||||||||||||||||||||
| 97 | ImageMagick => { | ||||||||||||||||||||||||||||||
| 98 | order => ++$ORDER, | ||||||||||||||||||||||||||||||
| 99 | command => "convert", | ||||||||||||||||||||||||||||||
| 100 | comment => __ "Needed for preview image processing", | ||||||||||||||||||||||||||||||
| 101 | optional => 0, | ||||||||||||||||||||||||||||||
| 102 | version_cmd => "convert -version", | ||||||||||||||||||||||||||||||
| 103 | 1 | ▶ | get_version => sub { | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||
| 104 | 1 | my ($cmd) = @_; | |||||||||||||||||||||||||||||
| 105 | 1 | my ($output) = qx[$cmd 2>&1]; | |||||||||||||||||||||||||||||
| 106 | #-- GraphicsMagick is compatible with ImageMagick 5.5.2. | ||||||||||||||||||||||||||||||
| 107 | 1 | ▶ | return "5.5.2" if $output =~ /GraphicsMagick\s+(\d+\.\d+(\.\d+)?)/i; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 108 | 1 | $output =~ /ImageMagick\s+(\d+\.\d+(\.\d+)?)/i; | |||||||||||||||||||||||||||||
| 109 | 1 | return $1; | |||||||||||||||||||||||||||||
| 110 | }, | ||||||||||||||||||||||||||||||
| 111 | convert => 'default', | ||||||||||||||||||||||||||||||
| 112 | min => "4.0.0", | ||||||||||||||||||||||||||||||
| 113 | suggested => "6.2.3", | ||||||||||||||||||||||||||||||
| 114 | }, | ||||||||||||||||||||||||||||||
| 115 | ffmpeg => { | ||||||||||||||||||||||||||||||
| 116 | order => ++$ORDER, | ||||||||||||||||||||||||||||||
| 117 | command => "ffmpeg", | ||||||||||||||||||||||||||||||
| 118 | comment => __ "FFmpeg video converter command line program", | ||||||||||||||||||||||||||||||
| 119 | optional => 1, | ||||||||||||||||||||||||||||||
| 120 | version_cmd => "ffmpeg -version", | ||||||||||||||||||||||||||||||
| 121 | 1 | ▶ | get_version => sub { | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 122 | 1 | my ($cmd) = @_; | |||||||||||||||||||||||||||||
| 123 | 1 | qx[$cmd 2>&1] =~ /version ([^\s]+)/i; | |||||||||||||||||||||||||||||
| 124 | 1 | return $1; | |||||||||||||||||||||||||||||
| 125 | }, | ||||||||||||||||||||||||||||||
| 126 | convert => 'default', | ||||||||||||||||||||||||||||||
| 127 | min => "0.4.10", | ||||||||||||||||||||||||||||||
| 128 | }, | ||||||||||||||||||||||||||||||
| 129 | xvid4conf => { | ||||||||||||||||||||||||||||||
| 130 | order => ++$ORDER, | ||||||||||||||||||||||||||||||
| 131 | command => "xvid4conf", | ||||||||||||||||||||||||||||||
| 132 | comment => __ "xvid4 configuration tool", | ||||||||||||||||||||||||||||||
| 133 | optional => 1, | ||||||||||||||||||||||||||||||
| 134 | version_cmd => "xvid4conf -v", | ||||||||||||||||||||||||||||||
| 135 | 1 | ▶ | get_version => sub { | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 136 | 1 | my ($cmd) = @_; | |||||||||||||||||||||||||||||
| 137 | 1 | qx[$cmd 2>&1] =~ /(\d+\.\d+(\.\d+)?)/i; | |||||||||||||||||||||||||||||
| 138 | 1 | return $1; | |||||||||||||||||||||||||||||
| 139 | }, | ||||||||||||||||||||||||||||||
| 140 | convert => 'default', | ||||||||||||||||||||||||||||||
| 141 | min => "1.6", | ||||||||||||||||||||||||||||||
| 142 | suggested => "1.12", | ||||||||||||||||||||||||||||||
| 143 | }, | ||||||||||||||||||||||||||||||
| 144 | subtitle2pgm => { | ||||||||||||||||||||||||||||||
| 145 | order => ++$ORDER, | ||||||||||||||||||||||||||||||
| 146 | command => "subtitle2pgm", | ||||||||||||||||||||||||||||||
| 147 | comment => __ "Needed for subtitles", | ||||||||||||||||||||||||||||||
| 148 | optional => 1, | ||||||||||||||||||||||||||||||
| 149 | version_cmd => "subtitle2pgm -h", | ||||||||||||||||||||||||||||||
| 150 | 1 | ▶ | get_version => sub { | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 151 | 1 | my ($cmd) = @_; | |||||||||||||||||||||||||||||
| 152 | 1 | qx[$cmd 2>&1] =~ /version\s+(\d+\.\d+(\.\d+)?)/i; | |||||||||||||||||||||||||||||
| 153 | 1 | return $1; | |||||||||||||||||||||||||||||
| 154 | }, | ||||||||||||||||||||||||||||||
| 155 | convert => 'default', | ||||||||||||||||||||||||||||||
| 156 | min => "0.3", | ||||||||||||||||||||||||||||||
| 157 | suggested => "0.3", | ||||||||||||||||||||||||||||||
| 158 | }, | ||||||||||||||||||||||||||||||
| 159 | lsdvd => { | ||||||||||||||||||||||||||||||
| 160 | order => ++$ORDER, | ||||||||||||||||||||||||||||||
| 161 | command => "lsdvd", | ||||||||||||||||||||||||||||||
| 162 | comment => __ "Needed for faster DVD TOC reading", | ||||||||||||||||||||||||||||||
| 163 | optional => 1, | ||||||||||||||||||||||||||||||
| 164 | version_cmd => "lsdvd -V", | ||||||||||||||||||||||||||||||
| 165 | 1 | ▶ | get_version => sub { | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 166 | 1 | my ($cmd) = @_; | |||||||||||||||||||||||||||||
| 167 | 1 | qx[lsdvd -V 2>&1] =~ /lsdvd\s+(\d+\.\d+(\.\d+)?)/i; | |||||||||||||||||||||||||||||
| 168 | 1 | return $1; | |||||||||||||||||||||||||||||
| 169 | }, | ||||||||||||||||||||||||||||||
| 170 | convert => 'default', | ||||||||||||||||||||||||||||||
| 171 | min => "0.15", | ||||||||||||||||||||||||||||||
| 172 | suggested => "0.15", | ||||||||||||||||||||||||||||||
| 173 | }, | ||||||||||||||||||||||||||||||
| 174 | rar => { | ||||||||||||||||||||||||||||||
| 175 | order => ++$ORDER, | ||||||||||||||||||||||||||||||
| 176 | command => Video::DVDRip::Depend->config('rar_command'), | ||||||||||||||||||||||||||||||
| 177 | comment => __ "Needed for compressed vobsub subtitles", | ||||||||||||||||||||||||||||||
| 178 | optional => 1, | ||||||||||||||||||||||||||||||
| 179 | version_cmd => "", | ||||||||||||||||||||||||||||||
| 180 | 1 | ▶ | get_version => sub { | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 181 | 1 | my $cmd = Video::DVDRip::Depend->config('rar_command')." '-?'"; | |||||||||||||||||||||||||||||
| 182 | 1 | qx[$cmd 2>&1] =~ /rar\s+(\d+\.\d+(\.\d+)?)/i; | |||||||||||||||||||||||||||||
| 183 | 1 | return $1; | |||||||||||||||||||||||||||||
| 184 | }, | ||||||||||||||||||||||||||||||
| 185 | convert => 'default', | ||||||||||||||||||||||||||||||
| 186 | min => "2.71", | ||||||||||||||||||||||||||||||
| 187 | max => "2.99", | ||||||||||||||||||||||||||||||
| 188 | suggested => "2.71", | ||||||||||||||||||||||||||||||
| 189 | }, | ||||||||||||||||||||||||||||||
| 190 | mplayer => { | ||||||||||||||||||||||||||||||
| 191 | order => ++$ORDER, | ||||||||||||||||||||||||||||||
| 192 | command => "mplayer", | ||||||||||||||||||||||||||||||
| 193 | comment => __ "Needed for subtitle vobsub viewing", | ||||||||||||||||||||||||||||||
| 194 | optional => 1, | ||||||||||||||||||||||||||||||
| 195 | version_cmd => "mplayer --help", | ||||||||||||||||||||||||||||||
| 196 | 1 | ▶ | get_version => sub { | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||
| 197 | 1 | my ($cmd) = @_; | |||||||||||||||||||||||||||||
| 198 | 1 | my $out = qx[$cmd 2>&1]; | |||||||||||||||||||||||||||||
| 199 | 1 | ▶ | if ( $out =~ /CVS|SVN/i ) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 200 | 0 | return "cvs"; | |||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||
| 202 | else { | ||||||||||||||||||||||||||||||
| 203 | 1 | $out =~ /MPlayer.*?(\d+\.\d+(\.\d+)?)/i; | |||||||||||||||||||||||||||||
| 204 | 1 | return $1; | |||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||
| 206 | }, | ||||||||||||||||||||||||||||||
| 207 | convert => 'default', | ||||||||||||||||||||||||||||||
| 208 | min => "0.90", | ||||||||||||||||||||||||||||||
| 209 | suggested => "1.00", | ||||||||||||||||||||||||||||||
| 210 | }, | ||||||||||||||||||||||||||||||
| 211 | ogmtools => { | ||||||||||||||||||||||||||||||
| 212 | order => ++$ORDER, | ||||||||||||||||||||||||||||||
| 213 | command => "ogmmerge", | ||||||||||||||||||||||||||||||
| 214 | comment => __ "Needed for OGG/Vorbis", | ||||||||||||||||||||||||||||||
| 215 | optional => 1, | ||||||||||||||||||||||||||||||
| 216 | version_cmd => "ogmmerge -V", | ||||||||||||||||||||||||||||||
| 217 | 1 | ▶ | get_version => sub { | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 218 | 1 | my ($cmd) = @_; | |||||||||||||||||||||||||||||
| 219 | 1 | qx[$cmd 2>&1] =~ /v(\d+\.\d+(\.\d+)?)/i; | |||||||||||||||||||||||||||||
| 220 | 1 | return $1; | |||||||||||||||||||||||||||||
| 221 | }, | ||||||||||||||||||||||||||||||
| 222 | convert => 'default', | ||||||||||||||||||||||||||||||
| 223 | min => "1.0.0", | ||||||||||||||||||||||||||||||
| 224 | suggested => "1.5", | ||||||||||||||||||||||||||||||
| 225 | cluster => 1, | ||||||||||||||||||||||||||||||
| 226 | }, | ||||||||||||||||||||||||||||||
| 227 | dvdxchap => { | ||||||||||||||||||||||||||||||
| 228 | order => ++$ORDER, | ||||||||||||||||||||||||||||||
| 229 | command => "dvdxchap", | ||||||||||||||||||||||||||||||
| 230 | comment => __ "For chapter progress bar (ogmtools)", | ||||||||||||||||||||||||||||||
| 231 | optional => 1, | ||||||||||||||||||||||||||||||
| 232 | version_cmd => "dvdxchap -V", | ||||||||||||||||||||||||||||||
| 233 | 1 | ▶ | get_version => sub { | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 234 | 1 | my ($cmd) = @_; | |||||||||||||||||||||||||||||
| 235 | 1 | qx[$cmd 2>&1] =~ /v(\d+\.\d+(\.\d+)?)/i; | |||||||||||||||||||||||||||||
| 236 | 1 | return $1; | |||||||||||||||||||||||||||||
| 237 | }, | ||||||||||||||||||||||||||||||
| 238 | convert => 'default', | ||||||||||||||||||||||||||||||
| 239 | min => "1.0.0", | ||||||||||||||||||||||||||||||
| 240 | suggested => "1.5", | ||||||||||||||||||||||||||||||
| 241 | }, | ||||||||||||||||||||||||||||||
| 242 | mjpegtools => { | ||||||||||||||||||||||||||||||
| 243 | order => ++$ORDER, | ||||||||||||||||||||||||||||||
| 244 | command => "mplex", | ||||||||||||||||||||||||||||||
| 245 | comment => __ "Needed for (S)VCD encoding", | ||||||||||||||||||||||||||||||
| 246 | optional => 1, | ||||||||||||||||||||||||||||||
| 247 | version_cmd => "mplex --help", | ||||||||||||||||||||||||||||||
| 248 | 1 | ▶ | get_version => sub { | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 249 | 1 | my ($cmd) = @_; | |||||||||||||||||||||||||||||
| 250 | 1 | qx[$cmd 2>&1] =~ /version\s+(\d+\.\d+(\.\d+)?)/i; | |||||||||||||||||||||||||||||
| 251 | 1 | return $1; | |||||||||||||||||||||||||||||
| 252 | }, | ||||||||||||||||||||||||||||||
| 253 | convert => 'default', | ||||||||||||||||||||||||||||||
| 254 | min => "1.6.0", | ||||||||||||||||||||||||||||||
| 255 | suggested => "1.6.2", | ||||||||||||||||||||||||||||||
| 256 | }, | ||||||||||||||||||||||||||||||
| 257 | xine => { | ||||||||||||||||||||||||||||||
| 258 | order => ++$ORDER, | ||||||||||||||||||||||||||||||
| 259 | command => "xine", | ||||||||||||||||||||||||||||||
| 260 | comment => __ "Can be used to view DVD's/files", | ||||||||||||||||||||||||||||||
| 261 | optional => 1, | ||||||||||||||||||||||||||||||
| 262 | version_cmd => "xine -version", | ||||||||||||||||||||||||||||||
| 263 | 1 | ▶ | get_version => sub { | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 264 | 1 | my ($cmd) = @_; | |||||||||||||||||||||||||||||
| 265 | 1 | qx[$cmd 2>&1] =~ /v(\d+\.\d+(\.\d+)?)/i; | |||||||||||||||||||||||||||||
| 266 | 1 | return $1; | |||||||||||||||||||||||||||||
| 267 | }, | ||||||||||||||||||||||||||||||
| 268 | convert => 'default', | ||||||||||||||||||||||||||||||
| 269 | min => "0.9.13", | ||||||||||||||||||||||||||||||
| 270 | suggested => "0.9.15", | ||||||||||||||||||||||||||||||
| 271 | }, | ||||||||||||||||||||||||||||||
| 272 | fping => { | ||||||||||||||||||||||||||||||
| 273 | order => ++$ORDER, | ||||||||||||||||||||||||||||||
| 274 | command => "fping", | ||||||||||||||||||||||||||||||
| 275 | comment => __ "Only for cluster mode master", | ||||||||||||||||||||||||||||||
| 276 | optional => 1, | ||||||||||||||||||||||||||||||
| 277 | version_cmd => "fping -v", | ||||||||||||||||||||||||||||||
| 278 | 1 | ▶ | get_version => sub { | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 279 | 1 | my ($cmd) = @_; | |||||||||||||||||||||||||||||
| 280 | 1 | qx[$cmd 2>&1] =~ /Version\s+(\d+\.\d+(\.\d+)?)/i; | |||||||||||||||||||||||||||||
| 281 | 1 | return $1; | |||||||||||||||||||||||||||||
| 282 | }, | ||||||||||||||||||||||||||||||
| 283 | convert => 'default', | ||||||||||||||||||||||||||||||
| 284 | min => "2.2", | ||||||||||||||||||||||||||||||
| 285 | suggested => "2.4", | ||||||||||||||||||||||||||||||
| 286 | }, | ||||||||||||||||||||||||||||||
| 287 | hal => { | ||||||||||||||||||||||||||||||
| 288 | order => ++$ORDER, | ||||||||||||||||||||||||||||||
| 289 | command => "lshal", | ||||||||||||||||||||||||||||||
| 290 | comment => __"Used for DVD device scanning", | ||||||||||||||||||||||||||||||
| 291 | optional => 1, | ||||||||||||||||||||||||||||||
| 292 | version_cmd => "lshal -v", | ||||||||||||||||||||||||||||||
| 293 | 1 | ▶ | get_version => sub { | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 294 | 1 | my ($cmd) = @_; | |||||||||||||||||||||||||||||
| 295 | 1 | qx[$cmd 2>&1] =~ /version\s+(\d+\.\d+(\.\d+)?)/i; | |||||||||||||||||||||||||||||
| 296 | 1 | return $1; | |||||||||||||||||||||||||||||
| 297 | }, | ||||||||||||||||||||||||||||||
| 298 | 1 | convert => 'default', | |||||||||||||||||||||||||||||
| 299 | min => "0.5", | ||||||||||||||||||||||||||||||
| 300 | suggested => "0.5.7", | ||||||||||||||||||||||||||||||
| 301 | }, | ||||||||||||||||||||||||||||||
| 302 | ); | ||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||
| 304 | 31 | ▶ | sub convert_default { | ||||||||||||||||||||||||||||
|
Subroutine
convert_default: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 305 | 31 | my ($ver) = @_; | |||||||||||||||||||||||||||||
| 306 | 31 | ▶ | return 990000 if $ver =~ /cvs|svn/i; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 307 | 31 | $ver =~ m/(\d+)(\.(\d+))?(\.(\d+))?(\.\d+)?/; | |||||||||||||||||||||||||||||
| 308 | 31 | $ver = $1 * 10000 + $3 * 100 + $5; | |||||||||||||||||||||||||||||
| 309 | 31 | ▶ | $ver = $ver - 1 + $6 if $6; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 310 | 31 | return $ver; | |||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | sub convert_none { | ||||||||||||||||||||||||||||
|
Subroutine
convert_none: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 314 | 0 | return $_[0]; | |||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||
| 317 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||||
|
Subroutine
new: called CC=17 SCAR=32.7
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 318 | 1 | my $class = shift; | |||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||
| 320 | 1 | ▶ | return $OBJECT if $OBJECT; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||
| 322 | 1 | my $OBJECT = bless {}, $class; | |||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||
| 324 | 1 | $OBJECT->load_tool_version_cache; | |||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||
| 326 | 1 | my $dependencies_ok = 1; | |||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||
| 328 | 1 | my ( $tool, $def ); | |||||||||||||||||||||||||||||
| 329 | 1 | ▶ | while ( ( $tool, $def ) = each %TOOLS ) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 330 | 15 | my $get_version = $def->{get_version}; | |||||||||||||||||||||||||||||
| 331 | 15 | my $convert = $def->{convert}; | |||||||||||||||||||||||||||||
| 332 | 15 | ▶ | if ( $convert eq 'default' ) { | ||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||
| 333 | 15 | $convert = \&convert_default; | |||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||
| 335 | elsif ( $convert eq 'none' ) { | ||||||||||||||||||||||||||||||
| 336 | 0 | $convert = \&convert_none; | |||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||
| 339 | 15 | ▶ | $DEBUG && print "[depend] $tool => "; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||
| 341 | my $version = $OBJECT->get_cached_version($def) | ||||||||||||||||||||||||||||||
| 342 | 15 | ▶ | || &$get_version($def->{version_cmd}); | ||||||||||||||||||||||||||||
|
Condition33%1/3
$OBJECT->get_cached_version($def) || &$get_version($def->{'version_cmd'})
MC/DC0%0/2
$OBJECT->get_cached_version($def) || &$get_version($def->{'version_cmd'})
$OBJECT->get_cached_version($def)
&$get_version($def->{'version_cmd'})
Truth table33%1/3
A || B
A= $OBJECT->get_cached_version($def)B= &$get_version($def->{'version_cmd'})
| |||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||
| 344 | 15 | ▶ | if ( $version ne '' ) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 345 | 0 | ▶ | $DEBUG && print "$version "; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 346 | 0 | $def->{installed} = $version; | |||||||||||||||||||||||||||||
| 347 | 0 | $def->{installed_num} = &$convert($version); | |||||||||||||||||||||||||||||
| 348 | 0 | ▶ | $DEBUG && print "=> $def->{installed_num}\n"; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||
| 350 | else { | ||||||||||||||||||||||||||||||
| 351 | 15 | ▶ | $DEBUG && print "NOT INSTALLED\n"; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 352 | 15 | $def->{installed} = __ "not installed"; | |||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||
| 355 | 15 | ▶ | $def->{max_num} = &$convert( $def->{max} ) if defined $def->{max}; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 356 | 15 | $def->{min_num} = &$convert( $def->{min} ); | |||||||||||||||||||||||||||||
| 357 | 15 | $def->{suggested_num} = &$convert( $def->{suggested} ); | |||||||||||||||||||||||||||||
| 358 | 15 | ▶ | $def->{installed_ok} = $def->{exists} && ($def->{installed_num} >= $def->{min_num}); | ||||||||||||||||||||||||||||
|
Condition66%2/3
$def->{'exists'} && $def->{'installed_num'} >= $def->{'min_num'}
MC/DC50%1/2
$def->{'exists'} && $def->{'installed_num'} >= $def->{'min_num'}
$def->{'exists'}
$def->{'installed_num'} >= $def->{'min_num'}
Truth table66%2/3
A && B
A= $def->{'exists'}B= $def->{'installed_num'} >= $def->{'min_num'}
| |||||||||||||||||||||||||||||||
| 359 | $def->{installed_ok} = 0 | ||||||||||||||||||||||||||||||
| 360 | if defined $def->{max} | ||||||||||||||||||||||||||||||
| 361 | 15 | ▶ | and $def->{installed_num} > $def->{max_num}; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $def->{"max"} and $def->{"installed_num"} > $def->{"max_num"}
MC/DC0%0/2
defined $def->{"max"} and $def->{"installed_num"} > $def->{"max_num"}
defined $def->{"max"}
$def->{"installed_num"} > $def->{"max_num"}
Truth table66%2/3
A and B
A= defined $def->{"max"}B= $def->{"installed_num"} > $def->{"max_num"}
| |||||||||||||||||||||||||||||||
| 362 | $dependencies_ok = 0 | ||||||||||||||||||||||||||||||
| 363 | if not $def->{optional} | ||||||||||||||||||||||||||||||
| 364 | 15 | ▶ | and not $def->{installed_ok}; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$def->{"optional"} or $def->{"installed_ok"}
MC/DC100%2/2
$def->{"optional"} or $def->{"installed_ok"}
$def->{"optional"}
$def->{"installed_ok"}
Truth table100%3/3
A or B
A= $def->{"optional"}B= $def->{"installed_ok"}
| |||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||
| 367 | 1 | $OBJECT->{ok} = $dependencies_ok; | |||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||
| 369 | 1 | $OBJECT->update_tool_version_cache; | |||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||
| 371 | 1 | return $OBJECT; | |||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||
| 374 | 1 | ▶ | sub load_tool_version_cache { | ||||||||||||||||||||||||||||
|
Subroutine
load_tool_version_cache: called CC=6 SCAR=32.7
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 375 | 1 | my $self = shift; | |||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||
| 377 | 1 | my $dir = "$ENV{HOME}/.dvdrip"; | |||||||||||||||||||||||||||||
| 378 | 1 | my $filename = "$dir/tool_version_cache"; | |||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||
| 380 | 1 | ▶ | return unless -f $filename; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||
| 382 | 0 | ▶ | open( IN, $filename ) or die "can't read $filename"; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | while (<IN>) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 384 | 0 | chomp; | |||||||||||||||||||||||||||||
| 385 | 0 | ▶ | if ( /LD_ASSUME_KERNEL=(.*)/ | ||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
/LD_ASSUME_KERNEL=(.*)/ and $1 ne $ENV{"LD_ASSUME_KERNEL"}
MC/DC0%0/2
/LD_ASSUME_KERNEL=(.*)/ and $1 ne $ENV{"LD_ASSUME_KERNEL"}
/LD_ASSUME_KERNEL=(.*)/
$1 ne $ENV{"LD_ASSUME_KERNEL"}
Truth table0%0/3
A and B
A= /LD_ASSUME_KERNEL=(.*)/B= $1 ne $ENV{"LD_ASSUME_KERNEL"}
| |||||||||||||||||||||||||||||||
| 386 | && $1 ne $ENV{LD_ASSUME_KERNEL} ) { | ||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||
| 388 | #-- discard cache if LD_ASSUME_KERNEL changed | ||||||||||||||||||||||||||||||
| 389 | #-- in the meantime | ||||||||||||||||||||||||||||||
| 390 | 0 | unlink $filename; | |||||||||||||||||||||||||||||
| 391 | 0 | last; | |||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||
| 393 | 0 | my ( $tool, $path, $mtime, $size, $version ) = split( /\t/, $_ ); | |||||||||||||||||||||||||||||
| 394 | 0 | my $def = $self->tools->{$tool}; | |||||||||||||||||||||||||||||
| 395 | 0 | $def->{path} = $path; | |||||||||||||||||||||||||||||
| 396 | 0 | $def->{mtime} = $mtime; | |||||||||||||||||||||||||||||
| 397 | 0 | $def->{size} = $size; | |||||||||||||||||||||||||||||
| 398 | 0 | $def->{cached_version} = $version; | |||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||
| 400 | 0 | close IN; | |||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||
| 402 | 0 | 1; | |||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||
| 405 | 1 | ▶ | sub update_tool_version_cache { | ||||||||||||||||||||||||||||
|
Subroutine
update_tool_version_cache: called CC=5 SCAR=16.4
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 406 | 1 | my $self = shift; | |||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||
| 408 | 1 | my $dir = "$ENV{HOME}/.dvdrip"; | |||||||||||||||||||||||||||||
| 409 | 1 | my $filename = "$dir/tool_version_cache"; | |||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||
| 411 | 1 | ▶ | mkdir $dir, 0755 or die "can't create $dir" if not -d $dir; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%2/4
-d $dir || (mkdir($dir, 493) || die("can't create $dir"))
mkdir $dir, 493 or die "can't create $dir"
MC/DC0%0/2
-d $dir || (mkdir($dir, 493) || die("can't create $dir"))
-d $dir
mkdir $dir, 493
Truth table33%1/3
A || B
A= -d $dirB= mkdir $dir, 493
| |||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||
| 413 | 1 | ▶ | open( OUT, ">$filename" ) or die "can't write $filename"; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 414 | 1 | print OUT "LD_ASSUME_KERNEL=$ENV{LD_ASSUME_KERNEL}\n"; | |||||||||||||||||||||||||||||
| 415 | 1 | ▶ | while ( my ( $tool, $def ) = each %{ $self->tools } ) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 416 | print OUT $tool . "\t" | ||||||||||||||||||||||||||||||
| 417 | . $def->{path} . "\t" | ||||||||||||||||||||||||||||||
| 418 | . $def->{mtime} . "\t" | ||||||||||||||||||||||||||||||
| 419 | . $def->{size} . "\t" | ||||||||||||||||||||||||||||||
| 420 | 15 | . $def->{installed} . "\n"; | |||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||
| 422 | 1 | close OUT; | |||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||
| 424 | 1 | 1; | |||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||
| 427 | 15 | ▶ | sub get_cached_version { | ||||||||||||||||||||||||||||
|
Subroutine
get_cached_version: called CC=7 SCAR=22.6
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 428 | 15 | my $self = shift; | |||||||||||||||||||||||||||||
| 429 | 15 | my ($tool_def) = @_; | |||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||
| 431 | 15 | ▶ | return if $tool_def->{dont_cache}; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||
| 433 | 14 | my $version = $tool_def->{cached_version}; | |||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||
| 435 | 14 | my $path = $self->get_full_path( $tool_def->{command} ); | |||||||||||||||||||||||||||||
| 436 | 14 | ▶ | if ( $path ne $tool_def->{path} ) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 437 | 0 | $tool_def->{path} = $path; | |||||||||||||||||||||||||||||
| 438 | 0 | $version = undef; | |||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||
| 441 | 14 | $tool_def->{exists} = $path ne ''; | |||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||
| 443 | 14 | my $size = -s $path; | |||||||||||||||||||||||||||||
| 444 | 14 | ▶ | if ( $size != $tool_def->{size} ) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 445 | 0 | $tool_def->{size} = $size; | |||||||||||||||||||||||||||||
| 446 | 0 | $version = undef; | |||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||
| 449 | 14 | my $mtime = ( stat $path )[9]; | |||||||||||||||||||||||||||||
| 450 | 14 | ▶ | if ( $mtime != $tool_def->{mtime} ) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 451 | 0 | $tool_def->{mtime} = $mtime; | |||||||||||||||||||||||||||||
| 452 | 0 | $version = undef; | |||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||
| 455 | #-- Don't cache the version number if the tool | ||||||||||||||||||||||||||||||
| 456 | #-- is found on the harddrive but cached as | ||||||||||||||||||||||||||||||
| 457 | #-- missing, otherwise dvd::rip doesn't check | ||||||||||||||||||||||||||||||
| 458 | #-- tools that crashed due to NPTL issues in | ||||||||||||||||||||||||||||||
| 459 | #-- the last run but the NPTL settings may have | ||||||||||||||||||||||||||||||
| 460 | #-- changed in the meantime. | ||||||||||||||||||||||||||||||
| 461 | 14 | ▶ | $version = undef if -x $path && $version eq 'missing'; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
-x $path and $version eq "missing"
MC/DC0%0/2
-x $path and $version eq "missing"
-x $path
$version eq "missing"
Truth table33%1/3
A and B
A= -x $pathB= $version eq "missing"
| |||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||
| 463 | 14 | return $version; | |||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||
| 466 | 21 | ▶ | sub get_full_path { | ||||||||||||||||||||||||||||
|
Subroutine
get_full_path: called CC=6 SCAR=18.1
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 467 | 21 | my $self = shift, my ($file) = @_; | |||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||
| 469 | 21 | ▶ | return $file if $file =~ m!^/!; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||
| 471 | 21 | ▶ | if ( not -x $file ) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 472 | 21 | foreach my $p ( split( /:/, $ENV{PATH} ) ) { | |||||||||||||||||||||||||||||
| 473 | 168 | ▶ | $file = "$p/$file", last if -x "$p/$file"; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||
| 477 | 21 | ▶ | return $file if -x $file; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 478 | 14 | return; | |||||||||||||||||||||||||||||
| 479 | } | ||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||
| 481 | 0 | ▶ | sub ok { shift->{ok} } | ||||||||||||||||||||||||||||
|
Subroutine
ok: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 482 | 16 | ▶ | sub tools { \%TOOLS } | ||||||||||||||||||||||||||||
|
Subroutine
tools: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||
| 484 | 1 | ▶ | sub has { | ||||||||||||||||||||||||||||
|
Subroutine
has: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 485 | 1 | my $self = shift; | |||||||||||||||||||||||||||||
| 486 | 1 | my ($command) = @_; | |||||||||||||||||||||||||||||
| 487 | 1 | ▶ | return 0 if not exists $TOOLS{$command}; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 488 | 1 | return $TOOLS{$command}->{installed_ok}; | |||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||
| 491 | 0 | ▶ | sub exists { | ||||||||||||||||||||||||||||
|
Subroutine
exists: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 492 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 493 | 0 | my ($command) = @_; | |||||||||||||||||||||||||||||
| 494 | 0 | ▶ | return 0 if not exists $TOOLS{$command}; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 495 | 0 | return $TOOLS{$command}->{exists}; | |||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||
| 498 | 1 | ▶ | sub version { | ||||||||||||||||||||||||||||
|
Subroutine
version: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 499 | 1 | my $self = shift; | |||||||||||||||||||||||||||||
| 500 | 1 | my ($command) = @_; | |||||||||||||||||||||||||||||
| 501 | 1 | ▶ | return if not exists $TOOLS{$command}; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 502 | 1 | return $TOOLS{$command}->{installed_num}; | |||||||||||||||||||||||||||||
| 503 | } | ||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||
| 505 | 0 | ▶ | sub gen_depend_table { | ||||||||||||||||||||||||||||
|
Subroutine
gen_depend_table: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 506 | 0 | my $tools = \%TOOLS; | |||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||
| 508 | 0 | print <<__EOF; | |||||||||||||||||||||||||||||
| 509 | <table border="1" cellpadding="4" cellspacing="1"> | ||||||||||||||||||||||||||||||
| 510 | <tr class="tablehead"> | ||||||||||||||||||||||||||||||
| 511 | <td><b>Tool</b></td> | ||||||||||||||||||||||||||||||
| 512 | <td><b>Comment</b></td> | ||||||||||||||||||||||||||||||
| 513 | <td><b>Mandatory</b></td> | ||||||||||||||||||||||||||||||
| 514 | <td><b>Suggested</b></td> | ||||||||||||||||||||||||||||||
| 515 | <td><b>Minimum</b></td> | ||||||||||||||||||||||||||||||
| 516 | <td><b>Maximum</b></td> | ||||||||||||||||||||||||||||||
| 517 | </tr> | ||||||||||||||||||||||||||||||
| 518 | __EOF | ||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||
| 520 | 0 | foreach my $tool ( | |||||||||||||||||||||||||||||
| 521 | 0 | sort { $tools->{$a}->{order} <=> $tools->{$b}->{order} } | |||||||||||||||||||||||||||||
| 522 | 0 | keys %{$tools} | |||||||||||||||||||||||||||||
| 523 | ) { | ||||||||||||||||||||||||||||||
| 524 | 0 | ▶ | next if $tool eq 'dvd::rip'; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 525 | 0 | my $def = $tools->{$tool}; | |||||||||||||||||||||||||||||
| 526 | 0 | ▶ | $def->{max} ||= "-"; | ||||||||||||||||||||||||||||
|
Condition0%0/2
$def->{"max"} ||= "-"
MC/DC0%0/1
$def->{"max"} ||= "-"
$def->{"max"}
Truth table0%0/2
A
A= $def->{"max"}
| |||||||||||||||||||||||||||||||
| 527 | 0 | ▶ | $def->{mandatory} = !$def->{optional} ? "Yes" : "No"; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 528 | 0 | print <<__EOF; | |||||||||||||||||||||||||||||
| 529 | <tr> | ||||||||||||||||||||||||||||||
| 530 | <td valign="top">$tool</td> | ||||||||||||||||||||||||||||||
| 531 | <td valign="top">$def->{comment}</td> | ||||||||||||||||||||||||||||||
| 532 | <td valign="top">$def->{mandatory}</td> | ||||||||||||||||||||||||||||||
| 533 | <td valign="top">$def->{suggested}</td> | ||||||||||||||||||||||||||||||
| 534 | <td valign="top">$def->{min}</td> | ||||||||||||||||||||||||||||||
| 535 | <td valign="top">$def->{max}</td> | ||||||||||||||||||||||||||||||
| 536 | </tr> | ||||||||||||||||||||||||||||||
| 537 | __EOF | ||||||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||
| 540 | 0 | print "</table>\n"; | |||||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||
| 543 | 0 | ▶ | sub installed_tools_as_text { | ||||||||||||||||||||||||||||
|
Subroutine
installed_tools_as_text: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 544 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||
| 546 | 0 | my $tools = \%TOOLS; | |||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||
| 548 | 0 | my $format = " %-20s %-10s\n"; | |||||||||||||||||||||||||||||
| 549 | 0 | my $text = "\n" . sprintf( $format, __ "Program", __ "Version" ); | |||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||
| 551 | 0 | $text .= " " . ( "-" x 31 ) . "\n"; | |||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||||
| 553 | 0 | foreach my $tool ( | |||||||||||||||||||||||||||||
| 554 | 0 | sort { $tools->{$a}->{order} <=> $tools->{$b}->{order} } | |||||||||||||||||||||||||||||
| 555 | 0 | keys %{$tools} | |||||||||||||||||||||||||||||
| 556 | ) { | ||||||||||||||||||||||||||||||
| 557 | 0 | my $def = $tools->{$tool}; | |||||||||||||||||||||||||||||
| 558 | 0 | $text .= sprintf( $format, $tool, $def->{installed} ); | |||||||||||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||
| 561 | 0 | $text .= " " . ( "-" x 31 ) . "\n"; | |||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||
| 563 | 0 | return $text; | |||||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||
| 566 | 1 | 1; | |||||||||||||||||||||||||||||