This file is indexed.

/usr/bin/tv_to_text is in xmltv-util 0.5.67-0.1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/perl -w

eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
    if 0; # not running under some shell

=pod

=head1 NAME

tv_to_text - Convert XMLTV listings to text.

=head1 SYNOPSIS

tv_to_text [--help] [--with-desc] [--output FILE] [FILE...]

=head1 DESCRIPTION

Read XMLTV data and output a summary of listings.  The programme titles,
subtitles, times and channels are shown.

B<--with-desc> include programme description in output

B<--output FILE> write to FILE rather than standard output

=head1 SEE ALSO

L<xmltv(5)>.

=head1 AUTHOR

Ed Avis, ed@membled.com

=cut

use strict;
use warnings;
use XMLTV::Version '$Id: tv_to_text,v 1.8 2015/06/08 17:41:14 stefanb2 Exp $ ';
use IO::File;
use Date::Manip;
use POSIX 'tmpnam';
use Getopt::Long;

BEGIN {
    if (int(Date::Manip::DateManipVersion) >= 6) {
	Date::Manip::Date_Init("SetDate=now,UTC");
    } else {
	Date::Manip::Date_Init("TZ=UTC");
    }
}

# Use Log::TraceMessages if installed.
BEGIN {
    eval { require Log::TraceMessages };
    if ($@) {
	*t = sub {};
	*d = sub { '' };
    }
    else {
	*t = \&Log::TraceMessages::t;
	*d = \&Log::TraceMessages::d;
	Log::TraceMessages::check_argv();
    }
}

use XMLTV qw(best_name);
use XMLTV::Summarize qw(summarize);
use XMLTV::Usage <<END
$0: convert listings to plain text
usage: $0 [--help] [--with-desc] [--output FILE] [FILE...]
END
;

my ($opt_help, $opt_output, $opt_withdesc);
GetOptions('help' => \$opt_help, 'output=s' => \$opt_output, 'with-desc' => \$opt_withdesc) or usage(0);
usage(1) if $opt_help;
@ARGV = ('-') if not @ARGV;
if (defined $opt_output) {
    open(STDOUT, ">$opt_output")
      or die "cannot write to $opt_output: $!";
}
$opt_withdesc = 0 if !defined $opt_withdesc;

# FIXME maybe memoize some stuff here

my ($encoding, $credits, $ch, $progs) = @{XMLTV::parsefiles(@ARGV)};
my $wrote_prog = 0;
foreach (summarize($ch, $progs)) {
    if (not ref) {
	print "\n" if $wrote_prog;
	print "$_\n\n";
	next;
    }
    my ($start, $stop, $title, $sub_title, $channel, $desc) = @$_;
    $stop = '' if not defined $stop;
    $title .= " // $sub_title" if defined $sub_title;
    print "$start--$stop\t$title\t$channel". ( $opt_withdesc && defined $desc ? "\t$desc" : '' ) . "\n";
    $wrote_prog = 1;
}

# Acknowledgements
my $g = $credits->{'generator-info-name'};
$g =~ s!/(\d)! $1! if defined $g;
my $s = $credits->{'source-info-name'};
if (not defined $g and not defined $s) {
    # No acknowledgement since unknown source.
}
elsif (not defined $g and defined $s) {
    print "\nGenerated from $s.\n";
}
elsif (defined $g and not defined $s) {
    print "\nGenerated by $g.\n";
}
elsif (defined $g and defined $s) {
    print "\nGenerated from $s by $g.\n";
}
else { die }