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: #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'; - GRANT EXECUTE ON `hpr_hpr`.* TO 'hpr-generator'@'localhost';
Install the needed Perl modules using preferred method (distribution packages, CPAN, etc.) Install the needed Perl modules using preferred method (distribution packages, CPAN, etc.)
* GetOpt
* Pod::Usage
* Config::Std * Config::Std
* Template
* Template::Plugin::File
* Template::Plugin::DBI
* Template::Plugin::HTML::Strip
* DBI
* Tie::DBI
* DBD::SQLite or DBD:mysql * DBD::SQLite or DBD:mysql
* DBI
* Data::Dumper
* Date::Calc * 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 * Text::CSV_XS
* Tie::DBI
=head1 AUTHOR =head1 AUTHOR
@ -115,7 +118,8 @@ use Getopt::Long qw(:config auto_help);
use Pod::Usage; use Pod::Usage;
use Config::Std; use Config::Std;
use Text::CSV_XS; 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 Date::Calc;
use DBI; use DBI;
use DBD::SQLite; use DBD::SQLite;
@ -425,7 +429,8 @@ sub parse_csv {
sub xml_entity { sub xml_entity {
my ($text) = @_; my ($text) = @_;
encode_entities_numeric( $text ); # encode_entities_numeric( $text );
encode_entities( $text );
return $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: OPTIONAL [i.e. file://<full path to local website directory>]
#baseurl: file:///home/roan/Development/hpr/website/hpr_generator/public_html/ #baseurl: file:///home/roan/Development/hpr/website/hpr_generator/public_html/
baseurl: https://hackerpublicradio.org/ baseurl: https://hackerpublicradio.org/
http_baseurl: http://hackerpublicradio.org/
hub_baseurl: https://hub.hackerpublicradio.org/ hub_baseurl: https://hub.hackerpublicradio.org/
media_baseurl: https://archive.org/download/hpr$eps_id/ media_baseurl: https://archive.org/download/hpr$eps_id/
generator_name: The HPR Robot generator_name: The HPR Robot

View File

@ -2,8 +2,8 @@
<!--% PROCESS 'shared-utils.tpl.html' %--> <!--% PROCESS 'shared-utils.tpl.html' %-->
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" <rss version="2.0"
xmlns:googleplay="https://www.google.com/schemas/play-podcasts/1.0" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"
xmlns:atom="https://www.w3.org/2005/Atom" xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" > xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" >
<channel> <channel>
<title>Hacker Public Radio</title> <title>Hacker Public Radio</title>
@ -17,7 +17,7 @@
<itunes:category text="Education"> <itunes:category text="Education">
<itunes:category text="Training"/> <itunes:category text="Training"/>
</itunes:category> </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:explicit>yes</itunes:explicit>
<itunes:author>Hacker Public Radio</itunes:author> <itunes:author>Hacker Public Radio</itunes:author>
<itunes:keywords>Community Radio, Tech Interviews, Linux, Open, Hobby, Software Freedom</itunes:keywords> <itunes:keywords>Community Radio, Tech Interviews, Linux, Open, Hobby, Software Freedom</itunes:keywords>
@ -30,7 +30,7 @@
</itunes:owner> </itunes:owner>
<webMaster>admin@hackerpublicradio.org (HPR Volunteer)</webMaster> <webMaster>admin@hackerpublicradio.org (HPR Volunteer)</webMaster>
<generator>site-generator</generator> <generator>site-generator</generator>
<docs>https://www.rssboard.org/rss-specification</docs> <docs>http://www.rssboard.org/rss-specification</docs>
<ttl>43200</ttl> <ttl>43200</ttl>
<skipDays> <skipDays>
<day>Saturday</day> <day>Saturday</day>
@ -47,9 +47,9 @@
<googleplay:author>HPR Volunteer</googleplay:author> <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: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: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"/> <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> <pubDate><!--% format_feed_date(date.now) %--></pubDate>
<!--% INCLUDE $content %--> <!--% INCLUDE $content %-->

View File

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

View File

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