Updates prior to the handover to SGOTI

.make_email.cfg: New configuration file to simplify the original options
    to 'make_email'

.make_shownotes.cfg:  New configuration file to simplify the original
    extremely obscure options to 'make_shownotes'

collect_HPR_database: Script to simplify the collection and setup
    of MySQL dumps from the HPR server and conversion to a SQLite
    database.

make_email: Many changes to make the script simpler to use. It looks for
    all files in the same directory as the script. Reduced the number of
    options and added a new configuration file. Now reads and writes
    a date cache file (defined in the configuration file) where it
    writes the date and time of the next recording. Now uses a local
    SQLite database rather than linking to the live HPR database (more
    secure). Takes an output file name (with optional '%s'). Functions
    for loading and updating the date cache (also used by
    'make_shownotes'). Doesn't attempt to generate a real mail message,
    just something that can be cut and pasted into a mail client.

make_email_template.tpl: TT2 template for generating the mail message.
    This whole function was moved from the script itself to this
    templating system, making it all a lot simpler.

make_meeting: Minor updates. This script is probably obsolete.

make_shownotes: Almost totally rewritten. It looks for all files in the
    same directory as the script. Reduced the number of options and
    added a new configuration file. Now reads a date cache
    file (defined in the configuration file) where 'make_email' has
    written the date and time of the next recording. Now generates
    output files rather than writing to the live HPR database. These
    files can be added to the database on the 'hub' using existing
    workflow(s). One of the files generated is a stand-alone full HTML file
    for circulation to volunteers recording the show. The others are the
    HTML snippet to add to the database, and a JSON version for use in
    the hub workflow. The full HTML gets the expanded comments and
    contains markers of comments already read or missed last month. This
    version computes the episode number and date which will be used to
    post the resulting show (previously reserved slots were searched for
    in the database). The extremely complex query that collects comments
    has been thoroughly tested and enhanced and seems to be reliable.
    Dropped the "Any Other Business" section (and all code relating to
    it in the script and the template).

shownote_template.tpl: Soft link to the latest template. Doing this
    needs consideration given that the configuration file could just
    reference the appropriate file. This technique may just be
    a nuisance.

shownote_template11.tpl: Previous template, updated for the last release
    of 'make_shownotes'. Now replaced.

shownote_template12.tpl: New template without AOB capability.
This commit is contained in:
Dave Morriss
2025-03-31 21:59:14 +01:00
parent ee4a174233
commit a83e945c08
11 changed files with 2405 additions and 1407 deletions

View File

