From: Ed A. <ep...@us...> - 2003-07-20 16:23:28
|
Update of /cvsroot/xmltv/xmltv/grab/fi In directory sc8-pr-cvs1:/tmp/cvs-serv23882/fi Modified Files: tv_grab_fi Log Message: Changed grabbers to use XMLTV::Ask::askManyBooleanQuestions() for handling 'none' and 'all' answers. Index: tv_grab_fi =================================================================== RCS file: /cvsroot/xmltv/xmltv/grab/fi/tv_grab_fi,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tv_grab_fi 19 Jul 2003 16:15:54 -0000 1.22 --- tv_grab_fi 20 Jul 2003 16:22:26 -0000 1.23 *************** *** 171,203 **** if ($mode eq 'configure') { open(CONF, ">$config_file") or die "cannot write to $config_file: $!"; - my $answer; - my $answer_all; ! foreach my $ch_did (sort(keys %channels)) { ! my $ch_name = $channels{$ch_did}; ! if ($answer_all) { ! print($answer eq 'yes' ? 'adding' : 'ignoring', ! " new channel $ch_name\n"); ! } ! else { ! $answer=askQuestion("add channel $ch_name?", 'yes', ! 'yes', 'no', 'all', 'none'); ! if ($answer eq 'all') { ! $answer_all=1; ! $answer='yes'; ! } ! elsif ($answer eq 'none') { ! $answer_all=1; ! $answer='no'; ! } ! } ! ! if ($answer eq 'yes') { ! print CONF "channel $ch_did $ch_name\n"; ! } ! else { ! print CONF "# channel $ch_did $ch_name\n"; ! } } close CONF or warn "cannot close $config_file: $!"; print "All done, run with no arguments to grab listings.\n"; --- 171,193 ---- if ($mode eq 'configure') { open(CONF, ">$config_file") or die "cannot write to $config_file: $!"; ! # Ask about each channel. ! my @chs = sort keys %channels; ! my @names = map { $channels{$_} } @chs; ! my @qs = map { "add channel $_?" } @names; ! my @want = askManyBooleanQuestions(1, @qs); ! foreach (@chs) { ! my $w = shift @want; ! warn("cannot read input, stopping channel questions"), last ! if not defined $w; ! # No need to print to user - XMLTV::Ask is verbose enough. ! ! # Print a config line, but comment it out if channel not wanted. ! print CONF '#' if not $w; ! my $name = shift @names; ! print CONF "channel $_ $name\n"; ! # TODO don't store display-name in config file. } + close CONF or warn "cannot close $config_file: $!"; print "All done, run with no arguments to grab listings.\n"; |