diff --git a/Community_News/recording_dates.dat b/Community_News/recording_dates.dat index dad959a..2c877a3 100644 --- a/Community_News/recording_dates.dat +++ b/Community_News/recording_dates.dat @@ -44,3 +44,4 @@ 2026-02-01,2026-02-30 15:00:00 2026-03-01,2026-03-26 15:00:00 2026-04-01,2026-04-30 15:00:00 +2026-05-01,2026-05-29 15:00:00 \ No newline at end of file diff --git a/workflow/hpr-cn-generate-notes.bash b/workflow/hpr-cn-generate-notes.bash new file mode 100755 index 0000000..1b20ef4 --- /dev/null +++ b/workflow/hpr-cn-generate-notes.bash @@ -0,0 +1,280 @@ +#!/usr/bin/env bash + +############################################################################################ +# Update db + +source settings $1 + +git_dir="/home/ken/tmp/hpr/hpr_generator" +if [ ! -d "${git_dir}/.git" ] +then + #git clone gitea@repo.anhonesthost.net:rho_n/hpr_generator.git "${git_dir}" + git clone gitea@repo.anhonesthost.net:HPR/hpr_generator.git "${git_dir}" +fi + +if [ ! -d "${git_dir}" ] +then + echo_error "The git dir \"${git_dir}\" is missing" +fi + +cd "${git_dir}" + +git pull + +ssh hpr -t "ls -al /docker/users/hpr/userfiles/sql/hpr.sql;md5sum /docker/users/hpr/userfiles/sql/hpr.sql" +ssh hpr -t "/docker/users/hpr/userfiles/sql/hpr_db_backup.bash" +ssh hpr -t "ls -al /docker/users/hpr/userfiles/sql/hpr.sql;md5sum /docker/users/hpr/userfiles/sql/hpr.sql" + +#/home/ken/tmp/hpr/hpr_generator/utils/update-hpr-db.sh +./utils/update-hpr-db.sh +if [ $? -ne 0 ] +then + echo 'Terminating...' >&2 + exit 1 +fi + +hpr_db="${git_dir}/hpr.db" + +if [[ ! -s "${hpr_db}" || -z "${hpr_db}" ]] +then + echo_error "The \"hpr_db\" variable/file is missing." +fi +if [ "$( file --brief --mime-type "${hpr_db}" | grep --count 'application/vnd.sqlite3' )" -ne "1" ] +then + echo_error "The \"hpr_db\" variable has not a valid \"application/vnd.sqlite3\" mime type." +fi + +############################################################################################ +# Get previous show info + +row=$(sqlite3 hpr.db " +SELECT notes +FROM eps +WHERE duration > 0 +AND series = 47 +ORDER BY date DESC +LIMIT 1; +") + +eval $( + echo "$row" | + grep -o '' | + sed -E 's//\1/' | + tr ',' '\n' +) + +echo_debug "The last show month was for ${month}, latest_comment: ${latest_comment}, latest_host: ${latest_host}, and latest_episode: ${latest_episode}" + +############################################################################################ +# Get next show info + +this_month=$( \date --date="${month}-01 +1 month" +%Y-%m ) + +IFS='|' read -r eps_num eps_date <<< "$(sqlite3 hpr.db " +SELECT id, date +FROM eps +WHERE duration = 0 +AND series = 47 +ORDER BY date ASC +LIMIT 1; +")" + +echo_debug "This is going to be hpr${eps_num} for release on ${eps_date}" + +eps_dir="/home/ken/processing/x_${eps_num}_${eps_date}_x" +if [ ! -d "${eps_dir}" ] +then + mkdir -vp "${eps_dir}" +fi + +echo_debug "The episode dir is \"${eps_dir}\"" + +shownotes_html="${eps_dir}/shownotes.html" + +############################################################################################ +# Add New hosts to shownotes + +results=$(sqlite3 hpr.db "SELECT hostid, host FROM hosts WHERE hostid > ${latest_host};") + +echo "
" | tee --append "${shownotes_html}"
+if [ -z "${results}" ]
+then
+ echo "There were no new hosts this month." | tee --append "${shownotes_html}"
+ newest_host="${latest_host}"
+else
+ echo "Welcome to our new hosts:
" | tee --append "${shownotes_html}"
+ echo "
| Id | " | tee --append "${shownotes_html}" +echo "Day | " | tee --append "${shownotes_html}" +echo "Date | " | tee --append "${shownotes_html}" +echo "Title | " | tee --append "${shownotes_html}" +echo "Host | " | tee --append "${shownotes_html}" +echo "
|---|---|---|---|---|
| ${eps_id} | " | tee --append "${shownotes_html}" + echo "$( \date --date=${eps_date} +%a ) | " | tee --append "${shownotes_html}" + echo "${eps_date} | " | tee --append "${shownotes_html}" + echo "${title} | " | tee --append "${shownotes_html}" + echo "${host} | " | tee --append "${shownotes_html}" + latest_episode=${eps_id} + echo "
Policy decisions surrounding HPR are taken by the community as a whole. This +discussion takes place on the Mailing List +which is open to all HPR listeners and contributors. The discussions are open +and available on the HPR server under Mailman. +
+The threaded discussions this month can be found here:
+${mailman_link} + +With the kind permission of LWN.net we are linking to +The LWN.net Community Calendar.
+Quoting the site:
+This is the LWN.net community event calendar, where we track +events of interest to people using and developing Linux and free software. +Clicking on individual events will take you to the appropriate web +page." | tee --append "${shownotes_html}" + +latest_comment=$(sqlite3 hpr.db "SELECT MAX(id) FROM comments;") +echo "" | tee --append "${shownotes_html}" + +cp -v "${shownotes_html}" "${shownotes_html%.*}"_edited.html +ls -al "${eps_dir}"