From b420453abd47c7f1b3a5fbf827591c7c90cbb47c Mon Sep 17 00:00:00 2001 From: Roan Horning Date: Tue, 7 Mar 2023 19:06:29 -0500 Subject: [PATCH] Add instructions for creating HPR SQLite file --- GETTING_STARTED.md | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md index 7ebcd1c..d223196 100644 --- a/GETTING_STARTED.md +++ b/GETTING_STARTED.md @@ -51,7 +51,41 @@ cpan Date::Calc cpan Tie::DBI ``` +# Create the HPR database + +The hpr_generator relies on information from a database to generate many of the +files for the website (for example: index.html, series/index.html, +hpr_mp3.rss, etc). This data is available from a MySQL dump file found on +hackerpublicradio.org at "https://www.hackerpublicradio.org/hpr.sql". + +The first step is to download the hpr.sql file. This can be done using your +browser, or by running one of the following commands: + +`curl https://www.hackerpublicradio.org/hpr.sql --output ./hpr.sql` + +or + +`wget --directory-prefix=./ https://www.hackerpublicradio.org/hpr.sql` + +## Creating an SQLite database file + +The SQL of the hpr.sql file must be converted from MySQL specific statements to +SQLite specific statements. The mysql2sqlite script found in the utils directory +is used for this conversion. First remove the lines from hpr.sql that +mysql2sqlite can't handle: + +`sed '/^DELIMITER ;;/,/^DELIMITER ;/d' < ./hpr.sql > ./hpr-sqlite.sql` + +Next run the mysql2sqlite script piping its output into the sqlite3 +program which creates the hpr.db file: + +`./utils/mysql2sqlite ./hpr-sqlite.sql | sqlite3 ./hpr.db` + +For convenience, the update-sqlite-db.sh script in the utils directory +automates the above steps (including downloading the hpr.sql file). +From the root of the local hpr_generator repository run: + +`./utils/update-sqlite-db.sh` -# Configure site-generator # Run site-generator \ No newline at end of file