From 1dcbd983b554e2a21f9ec062f17580a8901943a5 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Fri, 8 Apr 2005 14:54:00 +0000 Subject: More heuristics to figure out the CD / DVD number from its name, used for the copy of media to the local HD. --- perl-install/install_any.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index e1b2f4e2d..079005901 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -85,13 +85,19 @@ sub askChangeMedium($$) { $allow; } -#- guess the CD number from a media description +#- guess the CD number from a media description. +#- XXX lots of heuristics here, must design this properly sub getCDNumber { my ($description) = @_; (my $cd) = $description =~ /\b(?:CD|DVD) ?(\d+)\b/i; + if (!$cd) { #- test for single unnumbered DVD + $cd = 1 if $description =~ /\bDVD\b/i; + } if (!$cd) { #- test for mini-ISO $cd = 1 if $description =~ /\bmini.?cd\b/i; } + #- don't mix suppl. cds with regular ones + if ($description =~ /suppl/i) { $cd += 100 } $cd; } -- cgit v1.2.1