From: Ed A. <ep...@us...> - 2003-08-28 20:57:06
|
Update of /cvsroot/xmltv/xmltv/grab/uk_rt In directory sc8-pr-cvs1:/tmp/cvs-serv19589/grab/uk_rt Modified Files: tv_grab_uk_rt.in Log Message: Applying Andy Balaam's patch for Tk configuration in environments that support it (with a few changes). XMLTV::Ask now has two implementations, AskTerm and AskTk, and chooses one based on whether Tk is usable. The grabbers need to use the XMLTV::Ask routines exclusively when they want to communicate with the user; in particular this means the new say() routine rather than print(). I haven't tested the Tk configuration half yet. Index: tv_grab_uk_rt.in =================================================================== RCS file: /cvsroot/xmltv/xmltv/grab/uk_rt/tv_grab_uk_rt.in,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** tv_grab_uk_rt.in 19 Jul 2003 16:15:59 -0000 1.29 --- tv_grab_uk_rt.in 28 Aug 2003 20:56:59 -0000 1.30 *************** *** 259,265 **** my %write_channels; # to be written as <channel> elements ! print STDERR "finding channels:\t" unless $opt_quiet; my %channels = get_channels(); ! print STDERR "done.\n" unless $opt_quiet; # Read the configuration file. At present the lines must be one --- 259,265 ---- my %write_channels; # to be written as <channel> elements ! say("finding channels:\t") unless $opt_quiet; my %channels = get_channels(); ! say("done.\n") unless $opt_quiet; # Read the configuration file. At present the lines must be one *************** *** 289,293 **** } ! print STDERR "getting dates for which listings available:\t" unless $opt_quiet; my @available_dates = get_available_dates(); --- 289,293 ---- } ! say("getting dates for which listings available:\t") unless $opt_quiet; my @available_dates = get_available_dates(); *************** *** 295,299 **** die 'apparently, there are no days of listings on the site' if not @available_dates; ! print STDERR "done.\n" unless $opt_quiet; my $is_available = sub( $ ) { --- 295,299 ---- die 'apparently, there are no days of listings on the site' if not @available_dates; ! say("done.\n") unless $opt_quiet; my $is_available = sub( $ ) { *************** *** 327,331 **** } my $days = @dates_to_get > 1 ? 'days' : 'day'; ! print STDERR 'getting ' . (scalar @dates_to_get) . " $days of listings\n" unless $opt_quiet; t 'getting dates:' . d \@dates_to_get; --- 327,331 ---- } my $days = @dates_to_get > 1 ? 'days' : 'day'; ! say('getting ' . (scalar @dates_to_get) . " $days of listings\n") unless $opt_quiet; t 'getting dates:' . d \@dates_to_get; *************** *** 342,348 **** if ($GET_CATEGORIES) { # Find all the categories ! print STDERR "finding categories:\t" unless $opt_quiet; %categories = get_categories(); ! print STDERR "done.\n" unless $opt_quiet; } --- 342,348 ---- if ($GET_CATEGORIES) { # Find all the categories ! say("finding categories:\t") unless $opt_quiet; %categories = get_categories(); ! say("done.\n") unless $opt_quiet; } *************** *** 370,379 **** my $name = XMLTV::best_name([ $LANG ], $dn)->[0]; $name = $chan if not defined $name; ! print STDERR 'time ', UnixDate($time, '%q'), ", channel $name:\t" unless $opt_quiet; push @new_programmes, get_programmes($chan, $time, \%prog_to_cat, \%categories, \%channels); - print STDERR "\n" unless $opt_quiet; } --- 370,378 ---- my $name = XMLTV::best_name([ $LANG ], $dn)->[0]; $name = $chan if not defined $name; ! say('time '.UnixDate($time, '%q').", channel $name:\t") unless $opt_quiet; push @new_programmes, get_programmes($chan, $time, \%prog_to_cat, \%categories, \%channels); } *************** *** 384,392 **** if (@new_programmes) { if ($GET_CATEGORIES) { ! print STDERR "finding the categories at $time:\t" unless $opt_quiet; %prog_to_cat = get_progs_in_cat([ sort keys %write_channels ], $time, \%categories); ! print STDERR "done.\n" unless $opt_quiet; } } --- 383,391 ---- if (@new_programmes) { if ($GET_CATEGORIES) { ! say("finding the categories at $time:\t") unless $opt_quiet; %prog_to_cat = get_progs_in_cat([ sort keys %write_channels ], $time, \%categories); ! say("done.\n") unless $opt_quiet; } } *************** *** 1353,1365 **** # local $Log::TraceMessages::On = 1; ! print <<END Warning: this grabber requires a large number of page fetches from a human-readable website. It is normally better to run tv_grab_uk, which has its own data source. END ! ; ! if (not askBooleanQuestion('Proceed with configuration?', 0)) { ! print "Exiting.\n"; exit 0; } --- 1352,1364 ---- # local $Log::TraceMessages::On = 1; ! if (not askBooleanQuestion( <<END Warning: this grabber requires a large number of page fetches from a human-readable website. It is normally better to run tv_grab_uk, which has its own data source. + Proceed with configuration? END ! , 0)) { ! say("Exiting.\n"); exit 0; } *************** *** 1367,1373 **** XMLTV::Config_file::check_no_overwrite($config_file); ! print STDERR "finding channels:\t"; my %channels = get_channels(); ! print STDERR "done.\n"; # FIXME need to make directory --- 1366,1372 ---- XMLTV::Config_file::check_no_overwrite($config_file); ! say("finding channels:\t"); my %channels = get_channels(); ! say("done.\n"); # FIXME need to make directory *************** *** 1378,1383 **** # For now we just let the user pick among the 'standard' channels. for (;;) { ! print "Enter the name of a channel, or '.' to finish: "; ! my $in = <STDIN>; $in =~ s/^\s+//; $in =~ s/\s+$//; last if $in eq '.'; --- 1377,1384 ---- # For now we just let the user pick among the 'standard' channels. for (;;) { ! my $in = ask(<<END ! Enter the name of a channel, or '.' to finish selecting channels: ! END ! ); $in =~ s/^\s+//; $in =~ s/\s+$//; last if $in eq '.'; *************** *** 1404,1408 **** # if (@poss == 0) { ! print "No channel matching that.\n"; } elsif (@poss == 1) { --- 1405,1409 ---- # if (@poss == 0) { ! say("There is no channel called '$in'."); } elsif (@poss == 1) { *************** *** 1437,1441 **** } elsif (25 <= @poss) { ! print "'$in' matches lots of channels, be more specific.\n"; } else { die } --- 1438,1442 ---- } elsif (25 <= @poss) { ! say("'$in' matches lots of channels, be more specific."); } else { die } *************** *** 1443,1447 **** close CONF or warn "cannot close $config_file: $!"; ! print "All done, run with no arguments to grab a fortnight's listings.\n"; exit(); } --- 1444,1448 ---- close CONF or warn "cannot close $config_file: $!"; ! say("Finished configuration."); exit(); } |