/usr/bin/tv_cat 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 | #!/usr/bin/perl -w
eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
if 0; # not running under some shell
=pod
=head1 NAME
tv_cat - Concatenate XMLTV listings files.
=head1 SYNOPSIS
tv_cat [--help] [--utf8] [--output FILE] [FILE...]
=head1 DESCRIPTION
Read one or more XMLTV files and write a file to standard output whose
programmes are the concatenation of the programmes in the input files,
and whose channels are the union of the channels in the input files.
B<--output FILE> write to FILE rather than standard output
The treatment of programmes and channels is slightly different because
for programmes, the ordering is important (typically programmes are
processed or displayed in the same order as they appear in the input)
whereas channels are just a set indexed by channel id. There is a
warning if channel details clash for the same id.
One more wrinkle is the credits (source, generator and so on), they
are taken from one of the files and then thereE<39>s a warning if the
other files differ. If two input files have different character
encodings, then it is not meaningful to combine their data (without
recoding or other processing) and tv_cat die with an error message.
But if you do want to combine multiple input files with different
character encodings then you can use the --utf8 command-line parameter
which will create a combined output file in UTF-8 format. (Note: it is
not safe to combine mixed encodings to anything other than UTF-8 so no
other output encoding is provided for.) (Note 2: any input file which
does not have an encoding specified in the xml tag is not only naughty
but is assumed to already be UTF-8, which may not be true!)
This tool is rather useless, but it makes a good testbed for the XMLTV
module.
=head1 SEE ALSO
L<xmltv(5)>.
=head1 AUTHOR
Ed Avis, ed@membled.com
=cut
use strict;
use XMLTV::Version '$Id: tv_cat,v 1.20 2015/06/23 20:05:25 knowledgejunkie Exp $ ';
use Getopt::Long;
# 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;
use XMLTV::Usage <<END
$0: concatenate listings, merging channels, (optional: utf-8 output file)
usage: $0 [--help] [--utf8] [--output FILE] [FILE...]
END
;
my ($opt_help, $opt_output, $opt_utf8);
GetOptions('help' => \$opt_help, 'output=s' => \$opt_output, 'utf8' => \$opt_utf8) or usage(0);
usage(1) if $opt_help;
@ARGV = ('-') if not @ARGV;
my %w_args = ();
if (defined $opt_output) {
my $fh = new IO::File ">$opt_output";
die "cannot write to $opt_output\n" if not $fh;
%w_args = (OUTPUT => $fh);
}
if (defined $opt_utf8) {
$w_args{'UTF8'} = 1;
}
XMLTV::catfiles(\%w_args, @ARGV);
|