Initial implementation of HPR RSS feeds template

Add templates and macros to create main HPR OGG feed.
This commit is contained in:
Roan Horning 2022-08-17 17:12:47 -04:00
parent 582f155ca1
commit 162d8c6703
Signed by: rho_n
GPG Key ID: 234AEF20B72D5769
5 changed files with 109 additions and 0 deletions

View File

@ -131,3 +131,8 @@ content: content-promote.tpl.html
[sitemap]
navigation: navigation-about.tpl.html
content: content-sitemap.tpl.html
[hpr_ogg]
root_template: rss.tpl.xml
content: rss-hpr_ogg.tpl.xml
filename: hpr_ogg.rss

View File

@ -0,0 +1,5 @@
<!--% PROCESS 'shared-item.tpl.xml' %-->
<!--% PROCESS 'rss-query-hpr.tpl.xml' %-->
<!--% FOREACH episode IN feed_result %-->
<!--% display_item(episode, 'ogg') %-->
<!--% END %-->

View File

@ -0,0 +1,23 @@
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% query_hpr_feed = DBI.prepare('
SELECT
eps.id,
eps.explicit,
strftime(\'%H:%M:%S %d:%m:%Y\', date(eps.date)) AS date,
eps.license, eps.duration,
eps.title, eps.summary, eps.tags,
eps.notes,
hosts.local_image,
hosts.hostid,
hosts.host, hosts.email,
miniseries.name AS series, miniseries.id AS seriesid
FROM eps
INNER JOIN hosts ON eps.hostid = hosts.hostid
INNER JOIN miniseries ON eps.series = miniseries.id
WHERE eps.date < date(\'now\', \'+1 days\')
ORDER BY eps.date DESC
LIMIT 10
')
%-->
<!--% feed_result = query_hpr_feed.execute() %-->

56
templates/rss.tpl.xml Normal file
View File

@ -0,0 +1,56 @@
<!--% PROCESS 'shared-utils.tpl.html' %-->
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0"
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>
<link>https://www.hackerpublicradio.org/about.html</link>
<itunes:subtitle>A daily show hosted the community on topics that are of interest to hackers and hobbyists.</itunes:subtitle>
<description>Hacker Public Radio is an podcast that releases shows every weekday Monday through Friday. Our shows are produced by the community (you) and can be on any topic that are of interest to hackers and hobbyists.</description>
<language>en-us</language>
<itunes:category text="Technology">
<itunes:category text="Tech News"/>
</itunes:category>
<itunes:category text="Education">
<itunes:category text="Training"/>
</itunes:category>
<itunes:image href="https://www.hackerpublicradio.org/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>
<copyright>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) License</copyright>
<managingEditor>feedback@NOSPAM-hackerpublicradio.org (HPR Feedback)</managingEditor>
<!-- <author>feedback@NOSPAM-hackerpublicradio.org (HPR Feedback)</author> -->
<itunes:owner>
<itunes:name>HPR Volunteer</itunes:name>
<itunes:email>admin@hackerpublicradio.org</itunes:email>
</itunes:owner>
<webMaster>admin@hackerpublicradio.org (HPR Volunteer)</webMaster>
<generator>site-generator</generator>
<docs>http://www.rssboard.org/rss-specification</docs>
<ttl>43200</ttl>
<skipDays>
<day>Saturday</day>
<day>Sunday</day>
</skipDays>
<image>
<url>https://www.hackerpublicradio.org/images/hpr_feed_small.png</url>
<title>Hacker Public Radio</title>
<link>https://www.hackerpublicradio.org/about.php</link>
<description>The Hacker Public Radio Old Microphone Logo</description>
<height>164</height>
<width>144</width>
</image>
<googleplay:author>HPR Volunteer</googleplay:author>
<googleplay:description>Hacker Public Radio is an podcast that releases shows every weekday Monday through Friday. Our shows are produced by the community (you) and can be on any topic that are of interest to hackers and hobbyists.</googleplay:description>
<googleplay:email>admin@hackerpublicradio.org</googleplay:email>
<googleplay:image href="https://www.hackerpublicradio.org/images/hpr_feed_itunes.png"/>
<googleplay:category text="Technology"/>
<atom:link href="https://www.hackerpublicradio.org/<!--% filename %-->" rel="self" type="application/rss+xml" />
<pubDate><!--% format_feed_date(date.now) %--></pubDate>
<!--% INCLUDE $content %-->
</channel>
</rss>

View File

@ -0,0 +1,20 @@
<!--% PROCESS 'shared-utils.tpl.html' %-->
<!--% MACRO display_item(episode, media_type) BLOCK %-->
<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>
<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="https://www.hackerpublicradio.org/images/hpr_feed_itunes.png"/>
<link>https://www.hackerpublicradio.org/eps/hpr/<!--% zero_pad_left(episode.id) %-->/index.html</link>
<description><![CDATA[<!--% episode.notes %-->]]>
</description>
<itunes:summary><![CDATA[<!--% episode.notes %-->]]>
</itunes:summary>
<pubDate><!--% format_feed_date(episode.date) %--></pubDate>
<enclosure url="http://hackerpublicradio.org/eps/hpr<!--% zero_pad_left(episode.id) %-->.<!--% media_type %-->" length="<!--% episode.duration * 1000 %-->" type="audio/<!--% media_type %-->"/>
<guid>http://hackerpublicradio.org/eps/hpr<!--% zero_pad_left(episode.id) %-->.<!--% media_type %--></guid>
</item>
<!--% END %-->