@@ -1,11 +1,15 @@
[%# shownote_template11.tpl 2024-05-07 -%]
[%# HTML snippet for insertion into the database -%]
[%# This one uses the new format for the mailing list data, and partitions -%]
[%# comments into past and current. It also marks comments that don't need -%]
[%# to be read when -markcomments is selected. It requires make_shownotes >= V0.0.30 -%]
[%# shownote_template11.tpl Updated: 2025-03-31 -%]
[%# -------------------------------------------------------------------------------- -%]
[%# Makes either an HTML snippet for insertion into the database or a full -%]
[%# listing with full comments for circulation to the hosts recording the episode -%]
[%# This one uses the new format for the mailing list data, and partitions -%]
[%# comments into past and current. It also marks comments that don't need -%]
[%# to be read when mark_comments is true. It requires make_shownotes >= V0.0.30 -%]
[%# -------------------------------------------------------------------------------- -%]
[%- USE date -%]
[%- USE pad4 = format('%04d') -%]
[%- correspondents = "https://hackerpublicradio.org/correspondents"
mailinglist = "https://lists.hackerpublicradio.com/mailman/listinfo/hpr"
mailbase="https://lists.hackerpublicradio.com/pipermail/hpr"
mailthreads = "$mailbase/$review_year-$review_month/thread.html" -%]
[%- DEFAULT skip_comments = 0
@@ -15,8 +19,9 @@
missed_count = 0
past_count = 0
-%]
[%# Embedded CSS. The 'table' and 'hr' settings are always there but the rest is only for if -%]
[%# we are marking comments -%]
[%# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -%]
[%# Embedded CSS. The 'table' and 'hr' settings are always there but the rest is -%]
[%# only for when we are marking comments -%]
<style>
table td.shrink {
white-space:nowrap
@@ -40,12 +45,7 @@ div#highlight {
}
[%- END %]
</style>
[%# For the '-mailnotes' option without a file we generate our own inclusion. -%]
[%# We pretend 'default_mail' is a filename in the calling script. Messy. -%]
[% BLOCK default_mail -%]
<a href="[% mailthreads %]" target="_blank">[% mailthreads %]</a>
[% END -%]
[%# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -%]
<h2>New hosts</h2>
<p>
[% IF hosts.size > 0 -%]
@@ -88,13 +88,13 @@ There were no new hosts this month.
[%# Skip comments if told to by the caller -%]
[%- IF skip_comments == 0 -%]
[%# Handle any missed comments if mark_comments is true -%]
[%- IF mark_comments == 1 && missed_count > 0 -%]
[%- IF (mark_comments == 1) AND (missed_count > 0) -%]
<br/><div id="highlight">
<h2>Missed comment[%- missed_comments.size > 1 ? 's' : '' -%] last month</h2>
<p><b>Note to Volunteers</b>: These are comments for shows last month that were not read in the last show because they arrived on or after the recording day. This section will be removed before these notes are released.</p>
<p><b>Note to Volunteers</b>: These are comments for shows last month that were not read in the last show because they arrived on or after the recording started. This section will be removed before these notes are released.</p>
<ul>
[%- FOREACH comment IN missed_comments -%]
<li><strong><a href="[% comment.identifier_url %]#comments" target="_blank">hpr[% comment.episode %]</a></strong>
<li><strong><a href="[% comment.identifier_url %]#comments" target="_blank">hpr[% pad4(comment.episode) %]</a></strong>
([% comment.date %]) "<em>[% comment.title %]</em>" by <a href="[% correspondents %]/[% pad4(comment.hostid) %].html" target="_blank">[% comment.host %]</a>.<br/>
<small>Summary: "<em>[% comment.summary %]</em>"</small><br/>
From: [% comment.comment_author_name FILTER html_entity -%] on [% date.format(comment.comment_timestamp_ut,'%Y-%m-%d','UTC') -%]:
@@ -112,7 +112,7 @@ From: [% comment.comment_author_name FILTER html_entity -%] on [% date.format(co
<h2>Comments this month</h2>
[% IF comment_count > 0 -%]
[%- IF mark_comments == 1 && ignore_count > 0 -%]
[%- IF (mark_comments == 1) AND (ignore_count > 0) -%]
<p id="ignore"><b>Note to Volunteers</b>: Comments marked in green were read in the last
Community News show and should be ignored in this one.</p>
[%- END -%]
@@ -124,9 +124,9 @@ There [%- comment_count == 1 ? "is $comment_count comment" : "are $comment_count
[% past.size %] previous [% past.size == 1 ? "show" : "shows" %]:</p>
<ul>
[%# Loop through by episode then by comment relating to that episode -%]
[%- FOREACH ep IN past.keys.sort -%]
[%- FOREACH ep IN past.keys.nsort -%]
[%- arr = past.$ep -%]
<li><strong><a href="[% arr.0.identifier_url %]#comments" target="_blank">hpr[% arr.0.episode %]</a></strong>
<li><strong><a href="[% arr.0.identifier_url %]#comments" target="_blank">hpr[% pad4(arr.0.episode) %]</a></strong>
([% arr.0.date %]) "<em>[% arr.0.title %]</em>"
by <a href="[% correspondents %]/[% pad4(arr.0.hostid) %].html" target="_blank">[% arr.0.host %]</a>.<br/>
[%- IF mark_comments == 1 || ctext == 1 -%]
@@ -142,7 +142,7 @@ by <a href="[% correspondents %]/[% pad4(arr.0.hostid) %].html" target="_blank">
[%- ELSE %]
<li>
[%- END %]
<a href="[% row.identifier_url %]#[% row.index %]" target="_blank">Comment [% row.index %]</a>:
<a href="[% row.identifier_url %]#comment_[% row.comment_id %]" target="_blank">Comment [% row.comment_number %]</a>:
[% row.comment_author_name FILTER html_entity -%] on [% date.format(row.comment_timestamp_ut,'%Y-%m-%d','UTC') -%]:
[%- IF row.comment_title.length > 0 %]
"[% row.comment_title %]"
@@ -158,7 +158,7 @@ by <a href="[% correspondents %]/[% pad4(arr.0.hostid) %].html" target="_blank">
[%- END -%]
[%- END -%]
</ul><br/>
</limage>
</li>
[%- END -%]
</ul>
[%- IF mark_comments == 1 || ctext == 1 -%]
@@ -171,15 +171,15 @@ by <a href="[% correspondents %]/[% pad4(arr.0.hostid) %].html" target="_blank">
<h3>This month's shows</h3>
<p>There [% cc == 1 ? "is $cc comment" : "are $cc comments" %] on [% current.size %] of this month's shows:</p>
<ul>
[%- FOREACH ep IN current.keys.sort -%]
[%- FOREACH ep IN current.keys.nsort -%]
[%- arr = current.$ep -%]
<li><strong><a href="[% arr.0.identifier_url %]#comments" target="_blank">hpr[% arr.0.episode %]</a></strong>
<li><strong><a href="[% arr.0.identifier_url %]#comments" target="_blank">hpr[% pad4(arr.0.episode) %]</a></strong>
([% arr.0.date %]) "<em>[% arr.0.title %]</em>"
by <a href="[% correspondents %]/[% pad4(arr.0.hostid) %].html" target="_blank">[% arr.0.host %]</a>.</li>
<li style="list-style: none; display: inline">
<ul>
[%- FOREACH row IN arr -%]
<li><a href="[% row.identifier_url %]#[% row.index %]" target="_blank">Comment [% row.index %]</a>:
<li><a href="[% row.identifier_url %]#comment_[% row.comment_id %]" target="_blank">Comment [% row.comment_number %]</a>:
[% row.comment_author_name FILTER html_entity -%] on [% date.format(row.comment_timestamp_ut,'%Y-%m-%d','UTC') -%]:
[%- IF row.comment_title.length > 0 %]
"[% row.comment_title %]"
@@ -199,17 +199,16 @@ There were no comments this month.
[%- END %]
[%# ---------------------------------------------------------------------------------------- -%]
[%- IF includefile.defined -%]
[%- IF mailnotes == 1 -%]
<h2>Mailing List discussions</h2>
<p>
Policy decisions surrounding HPR are taken by the community as a whole. This
discussion takes place on the <a href="https://hackerpublicradio.org/maillist"
target="_blank">Mail List</a> which is open to all HPR listeners and
contributors. The discussions are open and available on the HPR server under
<a href="[% mailbase %]">Mailman</a>.
discussion takes place on the <a href="[% mailinglist %]" target="_blank">Mailing List</a>
which is open to all HPR listeners and contributors. The discussions are open
and available on the HPR server under <a href="[% mailbase %]">Mailman</a>.
</p>
<p>The threaded discussions this month can be found here:</p>
[% INCLUDE $includefile -%]
<a href="[% mailthreads %]" target="_blank">[% mailthreads %]</a>
[%- END %]
[%# ---------------------------------------------------------------------------------------- -%]
@@ -231,4 +230,3 @@ page.</blockquote>
[%#
# vim: syntax=tt2:ts=8:sw=4:ai:et:tw=78:fo=tcrqn21
-%]