4f744f37c4
Changes to the main 'feedWatcher' script: new -check=mode and -rejects=file options to automate copyright checks and save rejected URLs. Made subroutines parseFeed, and execSQL more resilient. Experimented with using XML::FeedPP but haven't done so yet. Enhanced checkCopyright to do auto, manual and no checking. Some POD additions. The database is currently being sent to the repo, but this may be unwise. The script 'make_reports' is for making the various reports uploaded here: html, JSON, OPML, Markdown and PDF. The PDF is built from the Markdown with Pandoc. The HTML is generated from the template 'feedWatcher.tpl', which is the default. The TT² template 'feedWatcher_5.tpl' is for dumping the URLs from the database into a file so that they can be reloaded. Daily dumps of the database are made on my workstation, and kept for 6 months.
94 lines
2.0 KiB
Bash
Executable File
94 lines
2.0 KiB
Bash
Executable File
#!/bin/bash -
|
|
#===============================================================================
|
|
#
|
|
# FILE: make_reports
|
|
#
|
|
# USAGE: ./make_reports
|
|
#
|
|
# DESCRIPTION: Script to generate all the feedWatcher reports needed for
|
|
# conferences, etc
|
|
#
|
|
# OPTIONS: ---
|
|
# REQUIREMENTS: ---
|
|
# BUGS: ---
|
|
# NOTES: ---
|
|
# AUTHOR: Dave Morriss (djm), Dave.Morriss@gmail.com
|
|
# VERSION: 0.0.1
|
|
# CREATED: 2023-01-09 17:07:23
|
|
# REVISION: 2023-01-09 17:39:22
|
|
#
|
|
#===============================================================================
|
|
|
|
set -o nounset # Treat unset variables as an error
|
|
|
|
# SCRIPT=${0##*/}
|
|
# DIR=${0%/*}
|
|
|
|
#
|
|
# Paths
|
|
#
|
|
BASEDIR="$HOME/HPR/feed_watcher"
|
|
|
|
cd "$BASEDIR" || { echo "Failed to cd to $BASEDIR"; exit 1; }
|
|
|
|
#
|
|
# Files and sanity checks
|
|
#
|
|
FW="$BASEDIR/feedWatcher"
|
|
[ -e "$FW" ] || {
|
|
echo "Script $FW appears to be missing"
|
|
exit 1
|
|
}
|
|
FWTPL3="$BASEDIR/feedWatcher_3.tpl"
|
|
[ -e "$FWTPL3" ] || {
|
|
echo "Template $FWTPL3 appears to be missing"
|
|
exit 1
|
|
}
|
|
FWHTML="$BASEDIR/feedWatcher.html"
|
|
FWMKD="$BASEDIR/feedWatcher.mkd"
|
|
FWPDF="$BASEDIR/feedWatcher.pdf"
|
|
|
|
#
|
|
# Generate HTML, JSON and OPML reports.
|
|
# The template defaults to 'feedWatcher.tpl', the JSON file to
|
|
# 'feedWatcher.json' and the OPML file to 'feedWatcher.opml'. The script
|
|
# reports information about this, except for the HTML.
|
|
#
|
|
$FW -template -json -opml -out="$FWHTML"
|
|
if [[ -e "$FWHTML" ]]; then
|
|
echo "HTML written to $FWHTML"
|
|
else
|
|
echo "$FWHTML doesn't seem to have been written"
|
|
fi
|
|
|
|
#
|
|
# Generate Markdown
|
|
#
|
|
$FW -tem="$FWTPL3" -out="$FWMKD"
|
|
if [[ -e "$FWMKD" ]]; then
|
|
echo "Markdown written to $FWMKD"
|
|
else
|
|
echo "$FWMKD doesn't seem to have been written"
|
|
fi
|
|
|
|
#
|
|
# Use the Makefile to create PDF
|
|
#
|
|
make all
|
|
RES=$?
|
|
[ $RES -ne 0 ] && {
|
|
echo "Problem running 'make'; aborting!"
|
|
exit $RES
|
|
}
|
|
|
|
if [[ -e "$FWPDF" ]]; then
|
|
echo "PDF written to $FWPDF"
|
|
else
|
|
echo "$FWPDF doesn't seem to have been written"
|
|
fi
|
|
|
|
exit
|
|
|
|
# vim: syntax=sh:ts=8:sw=4:ai:et:tw=78:fo=tcrqn21
|
|
|