<h1 id="mastodon-as-a-way-to-comment-to-hpr-episodes">Mastodon as a way
to comment to HPR episodes</h1>
<h2 id="prompted-by-knightwise">Prompted by Knightwise</h2>
<ul>
<li>I should be easier for listeners to discuss shows.</li>
<li>There have been several times I have intended to leave a comment on
a show, but I forget by the time I get back to my PC</li>
<li>Mastodon is made for community interaction.</li>
<li>If you are active on mastodon, replying to a mastodon post is
probably easier than the HPR comment form.</li>
</ul>
<h2 id="hpr-bot">HPR Bot</h2>
<ul>
<li>HPR has a mastodon bot that makes a post when a new show is
released</li>
<li>The Bot's post and replies can be used as a comment system for
HPR</li>
<li>https://botsin.space/<span class="citation"
data-cites="hpr">@hpr</span></li>
</ul>
<h2 id="easy-methods-to-including-mastodon-on-a-static-page">Easy
Methods to including Mastodon on a static page</h2>
<ul>
<li>Each post has an embed link, but it does not include replies.</li>
<li>JavaScript can be used to display the post and replies
<ul>
<li>Example
https://carlschwan.eu/2020/12/29/adding-comments-to-your-static-blog-with-mastodon/</li>
<li>Carl Schwan - KDE developer</li>
</ul></li>
<li>Neither of these is ideal</li>
</ul>
<h2 id="mastodon-api">Mastodon API</h2>
<ul>
<li>Mastodon has an API that can be used to pull a list of status
updates.</li>
<li>The comments can be pulled from the API and added to the static
site.</li>
</ul>
<h2 id="proof-of-concept">Proof of concept</h2>
<ul>
<li>HPR site using RSS feeds as the data source</li>
<li>https://gitlab.com/norrist/hprfeed2db
<ul>
<li>Full episode feed</li>
<li>Comments feed.</li>
<li>HPR Episodes 3637 and 3654
<ul>
<li>https://hpr.norrist.xyz/episodes/HPR3637.html</li>
<li>https://hpr.norrist.xyz/episodes/HPR3654.html</li>
</ul></li>
</ul></li>
<li>Add a new step to pull in the HPR Bot post replies as comments.</li>
<li>As a demo https://hpr.norrist.xyz will have mastodon comments on
recent episode pages.</li>
</ul>
<h2 id="get_mastodon_comments.py">get_mastodon_comments.py</h2>
<ul>
<li><code>load_comments_from_bot()</code>
<ul>
<li>look for status updates regex
<code>"New Episode: hpr(\d+) :: "</code></li>
</ul></li>
<li><code>get_thread_comments()</code>
<ul>
<li>builds list of <code>descendants</code> - aka comments</li>
</ul></li>
<li><code>update_db()</code>
<ul>
<li>loops through list of comments</li>
<li>extracts - author, content, , pubdate, ...</li>
<li>inserts into sqlite database along with data from full episode and
comment feeds.</li>
</ul></li>
<li>HTML template displays mastodon comments underneath the comments
from the comment RSS feed.</li>
</ul>
<h2 id="mastodon-comment-moderation">Mastodon Comment Moderation</h2>
<ul>
<li>I didn't implement any moderation, but there are a few possible ways
to do so
<ol type="1">
<li>Maintain a list of <strong>approved contributors</strong>. When an
unapproved commenter posts
<ul>
<li>notify the admin that there are comments by a new commenter</li>
<li>skip adding any comments to the database until the commenter is
added to the approve list</li>
</ul></li>
<li>Maintain a list of approved comments
<ul>
<li>comments have unique id</li>
<li>Add approved comment ID to a database</li>
<li>Only display approved comments.</li>
</ul></li>
</ol></li>
</ul>
<h2 id="going-forward">Going Forward</h2>
<ul>
<li>Even without including mastodon comments on the HPR Page</li>
<li>Increase awareness of HPR on Mastodon
<ol start="0" type="1">
<li>Follow the HPR bot on mastodon.</li>
<li>Tag yourself when one of your shows is posted by the HPR.</li>
<li>Add your mastodon account to your HPR profile / show notes.</li>
<li>Comment on the HPR bots mastodon post.</li>
</ol></li>
</ul>
<h2 id="links">Links</h2>
<ul>
<li>My mastodon account - https://noc.social/<span class="citation"
data-cites="norrist">@norrist</span></li>
<li>Python to get mastodon comments -
https://gitlab.com/norrist/hprfeed2db/-/blob/main/get_mastdon_comments.py</li>
<li>Example page with Mastodon Comments -
https://hpr.norrist.xyz/episodes/HPR4126.html
<ul>
<li>This page may not have any mastodon comments depending on when you
check the page.</li>
<li>Check a more recent page if there are no mastodon comments.</li>
</ul></li>
</ul>
