Updates and a bug fix for make_shownotes
Community_News/.make_shownotes.cfg: more comments Community_News/make_email: added colour test for pod2usage Community_News/make_shownotes: fixed a bug when using -lastrecording=DATETIME. Added reporting of expanded output file names; tidying and updates to POD documentation. Community_News/recording_dates.dat: added test entry for May 2025
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
# VERSION: 0.4.4
|
||||
# ORIGINAL: 2014-04-24 16:08:30
|
||||
# CREATED: 2025-03-13 15:07:35
|
||||
# REVISION: 2025-04-01 21:29:10
|
||||
# REVISION: 2025-04-15 23:36:56
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
@@ -305,6 +305,9 @@ if (defined($lastrecording)) {
|
||||
emit( $silent, "Last recording from option: ", $lastrecording, "\n" );
|
||||
_debug( $DEBUG > 1, '$lastrecording = ' . $lastrecording );
|
||||
|
||||
# Compute the last month, with a date
|
||||
@dc_lm = find_last_month(\@review_month);
|
||||
|
||||
@dc_lr = parse_to_dc( $lastrecording, \@deftime );
|
||||
_debug( $DEBUG > 1, '@dc_lr = ' . Dumper( \@dc_lr ) );
|
||||
}
|
||||
@@ -417,7 +420,8 @@ else {
|
||||
"Error: episode $episode already exists in the database\n");
|
||||
|
||||
if ($h1->{title} eq $title) {
|
||||
say "(Episode $episode is an old-style place-holder. Continuing)";
|
||||
emit( $silent,
|
||||
"(Episode $episode is an old-style place-holder. Continuing)\n");
|
||||
}
|
||||
else {
|
||||
die "Trying to overwrite an existing show. Aborting\n";
|
||||
@@ -451,7 +455,7 @@ for my $file (
|
||||
)
|
||||
)
|
||||
{
|
||||
emit( $silent, sprintf( "* %-100s *\n", "» $file" ) );
|
||||
emit( $silent, sprintf( "* %-100s *\n", "> $file" ) );
|
||||
}
|
||||
|
||||
emit($silent,"\n");
|
||||
@@ -487,6 +491,8 @@ emit(
|
||||
)
|
||||
) if $t_time;
|
||||
|
||||
emit($silent,"\n");
|
||||
|
||||
#
|
||||
# Report what we have in the 'lastrecording' and 'lastmonth' variables
|
||||
#
|
||||
@@ -913,10 +919,17 @@ if ($html_outfile || $json_outfile) {
|
||||
# Settings for creating the HTML fragment
|
||||
#
|
||||
if ($html_outfile) {
|
||||
$outfh = make_filename_and_open($html_outfile,
|
||||
#
|
||||
# We get the file handle and the expanded filename
|
||||
#
|
||||
($outfh,$html_outfile) = make_filename_and_open($html_outfile,
|
||||
sprintf( "%d-%02d", $dt_som->year, $dt_som->month ));
|
||||
}
|
||||
|
||||
#
|
||||
# We generate the HTML fragment whether we're to write it or not, since
|
||||
# it's needed for making JSON
|
||||
#
|
||||
my $vars = {
|
||||
review_month => $dt_som->month_name,
|
||||
review_year => $dt_som->year,
|
||||
@@ -951,13 +964,18 @@ if ($html_outfile || $json_outfile) {
|
||||
if ($html_outfile) {
|
||||
print $outfh $document;
|
||||
close($outfh);
|
||||
|
||||
#
|
||||
# Report the output file
|
||||
#
|
||||
emit($silent,"HTML is in $html_outfile\n");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Create the JSON if requested
|
||||
#-------------------------------------------------------------------------------
|
||||
if ($json_outfile) {
|
||||
$outfh = make_filename_and_open($json_outfile,
|
||||
($outfh, $json_outfile) = make_filename_and_open($json_outfile,
|
||||
sprintf( "%d-%02d", $dt_som->year, $dt_som->month ));
|
||||
|
||||
#
|
||||
@@ -1005,6 +1023,11 @@ if ($html_outfile || $json_outfile) {
|
||||
my $json = JSON->new->utf8;
|
||||
say $outfh $json->encode(\%json_data);
|
||||
|
||||
#
|
||||
# Report the output file
|
||||
#
|
||||
emit($silent,"JSON is in $json_outfile\n");
|
||||
|
||||
$sth1->finish;
|
||||
|
||||
}
|
||||
@@ -1015,10 +1038,12 @@ if ($html_outfile || $json_outfile) {
|
||||
# standalone.
|
||||
#-------------------------------------------------------------------------------
|
||||
if ($full_html_outfile) {
|
||||
my $outfh;
|
||||
|
||||
#
|
||||
# Settings for creating the standalone HTML
|
||||
#
|
||||
my $outfh = make_filename_and_open($full_html_outfile,
|
||||
($outfh,$full_html_outfile) = make_filename_and_open($full_html_outfile,
|
||||
sprintf( "%d-%02d", $dt_som->year, $dt_som->month ));
|
||||
|
||||
my $vars = {
|
||||
@@ -1061,6 +1086,11 @@ if ($full_html_outfile) {
|
||||
|| die $tt->error(), "\n";
|
||||
|
||||
print $outfh $full_document;
|
||||
|
||||
#
|
||||
# Report the output file
|
||||
#
|
||||
emit($silent,"Full HTML is in $full_html_outfile\n");
|
||||
}
|
||||
|
||||
$dbh->disconnect;
|
||||
@@ -1600,7 +1630,7 @@ sub ISO8601_Date {
|
||||
# the file for output
|
||||
# PARAMETERS: $filename Name of file with or without '%s'
|
||||
# $subs String to substitute for '%s'
|
||||
# RETURNS: File handle
|
||||
# RETURNS: A list containing the file handle and the expanded filename
|
||||
# DESCRIPTION:
|
||||
# THROWS: No exceptions
|
||||
# COMMENTS: None
|
||||
@@ -1618,7 +1648,7 @@ sub make_filename_and_open {
|
||||
open( $outfh, ">:encoding(UTF-8)", $filename )
|
||||
or croak "Unable to open $filename for writing: $!";
|
||||
|
||||
return $outfh;
|
||||
return ($outfh,$filename);
|
||||
}
|
||||
|
||||
#=== FUNCTION ================================================================
|
||||
@@ -1959,8 +1989,6 @@ Reports the following (as well as the data for level 1):
|
||||
|
||||
=over 4
|
||||
|
||||
=item .
|
||||
|
||||
Details of the last recording data (and time)
|
||||
|
||||
=back
|
||||
@@ -1971,8 +1999,6 @@ Reports the following (as well as the data for level 2):
|
||||
|
||||
=over 4
|
||||
|
||||
=item .
|
||||
|
||||
The generation of comment indexes needed in the comment lists. These are
|
||||
computed after the query has been run.
|
||||
|
||||
@@ -1987,26 +2013,16 @@ Reports the following (as well as the data for level 3):
|
||||
|
||||
=over 4
|
||||
|
||||
=item .
|
||||
|
||||
A dump of the '%past' hash which contains details of comments on past shows.
|
||||
|
||||
=item .
|
||||
|
||||
A dump of the '%current' hash which contains details of comments on this
|
||||
month's shows.
|
||||
|
||||
=item .
|
||||
|
||||
A dump of the '@missed_comments' array containing comments that arrived after
|
||||
the last recording.
|
||||
|
||||
=item .
|
||||
|
||||
A list of the duplicated episode numbers in '@missed_episodes'
|
||||
|
||||
=item .
|
||||
|
||||
Another dump of '%past' after it has been cleaned up. Also the count of
|
||||
comments to past shows and the comment count.
|
||||
|
||||
@@ -2076,22 +2092,22 @@ Four types of information are collected by the script:
|
||||
|
||||
=over 4
|
||||
|
||||
=item -
|
||||
=item B<Host details>
|
||||
|
||||
Details of new hosts who have released new shows in the selected month
|
||||
|
||||
=item -
|
||||
=item B<Show details>
|
||||
|
||||
Details of shows which have been released in the selected month
|
||||
|
||||
=item -
|
||||
=item B<Comments>
|
||||
|
||||
Comments which have been submitted to the HPR website in the selected month.
|
||||
These need to be related to shows in the current period or in the past.
|
||||
Comments made about shows which have not yet been released (but are visible on
|
||||
the website) are not included even though they are made in the current month.
|
||||
|
||||
=item -
|
||||
=item B<Mailing list threads>
|
||||
|
||||
A link to the current threads on the mailing list in the past month can be included. This
|
||||
is done by default but can be skipped if the B<-nomailnotes> option is used.
|
||||
@@ -2137,7 +2153,7 @@ If you wish to write your own template refer to the following lists for the
|
||||
names of items. Also refer to the default template B<shownote_template.tpl>
|
||||
for the techniques used there. (Note that B<shownote_template.tpl> is a soft
|
||||
link to the current default template, such as B<shownote_template12.tpl>, the
|
||||
link name is currently used in the configuration file).
|
||||
soft link name is currently used in the configuration file).
|
||||
|
||||
The hash and field names available to the template are as follows
|
||||
|
||||
@@ -2359,52 +2375,54 @@ The configuration file contains the following settings, which are explained
|
||||
at the end.
|
||||
|
||||
#
|
||||
# .make_shownotes.cfg (2025-03-27)
|
||||
# .make_shownotes.cfg (2025-04-13)
|
||||
# Configuration file for make_shownotes version >= 4
|
||||
#
|
||||
<settings>
|
||||
# Format strings (using 'printf' formatting) for building certain required strings
|
||||
title_template = HPR Community News for %s %s
|
||||
summary_template = HPR Volunteers talk about shows released and comments posted in %s %s
|
||||
|
||||
# Repeat the following line with each of the desired tags to make an
|
||||
# array-like structure
|
||||
tags = Community News
|
||||
|
||||
|
||||
# Host id for HPR Volunteers
|
||||
# Series id for HPR Community News series
|
||||
hostid = 159
|
||||
series_id = 47
|
||||
|
||||
|
||||
# Day the Community News show is released
|
||||
releaseday = Monday
|
||||
|
||||
|
||||
# Default day of the week for the recording
|
||||
recordingday = Friday
|
||||
|
||||
|
||||
# Recording times are UTC
|
||||
starttime = 16:00:00
|
||||
endtime = 17:00:00
|
||||
|
||||
|
||||
# cache of previous recording dates and times
|
||||
cache = recording_dates.dat
|
||||
|
||||
# Templates
|
||||
# ---------
|
||||
|
||||
|
||||
# Template Toolkit templates
|
||||
# --------------------------
|
||||
|
||||
# Main note template (actually a soft link)
|
||||
main_template = shownote_template.tpl
|
||||
|
||||
|
||||
# Used to make a stand-alone HTML file from the default HTML
|
||||
# fragment
|
||||
container_template = shownotes_container.tpl
|
||||
|
||||
|
||||
</settings>
|
||||
|
||||
|
||||
<database>
|
||||
# Assume a local file
|
||||
name = hpr.db
|
||||
</database>
|
||||
|
||||
=head2 Details
|
||||
=head2 Configuration file details
|
||||
|
||||
If any mandatory elements are omitted from the configuration file they are
|
||||
given default values in the script.
|
||||
|
Reference in New Issue
Block a user