Merge pull request 'Setting up static RSS feeds' (#196) from 140_2_Convert_the_RSS_feeds_from_php_to_the_static_site into main

Reviewed-on: rho_n/hpr_generator#196
This commit is contained in:
Ken Fallon 2024-05-23 19:38:58 +00:00
commit a61f2a5222
5 changed files with 34 additions and 23 deletions

View File

@ -67,18 +67,21 @@ Perl Template Toolkit.
- GRANT EXECUTE ON `hpr_hpr`.* TO 'hpr-generator'@'localhost';
Install the needed Perl modules using preferred method (distribution packages, CPAN, etc.)
* GetOpt
* Pod::Usage
* Config::Std
* Template
* Template::Plugin::File
* Template::Plugin::DBI
* Template::Plugin::HTML::Strip
* DBI
* Tie::DBI
* DBD::SQLite or DBD:mysql
* DBI
* Data::Dumper
* Date::Calc
* GetOpt::Long
* HTML::Entities
* Pod::Usage
* Template
* Template::Plugin::DBI
* Template::Plugin::Date
* Template::Plugin::File
* Template::Plugin::HTML::Strip
* Text::CSV_XS
* Tie::DBI
=head1 AUTHOR
@ -115,7 +118,8 @@ use Getopt::Long qw(:config auto_help);
use Pod::Usage;
use Config::Std;
use Text::CSV_XS;
use HTML::Entities qw(encode_entities_numeric);
#use HTML::Entities qw(encode_entities_numeric);
use HTML::Entities qw(encode_entities);
use Date::Calc;
use DBI;
use DBD::SQLite;
@ -425,7 +429,8 @@ sub parse_csv {
sub xml_entity {
my ($text) = @_;
encode_entities_numeric( $text );
# encode_entities_numeric( $text );
encode_entities( $text );
return $text;
}

View File

@ -29,6 +29,7 @@ content: page.tpl.html
#baseurl: OPTIONAL [i.e. file://<full path to local website directory>]
#baseurl: file:///home/roan/Development/hpr/website/hpr_generator/public_html/
baseurl: https://hackerpublicradio.org/
http_baseurl: http://hackerpublicradio.org/
hub_baseurl: https://hub.hackerpublicradio.org/
media_baseurl: https://archive.org/download/hpr$eps_id/
generator_name: The HPR Robot

View File

@ -2,8 +2,8 @@
<!--% PROCESS 'shared-utils.tpl.html' %-->
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0"
xmlns:googleplay="https://www.google.com/schemas/play-podcasts/1.0"
xmlns:atom="https://www.w3.org/2005/Atom"
xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" >
<channel>
<title>Hacker Public Radio</title>
@ -17,7 +17,7 @@
<itunes:category text="Education">
<itunes:category text="Training"/>
</itunes:category>
<itunes:image href="<!--% absolute_url(baseurl) %-->images/hpr_feed_itunes.png"/>
<itunes:image href="<!--% absolute_url(http_baseurl) %-->images/hpr_feed_itunes.png"/>
<itunes:explicit>yes</itunes:explicit>
<itunes:author>Hacker Public Radio</itunes:author>
<itunes:keywords>Community Radio, Tech Interviews, Linux, Open, Hobby, Software Freedom</itunes:keywords>
@ -30,7 +30,7 @@
</itunes:owner>
<webMaster>admin@hackerpublicradio.org (HPR Volunteer)</webMaster>
<generator>site-generator</generator>
<docs>https://www.rssboard.org/rss-specification</docs>
<docs>http://www.rssboard.org/rss-specification</docs>
<ttl>43200</ttl>
<skipDays>
<day>Saturday</day>
@ -47,9 +47,9 @@
<googleplay:author>HPR Volunteer</googleplay:author>
<googleplay:description>Hacker Public Radio is a podcast that releases shows every weekday Monday through Friday. Our shows are produced by the community (you) and can be on any topic that is of interest to hackers and hobbyists.</googleplay:description>
<googleplay:email>admin@hackerpublicradio.org</googleplay:email>
<googleplay:image href="<!--% absolute_url(baseurl) %-->images/hpr_feed_itunes.png"/>
<googleplay:image href="<!--% absolute_url(http_baseurl) %-->images/hpr_feed_itunes.png"/>
<googleplay:category text="Technology"/>
<atom:link href="<!--% absolute_url(baseurl) %--><!--% filename %-->" rel="self" type="application/rss+xml" />
<atom:link href="<!--% absolute_url(http_baseurl) %--><!--% filename %-->" rel="self" type="application/rss+xml" />
<pubDate><!--% format_feed_date(date.now) %--></pubDate>
<!--% INCLUDE $content %-->

View File

@ -1,24 +1,25 @@
<!--% PROCESS 'shared-utils.tpl.html' %-->
<!--% MACRO display_item(episode, file_extension, audio_mime_type) BLOCK %-->
<!--% USE HTML.Strip %-->
<!--% USE HTML.Strip emit_spaces = 0 %-->
<!--% IF audio_mime_type == "" %-->
<!--% audio_mime_type = 'ogg' %-->
<!--% END %-->
<item>
<itunes:explicit><!--% display_explicit_feed(episode.explicit) %--></itunes:explicit>
<googleplay:explicit><!--% display_explicit_feed(episode.explicit) %--></googleplay:explicit>
<title>HPR<!--% zero_pad_left(episode.id) %-->: <!--% episode.title %--></title>
<googleplay:explicit><!--% display_explicit_feed_2(episode.explicit) %--></googleplay:explicit>
<title>HPR<!--% zero_pad_left(episode.id) %-->: <!--% episode.title | html_strip | xml_entity %--></title>
<author><!--% episode.email %--> (<!--% episode.host %-->)</author>
<googleplay:author><!--% episode.email %--> (<!--% episode.host %-->)</googleplay:author>
<itunes:author><!--% episode.email %--> (<!--% episode.host %-->)</itunes:author>
<googleplay:image href="<!--% absolute_url(baseurl) %-->images/hpr_feed_itunes.png"/>
<googleplay:image href="<!--% absolute_url(http_baseurl) %-->images/hpr_feed_itunes.png"/>
<link><!--% absolute_url(baseurl) %-->eps/hpr<!--% zero_pad_left(episode.id) %-->/index.html</link>
<description><![CDATA[<!--% episode.notes %-->]]>
</description>
<itunes:summary><![CDATA[<!--% episode.notes.substr(0, 4000) | html_strip | xml_entity %-->]]>
</itunes:summary>
<pubDate><!--% format_feed_date(episode.date) %--></pubDate>
<enclosure url="<!--% baseurl %-->eps/hpr<!--% zero_pad_left(episode.id) %-->.<!--% file_extension %-->" length="<!--% episode.length %-->" type="audio/<!--% audio_mime_type %-->"/>
<guid><!--% baseurl %-->eps/hpr<!--% zero_pad_left(episode.id) %-->.<!--% file_extension %--></guid>
<enclosure url="<!--% http_baseurl %-->eps/hpr<!--% zero_pad_left(episode.id) %-->.<!--% file_extension %-->" length="<!--% episode.length %-->" type="audio/<!--% audio_mime_type %-->"/>
<guid><!--% http_baseurl %-->eps/hpr<!--% zero_pad_left(episode.id) %-->.<!--% file_extension %--></guid>
</item>
<!--% END %-->

View File

@ -35,6 +35,10 @@
<!--% display_choice(is_explicit, 'yes', 'no') %-->
<!--% END %-->
<!--% MACRO display_explicit_feed_2(is_explicit) BLOCK %-->
<!--% display_choice(is_explicit, 'Yes', 'No') %-->
<!--% END %-->
<!--% MACRO format_feed_date(date_to_format) BLOCK %-->
<!--% USE feed_date = date(format = '%a, %d %b %Y %H:%M:%S +0000', gmt=1) %-->
<!--% feed_date.format(date_to_format) %-->