XMLTV::Lineup(3) Perl extension to read and write TV lineup information in XMLTV lineup format

Handlers for <channel>

display-name, with-lang, +
icon, icon, *
homepage-url, scalar, ?
old-id, scalar, *
preferred-preset, scalar, ?
service-id, scalar, ?
transport-id, scalar, ?
network-id, scalar, ?
freq-number, scalar, ?
freq-hertz, scalar, ?
iptv-addr, scalar, ?
multicast-addr, scalar, ?
multicast-port, scalar, ?
preset, scalar, ?

WRITING

When writing data: the "write_data()" routine prints a whole XMLTV::Lineup document at once, but if you want to write a XMLTV::Lineup document incrementally you can manually create an "XMLTV::Lineup::Writer" object and call methods on it. Synopsis:

  use XMLTV::Lineup;
  my $w = new XMLTV::Lineup::Writer();
  $w->comment("Hello from XML::Writer's comment() method");
  $w->start({ 'generator-info-name' => 'Example code in pod' });
  my %ch = (id => 'test-channel', 'display-name' => [ [ 'Test', 'en' ] ]);
  $w->write_channel(\%ch);
  $w->end();

XMLTV::Lineup::Writer inherits from XML::Writer, and provides the following extra or overridden methods:

new(), the constructor
Creates an XMLTV::Lineup::Writer object and starts writing a XMLTV::Lineup file, printing the DOCTYPE line. Arguments are passed on to XML::Writer's constructor, except for the following:

the 'encoding' key if present gives the XML character encoding. For example:

  my $w = new XMLTV::Lineup::Writer(encoding => 'ISO-8859-1');

If encoding is not specified, XML::Writer's default is used (currently UTF-8).

start()
Write the start of the <xmltv-lineup> element. Parameter is a hashref which gives the attributes of this element.

Attributes are 'type', 'id' and 'version'

write_display_name()
Write a display name element. These are written before channel elements in the XML file.
write_lineup_icon()
Write an icon for the lineup. This is written before channel elements in the XML file.
write_channels()
Write several channels at once. Parameter is a reference to a hash mapping channel id to channel details. They will be written sorted by id, which is reasonable since the order of channels in an XMLTV file isn't significant.
write_channel()
Write a single channel. You can call this routine if you want, but most of the time "write_channels()" is a better interface.
end()
This ends the <xmltv-lineup> element and the file.

AUTHOR

Nick Morrott, [email protected]

This file borrows _very_ heavily from XMLTV.pm.in by Ed Avis.

TODO

Write the DTD xmltv-lineup.dtd

COPYRIGHT

Copyright (C) 2009 Nick Morrott

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.