Summarize(3pm)

πŸ“¦
version 1.4.0 Β· 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– Summarize(3pm) β€” XMLTV::Summarize πŸ’–

okay bestie, gather round, because this is the Summarize page from the User Contributed Perl Documentation and it's literally about turning your chaotic pile of TV data into something a human can actually read. no cap.


✨ NAME ✨

XMLTV::Summarize β€” a Perl extension that summarizes XMLTV data. that's the whole vibe. it takes your XMLTV mess and makes it cute and readable. periodt.


🌸 SYNOPSIS 🌸

first you gotta get some data from the XMLTV module, like so:

# First get some data from the XMLTV module, eg:
use XMLTV;
my $data = XMLTV::parsefile('tv_sorted.xml');
my ($encoding, $credits, $ch, $progs) = @$data;

then β€” and this is the slay part β€” you turn those sorted programmes into a printable summary:

# Now turn the sorted programmes into a printable summary.
use XMLTV::Summarize qw(summarize);
foreach (summarize($ch, $progs)) {
    if (not ref) {
        print "\nDay: $_\n\n";
    }
    else {
        my ($start, $stop, $title, $sub_title, $channel) = @$_;
        print "programme starts at $start, ";
        print "stops at $stop, " if defined $stop;
        print "has title $title ";
        print "and episode title $sub_title" if defined $sub_title;
        print ", on channel $channel.\n";
    }
}

see how the non-ref entries are just day headers and the array-ref entries are the actual programme info? it's giving organized. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so what does this module even do? it processes programme and channel data coming from the XMLTV module, and its whole job is helping you produce a human-readable summary or TV guide. it's the friend who takes your 47 open tabs and makes them into a nice little list.

it also handles two things you'd otherwise have to think about:

  • choosing the correct language (based on the LANG environment variable), and
  • looking up the name of channels from their id.

no manual labour required, we love to see it. 🫢

there is exactly one public routine, and its name is summarize(). it takes (references to) a channels hash and a programmes list β€” same format as the ones the XMLTV module hands back to you. what does it give you? a list of 'summary' elements, where each element is a list of five items:

  1. start time
  2. stop time
  3. title
  4. 'sub-title'
  5. channel name
heads up bestie: the stop time and the sub-title may be undef. so check before you print, or you'll be out here printing warnings like it's a personality trait. 😭

the times get formatted as hh:mm, with a timezone appended whenever the timezone changes in the middle of the listings β€” because timezone jumps mid-listing are real and we respect them.

for the titles and the channel name, the module picks the shortest string that's in an acceptable language. shortest, acceptable, iconic. ✨

now, the list of acceptable languages normally contains just one element, taken from LANG. but if you wanna be the main character and set it yourself, you absolutely can, by assigning to @XMLTV::Summarize::PREF_LANGS. do with that what you will. πŸ’œ


πŸ‘‘ AUTHOR πŸ‘‘

Ed Avis, ed@membled.com β€” the legend behind it all.


🌈 SEE ALSO 🌈

  • XMLTV(1).

and that's the whole page, bestie. this doc is from perl v5.40.1, dated 2025-04-19, and it was cooked up as part of the User Contributed Perl Documentation. go forth and summarize. πŸŽ€

πŸ“¦ where this page comes from