1
0
forked from HPR/hpr_generator

13 Commits

Author SHA1 Message Date
2e43f79d52 Merge pull request '#267 update-dependencies' (#268) from update-dependencies into main
Reviewed-on: HPR/hpr_generator#268
Reviewed-by: Roan Horning <rho_n@josh@dao-mail.com>
2025-07-26 20:40:01 +00:00
Paul Jewell
00ab3b3065 #267 - Remove mysql instructions from site-generator 2025-07-24 08:27:39 +01:00
Paul Jewell
4af0c021eb #267 - Remove mysql instructions from GETTING_STARTED.md 2025-07-24 08:25:58 +01:00
Paul Jewell
3abeb25b03 #267 - Remove references to mysql from README.md 2025-07-24 08:21:50 +01:00
Paul Jewell
e2fd890669 #267 - remove dependency check for DBD::mysql 2025-07-24 08:18:51 +01:00
e21f434c2a Merge pull request 'Add Container file and build script (button_hpr_container.sh) to repo.' (#263) from sgoti/hpr_generator:main into main
Reviewed-on: HPR/hpr_generator#263
2025-06-19 17:04:05 +00:00
e2c591edff Merge branch 'main' into main 2025-06-19 17:03:56 +00:00
28a75efe1b Merge pull request 'about-page-html-submit' (#264) from norrist/hpr_generator:about-page-html-submit into main
Reviewed-on: HPR/hpr_generator#264
Reviewed-by: Roan Horning <rho_n@josh@dao-mail.com>
2025-06-06 01:53:33 +00:00
94baef679f rm line break 2025-06-05 17:00:16 -05:00
11738f5052 Replace old instructions for shownotes 2025-06-05 16:58:20 -05:00
Sgoti
c9e1446f1f Tiny human distraction.
I cp the files over but the 'git rm' failed and I didn't noticed.  Just a clean
    up job.
2025-05-30 17:46:02 -04:00
Sgoti
bbf5c26dab Moved 'Containerfile' and build script to hpr-tools/
Ken asked that files be placed into 'hpr-tools/'.  The build script is named
    'button_hpr_container.sh' currently; this will change too.  Maybe
    'hpr_email_shownotes.sh'.  Taking suggestions (as of 2025/05/30-2025/12/31).
2025-05-30 17:40:11 -04:00
Sgoti
2ca4d32282 Changed image tag from 'testing' to current perl version '5.40.1'
removed a few unused variables then shift the 'local' scoped unsets to global
2025-05-29 13:04:14 -04:00
7 changed files with 50 additions and 316 deletions

View File

@@ -111,7 +111,7 @@ file are found in the comments within the file.
Any database supported by the Perl:DBI and Perl::DBD modules can be used with
the site-generator program. Currently the hpr_generator project works with
a MySQL or SQLite database.
an SQLite database.
Find the [DBI] section of the file. It should look like the following
@@ -146,26 +146,6 @@ The hpr.db section of the driver option `dbi:SQLite:hpr.db` is the path
to the sqlite file. The default assumes the hpr.db file is located in the same
directory as the site-generator.
### MySQL
Remove the comment character from the start of the database, driver,
user, and password option lines:
```
# Configuration settings for MySQL
database: mysql
driver: dbi:mysql:database=hpr_hpr:hostname=localhost
user: hpr-generator
password: *********
```
This assumes that the MySQL database service is available at the localhost
hostname, that the database name (hpr_hpr) is the database created from
the hpr.sql dump file or manually created by you, that the user (hpr-generator)
was added by you and has read rights to the hpr_hpr database, and that the
password (replace ********* with the actual password) matches the password set
for the hpr-generator database user.
## Configuring the website for viewing locally
For HTML links to work when viewing the files on your local machine using the

View File

@@ -15,15 +15,6 @@ Static web page generator for the Hacker Public Radio website.
2. Run `./utils/update-hpr.sh`
* SQLite v3.8.3 or greater is recommended. CTE WITH clauses are used in some template queries. Must convert WITH
clauses to sub-queries when using earlier versions of SQLite.
* With MySQL
* Create database hpr_hpr in the MySQL server from HPR dump file.
- ``sudo mysql --host=localhost < hpr.sql``
* Create a user that will be used by the site-generator.
- Suggested username: hpr-generator
- ``CREATE USER 'hpr-generator'@'localhost' IDENTIFIED BY '<password>';``
* Limit the user's privileges to EXECUTE and SELECT
- ``GRANT SELECT 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.)
* Getopt::Long
* Pod::Usage
@@ -35,7 +26,7 @@ Static web page generator for the Hacker Public Radio website.
* Template::Plugin::HTML::Strip
* DBI
* Tie::DBI
* DBD::SQLite or DBD::mysql
* DBD::SQLite
* Date::Calc
* Text::CSV_XS
* HTML::Entities
@@ -76,4 +67,6 @@ and add the label "**Feature Request**".
* gordons
* Ken Fallon
* norrist
* Paul Jewell

View File

@@ -56,19 +56,9 @@ Perl Template Toolkit.
* SQLite v3.8.3 or greater is recommended. CTE WITH clauses are used in some template queries.
Must convert WITH clauses to sub-queries when using earlier versions of SQLite.
With MySQL
* Create database hpr_hpr in the MySQL server from HPR dump file.
- sudo mysql --host=localhost < hpr.sql
* Create a user that will be used by the site-generator.
- Suggested username: hpr-generator
- CREATE USER 'hpr-generator'@'localhost' IDENTIFIED BY '<password>';
* Limit the user's privileges to EXECUTE and SELECT
- GRANT SELECT 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.)
* Config::Std
* DBD::SQLite or DBD:mysql
* DBD::SQLite
* DBI
* Data::Dumper
* Date::Calc

View File

@@ -872,42 +872,17 @@
Your audio is completely inaccessible to those who have hearing problems,
so the only way for your show to be of help to them is if you distill the essence of the show into the show notes.
If you are using a script to prepare your show then include that.</li>
<li><strong>Adding the shownotes</strong>
<ul>
<li>Add text and use the WYSIWYG editor buttons to add additional formatting</li>
<li>Optionally - You can paste in <strong>Rendered</strong> HTML</li>
<li><strong>Do not paste un-rendored markup (HTML, Markdown,
RestructuredText)</strong> unless your intention is to have un-rendored
markup as shownotes.</li>
<li>The amount you can enter is restricted to 4000 characters, but you can provide additional show notes if you wish.
Please add them to an full_shownotes.html file which you can expect to be served from
<!--% absolute_url(baseurl) %-->eps/hpr9999/full_shownotes.html</li>
</ul>
The amount you can enter is restricted to 4000 characters, but you can provide additional show notes if you wish.
Please add them to an full_shownotes.html file which you can expect to be served from
<!--% absolute_url(baseurl) %-->eps/hpr9999/full_shownotes.html<br /> <br />
<li>
If you wish to include text formatting then please use a format that supports it. We accept:
<ul>
<li>HTML5</li>
<li>Markdown (standard)</li>
<li>Markdown (GitHub flavoured)</li>
<li>Markdown (Pandoc flavoured)</li>
<li>RestructuredText</li>
<li>txt2tags</li>
<li>Plain text</li>
</ul>
However please restrict yourself to text unless you are experienced producing valid markdown/HTML5.
Regardless of the format you send your shownotes will end up in html5 &lt;article&gt; section,
where the header and footer are not available to you. Avoid using &lt;div&gt; or &lt;span&gt;.
The inclusion of JavaScript will send your show into quarantine, until an experienced HPR volunteer
can be found to debug it.<br />
It takes us a lot longer to fix incorrectly formatted shownotes than plain text, so please only create formatted
show notes if you know what you are doing and are sure that what you are writing is valid.
</li>
<li id="shownotes_format"><strong>Show Note Format:</strong> <em>Optional</em><br />
Please tell us which format, if any you used when filling in your shownotes.
<ul>
<li><a href="https://www.w3schools.com/html/default.asp">HTML5</a></li>
<li><a href="https://en.wikipedia.org/wiki/Markdown">Markdown (standard)</a></li>
<li><a href="https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax">Markdown (GitHub flavoured)</a></li>
<li><a href="https://pandoc.org/MANUAL.html#pandocs-markdown">Markdown (Pandoc flavoured)</a></li>
<li><a href="https://docutils.sourceforge.io/docs/user/rst/quickstart.html">RestructuredText</a></li>
<li>Plain text having no formatting.</li>
</ul>
</li>
<li id="series"><strong>Series:</strong> <em>Optional</em><br />
Select the <a href="<!--% absolute_url(baseurl) %-->series/index.html">series</a> if any that your show is a part of.

View File

@@ -1,62 +0,0 @@
FROM perl:5.40.1 As base
LABEL author="sgoti" \
email="lyunpaw@gmail.com" \
project="Hacker Public Radio" \
forge="https://repo.anhonesthost.net/HPR"
ARG unprivilegedUser="janitor"
RUN apt update && apt upgrade --yes;
RUN apt install --no-install-recommends sqlite3 git --yes \
&& rm --recursive --force /var/lib/apt/lists/*;
RUN mkdir --verbose --parent /opt/hpr /tmp/hpr;
RUN groupadd --system ${unprivilegedUser} \
&& useradd --system --no-log-init --gid ${unprivilegedUser} ${unprivilegedUser};
RUN chown --recursive ${unprivilegedUser}:${unprivilegedUser} /opt/hpr \
&& chown --recursive ${unprivilegedUser}:${unprivilegedUser} /tmp/hpr;
#Bill of particulars.
##Meta::CPAN (Comprehensive Perl Archive Network)
RUN cpanm Config::General \
DBD::SQLite \
DBI \
Data::Dumper \
Date::Calc \
Date::Parse \
DateTime \
DateTime::Duration \
DateTime::Format::Duration \
DateTime::TimeZone \
HTML::Entities \
JSON \
Template \
Template::Filters;
##Included perl core modules (standard library).
##Carp
##Cwd
##Getopt::Long
##Pod::Usage
##File::Copy
USER ${unprivilegedUser}
WORKDIR /opt/hpr
RUN git clone https://repo.anhonesthost.net/HPR/hpr-tools.git \
&& git clone https://repo.anhonesthost.net/HPR/hpr_hub.git \
&& git clone https://repo.anhonesthost.net/HPR/hpr_generator.git \
&& git clone https://repo.anhonesthost.net/HPR/hpr_documentation.git;
WORKDIR /opt/hpr/hpr-tools/Community_News/
RUN ln --symbolic /opt/hpr/hpr_generator/utils/mysql2sqlite /opt/hpr/hpr-tools/Community_News/mysql2sqlite;
RUN ./collect_HPR_database;
CMD bash;

View File

@@ -1,136 +0,0 @@
#!/usr/bin/env bash
#License: GPL v3
#see <https://www.gnu.org/licenses/>.
#Name: button_podman_make_shownotes.sh
#Purpose: build/run HPR Container.
#Version: beta 0.01
#Author: SGOTI (Some Guy On The Internet)
#Email: Lyunpaw@gmail.com
#Date: 2025-04-19
#declaration:
declare bindir="/usr/bin/"
declare podman="${bindir}podman"
declare echo="builtin echo -e"
declare unprivilegedUser="janitor"
declare date="${bindir}date"
declare flags
declare OPTIND
declare -A containerBulidProperties
declare currentMonth
declare nextMonth
declare currentYear
#start:
currentMonth=$(${date} +%m)
currentYear=$(${date} +%Y)
if [[ ${currentmonth} -gt 0 ]] && [[ ${currentmonth} -le 11 ]]; then
nextMonth="(($(${date} +%m)+01))" #Incomplete: Can return single-digit integer; must be a double-digit integer.
else
nextMonth="01"
fi
containerBulidProperties=(
"containerFile" "/path/to/Containerfile"
"hostMountDir01" "path/to/project/directory"
"hostMountDir02" "/tmp/"
"containerMountDir01" "/opt/hpr/"
"containerMountDir02" "/tmp/hpr/"
"containerImageTag" "testing:0.1"
"pullNewImage" "podman pull docker.io/library/perl"
"recordingDate" "$(${date} -d "${currentYear}/${currentMonth}/01")"
"recordingTimeStart" "15:00" #TZ: UTC
"recordingTimeEnd" "17:00" #TZ: UTC
)
function runHPRContainer () {
local makeEmail #Incomplete:
makeEmail="./make_email -month=${containerBulidProperties[recordingDate]} -start=15:00 -end=17:00 -out=/tmp/hpr/%semail.txt"
local makeShownotes #Incomplete:
makeShownotes="/opt/hpr/src/hpr-tools/Community_News/make_shownotes -from=${containerBulidProperties[recordingDate]} -full=/tmp/hpr/%sfull_shownotes.html -mail -comments"
${podman} run \
--mount type=bind,src=${containerBulidProperties[hostMountDir02]},dst=${containerBulidProperties[containerMountDir02]},rw=true \
--label="Project"="HPR" \
--label="Forge"="https://repo.anhonesthost.net/HPR/" \
--interactive \
--tty \
--rm=true \
--privileged=false \
--pull="never" \
--cgroups=enabled \
--cgroupns=private \
--uts=private \
--pid=private \
--memory="32m" \
--memory-reservation="16m" \
--hostname="hpr" \
--name="hpr_project" \
--user="${unprivilegedUser}" \
${containerBulidProperties[containerImageTag]} bash;
unset currentMonth
unset currentYear
return;
}
function buildNewContainerImage () {
local containerNameAndVersionNumber="hpr_image:5.40.1"
if [[ -f "${containerBulidProperties[containerFile]}" ]]; then
${echo} "Building new container image...\nThis may take several minutes.\
\nThis is a non interactive build process, so you can return when \
it's completed.";
${podman} build --file="${containerBulidProperties[containerFile]}" --tag="${containerBulidProperties[containerImageTag]}";
else
${echo} 'Dont forget to assign the ${containerBulidProperties[containerFile]} ;). The Containerfile is needed to build the container image.'
fi
return;
}
function help () {
${echo} "$0 [-hbpq]\n\t[-h] help\n\t[-b] build new container\n\t[-p] pull new perl image\n\t[-q] quit";
return;
}
while getopts 'hbpq' flags; do
case "${flags}" in
h) help; exit 0;
;;
i) ${echo} "Work in progress... :D"; break;
;;
b) buildNewContainerImage;
;;
p) ${containerBulidProperties[pullNewImage]}; exit 0;
;;
e) ${echo} "Work in progress... :D"; break;
;;
s) ${echo} "Work in progress... :D"; break;
;;
q)
${echo} "Quitting script."; break;
;;
*)
${echo} "Good Heavens! Wrong input."; help; exit 1
;;
esac
done
shift $((OPTIND-1))
if [[ -z ${1} ]]; then help; runHPRContainer; fi;
unset echo
unset flags
unset podman
unset OPTIND
unset containerBulidProperties
exit 0

View File

@@ -1,73 +1,67 @@
#!/bin/bash -
#!/bin/bash -
#===============================================================================
#
# FILE: check-dependencies.sh
#
# USAGE: ./check-dependencies.sh
#
# DESCRIPTION: Check that Perl module dependencies for the hpr_generator
#
# USAGE: ./check-dependencies.sh
#
# DESCRIPTION: Check that Perl module dependencies for the hpr_generator
# are installed.
#
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Roan "Rho`n" Horning (roan.horning@gmail.com)
# ORGANIZATION:
# ORGANIZATION:
# CREATED: 09/05/2024 09:55:00 PM
# REVISION: ---
#===============================================================================
set -o nounset # Treat unset variables as an error
set -o nounset # Treat unset variables as an error
#--- FUNCTION ----------------------------------------------------------------
# NAME: is_module_installed
# DESCRIPTION: Tests if the supplied module is found on the system
# NAME: is_module_installed
# DESCRIPTION: Tests if the supplied module is found on the system
# PARAMETERS: Name of the denpendent Perl module
# RETURNS: 0 if not found, 1 if found
#-------------------------------------------------------------------------------
function is_module_installed {
HR="----------------------"
perl -e "use ${1} "
if [ $? -ne 0 ]
then
echo ${HR}
else
echo "Found module ${1}"
echo ${HR}
fi
HR="----------------------"
perl -e "use ${1} "
if [ $? -ne 0 ]; then
echo ${HR}
else
echo "Found module ${1}"
echo ${HR}
fi
}
MODULES=( \
"Getopt::Long" \
"Pod::Usage" \
"Config::Std" \
"Template" \
"Template::Plugin::File" \
"Template::Plugin::DBI" \
"Template::Plugin::HTML::Strip" \
"DBI" \
"Tie::DBI" \
"DBD::SQLite" \
"DBD::mysql" \
"Date::Calc" \
"Text::CSV_XS" \
MODULES=(
"Getopt::Long"
"Pod::Usage"
"Config::Std"
"Template"
"Template::Plugin::File"
"Template::Plugin::DBI"
"Template::Plugin::HTML::Strip"
"DBI"
"Tie::DBI"
"DBD::SQLite"
"Date::Calc"
"Text::CSV_XS"
)
echo "The following modules must be installed for the site-generator to function: "
for module in "${MODULES[@]}"
do
echo "* ${module}"
for module in "${MODULES[@]}"; do
echo "* ${module}"
done
echo "When MySQL is used, the DBD:mysql module is required (otherwise it is optional)"
echo "When SQLite is used, then the DBD:SQLite module is required (otherwise it is optional)"
echo "Scanning for modules ..."
echo "----------------------"
for module in "${MODULES[@]}"
do
is_module_installed "${module}"
for module in "${MODULES[@]}"; do
is_module_installed "${module}"
done
echo "Finished scanning."