XMLTV::Lineup(3pm)

XMLTV::Lineup3pm

Perl extension to read and write tv lineup information in xmltv lineup format

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.

Todo

Write the DTD xmltv-lineup.dtd

Author

Nick Morrott, [email protected]

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

From libxmltv-perl 0.5.59-1 in Debian 6.0 (Squeeze). Parsed by carta from the page's man source.