diff --git a/README.md b/README.md
index 1bdf28f..39ab07d 100644
--- a/README.md
+++ b/README.md
@@ -3,12 +3,22 @@ Static web page generator for the Hacker Public Radio website.
## Installation
* Clone or download this repository
-* Create the sqlite3 database from the files in the _sql directory. The default name for the database file is "hpr.db" and should be located in the root of the project directory. The name and location can be set in the site.cfg file.
-* Two sql helper scripts are available to generate an empty database or a database filled with test data.
- - For an empty database: `cat Create_Database_Empty.sql | sqlite3 hpr.db`
- - For a database with test data: `cat Create_Database_Test.sql | sqlite3 hpr.db`
-* 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 SQLite
+ * Create the sqlite3 database from the files in the _sql directory. The default name for the database file is "hpr.db" and should be located in the root of the project directory. The name and location can be set in the site.cfg file.
+ * Two sql helper scripts are available to generate an empty database or a database filled with test data.
+ - For an empty database: `cat Create_Database_Empty.sql | sqlite3 hpr.db`
+ - For a database with test data: `cat Create_Database_Test.sql | sqlite3 hpr.db`
+ * 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 '';``
+ * 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
* Pod::Usage
@@ -18,7 +28,7 @@ Static web page generator for the Hacker Public Radio website.
* Template::Plugin::DBI
* DBI
* Tie::DBI
- * DBD::SQLite
+ * DBD::SQLite or DBD:mysql
* Date::Calc
## Usage
@@ -50,4 +60,3 @@ and add the label "**Feature Request**".
## Authors and acknowledgment
* Roan "Rho`n" Horning
-
diff --git a/site-generator b/site-generator
index 86e52a7..c758a37 100755
--- a/site-generator
+++ b/site-generator
@@ -35,15 +35,27 @@ This is a site generator for the Hacker Public Radio website based upon the Perl
=head1 INSTALLATION
+ With SQLite
* Create the sqlite3 database from the files in the _sql directory. The default name for the
database file is "hpr.db" and should be located in the root of the project directory. The
name and location can be set in the site.cfg file.
* Two sql helper scripts are available to generate an empty database or a database filled with test data.
- - For an empty database: `cat Create_Database_Empty.sql | sqlite3 hpr.db`
- - For a database with test data: `cat Create_Database_Test.sql | sqlite3 hpr.db`
- * 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.
- * Install the needed Perl modules using preferred method (distribution packages, CPAN, etc.)
+ - For an empty database: cat Create_Database_Empty.sql | sqlite3 hpr.db
+ - For a database with test data: cat Create_Database_Test.sql | sqlite3 hpr.db
+ * 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 '';
+ * 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
* Pod::Usage
* Config::Std
@@ -52,7 +64,7 @@ This is a site generator for the Hacker Public Radio website based upon the Perl
* Template::Plugin::DBI
* DBI
* Tie::DBI
- * DBD::SQLite
+ * DBD::SQLite or DBD:mysql
* Date::Calc
=head1 AUTHOR
@@ -186,6 +198,7 @@ sub get_template_html (\%@) {
PRE_CHOMP => 1,
POST_CHOMP => 1,
CONSTANTS => {
+ database => $_[0]{database},
driver => $_[0]{driver},
user => $_[0]{user},
password => $_[0]{password},
diff --git a/site.cfg b/site.cfg
index 474766b..807f3e5 100644
--- a/site.cfg
+++ b/site.cfg
@@ -2,9 +2,10 @@
# with the database.
# dbi::
[DBI]
-driver: dbi:SQLite:hpr.db
-user:
-password:
+database: mysql
+driver: dbi:mysql:database=hpr_hpr:hostname=localhost
+user: hpr-generator
+password: zBozqN-Z2zNAz
# Configure the root template page which pulls in the navigation and
# content templates used by each page. An optional baseurl property may
@@ -13,6 +14,8 @@ password:
[root_template]
content: page.tpl.html
#baseurl: OPTIONAL [i.e. file://]
+baseurl: file:///home/roan/Development/hpr/website/hpr_generator/public_html/
+media_baseurl: https://archive.org/download/hpr$eps_id/
# Configure the navigation menu and the content templates for each page
# of the site:
@@ -137,6 +140,7 @@ navigation: navigation-get-shows.tpl.html
content: content-twat_episode.tpl.html
multipage: true
filename: eps/twat[id]/index.html
+media_baseurl: https://www.hackerpublicradio.org/eps/
[mumble-howto]
navigation: navigation-about.tpl.html
diff --git a/templates/content-correspondent.tpl.html b/templates/content-correspondent.tpl.html
index f63b850..2b677a2 100644
--- a/templates/content-correspondent.tpl.html
+++ b/templates/content-correspondent.tpl.html
@@ -1,31 +1,18 @@
+
-
-
+
@@ -33,8 +20,9 @@
diff --git a/templates/content-episode.tpl.html b/templates/content-episode.tpl.html
index 4920449..0c33086 100644
--- a/templates/content-episode.tpl.html
+++ b/templates/content-episode.tpl.html
@@ -2,57 +2,9 @@
+
-
diff --git a/templates/content-episodes.tpl.html b/templates/content-episodes.tpl.html
index a1683db..ca5153d 100644
--- a/templates/content-episodes.tpl.html
+++ b/templates/content-episodes.tpl.html
@@ -1,4 +1,5 @@
+
Complete Archive of Shows.
@@ -7,21 +8,7 @@
-
@@ -42,7 +29,7 @@
FROM twat_eps as eps
INNER JOIN hosts ON eps.hostid = hosts.hostid
INNER JOIN miniseries ON eps.series = miniseries.id
- ORDER BY eps.id + 0 DESC
+ ORDER BY eps.id DESC
')
%-->
diff --git a/templates/content-index.tpl.html b/templates/content-index.tpl.html
index 44aa81d..c7e6288 100644
--- a/templates/content-index.tpl.html
+++ b/templates/content-index.tpl.html
@@ -3,6 +3,7 @@
+
-
@@ -46,33 +34,7 @@
Latest Shows
-
@@ -98,22 +60,7 @@
Previous five weeks
-
diff --git a/templates/content-series_episode.tpl.html b/templates/content-series_episode.tpl.html
index e74fe50..a05cc84 100644
--- a/templates/content-series_episode.tpl.html
+++ b/templates/content-series_episode.tpl.html
@@ -38,7 +38,7 @@
INNER JOIN hosts
ON eps.hostid = hosts.hostid
WHERE series = ?
- ORDER BY eps.id + 0 DESC
+ ORDER BY eps.id DESC
')
%-->
diff --git a/templates/content-twat_episode.tpl.html b/templates/content-twat_episode.tpl.html
index ef9d965..a408bea 100644
--- a/templates/content-twat_episode.tpl.html
+++ b/templates/content-twat_episode.tpl.html
@@ -7,7 +7,6 @@
WITH episode_maxmin AS (
SELECT MAX(id) AS \'latest\', MIN(id) AS \'earliest\', ? AS \'id\'
FROM twat_eps AS eps
- WHERE eps.date < date (\'now\', \'+1 days\')
),
episode_date AS (
SELECT eps.date
@@ -26,7 +25,6 @@
FROM twat_eps AS eps
INNER JOIN episode_date
ON eps.date > episode_date.date
- WHERE eps.date < date (\'now\')
)
SELECT eps.id, eps.date, eps.title, eps.duration,
eps.summary, eps.notes, eps.explicit, eps.license,
diff --git a/templates/ids-episode.tpl.html b/templates/ids-episode.tpl.html
index 1271a26..c4df5ab 100644
--- a/templates/ids-episode.tpl.html
+++ b/templates/ids-episode.tpl.html
@@ -1,8 +1,6 @@
+
-
+
,
diff --git a/templates/ids-twat_episode.tpl.html b/templates/ids-twat_episode.tpl.html
index 2609648..d7eaa0c 100644
--- a/templates/ids-twat_episode.tpl.html
+++ b/templates/ids-twat_episode.tpl.html
@@ -1,7 +1,6 @@
,
diff --git a/templates/queries-call_for_shows-mysql.tpl.html b/templates/queries-call_for_shows-mysql.tpl.html
new file mode 100644
index 0000000..4f17762
--- /dev/null
+++ b/templates/queries-call_for_shows-mysql.tpl.html
@@ -0,0 +1,6 @@
+
diff --git a/templates/queries-call_for_shows-sqlite.tpl.html b/templates/queries-call_for_shows-sqlite.tpl.html
new file mode 100644
index 0000000..bf6021d
--- /dev/null
+++ b/templates/queries-call_for_shows-sqlite.tpl.html
@@ -0,0 +1,6 @@
+
diff --git a/templates/queries-correspondent-mysql.tpl.html b/templates/queries-correspondent-mysql.tpl.html
new file mode 100644
index 0000000..2876cff
--- /dev/null
+++ b/templates/queries-correspondent-mysql.tpl.html
@@ -0,0 +1,18 @@
+
diff --git a/templates/queries-correspondent-sqlite.tpl.html b/templates/queries-correspondent-sqlite.tpl.html
new file mode 100644
index 0000000..dbd8469
--- /dev/null
+++ b/templates/queries-correspondent-sqlite.tpl.html
@@ -0,0 +1,18 @@
+
diff --git a/templates/queries-episode-mysql.tpl.html b/templates/queries-episode-mysql.tpl.html
new file mode 100644
index 0000000..dee01c1
--- /dev/null
+++ b/templates/queries-episode-mysql.tpl.html
@@ -0,0 +1,51 @@
+
diff --git a/templates/queries-episode-sqlite.tpl.html b/templates/queries-episode-sqlite.tpl.html
new file mode 100644
index 0000000..b2566bd
--- /dev/null
+++ b/templates/queries-episode-sqlite.tpl.html
@@ -0,0 +1,51 @@
+
diff --git a/templates/queries-episodes-mysql.tpl.html b/templates/queries-episodes-mysql.tpl.html
new file mode 100644
index 0000000..a0fe9b5
--- /dev/null
+++ b/templates/queries-episodes-mysql.tpl.html
@@ -0,0 +1,15 @@
+
+
diff --git a/templates/queries-episodes-sqlite.tpl.html b/templates/queries-episodes-sqlite.tpl.html
new file mode 100644
index 0000000..9a203b2
--- /dev/null
+++ b/templates/queries-episodes-sqlite.tpl.html
@@ -0,0 +1,15 @@
+
+
diff --git a/templates/queries-ids-episode-mysql.tpl.html b/templates/queries-ids-episode-mysql.tpl.html
new file mode 100644
index 0000000..2f19eb3
--- /dev/null
+++ b/templates/queries-ids-episode-mysql.tpl.html
@@ -0,0 +1,4 @@
+
+
diff --git a/templates/queries-ids-episode-sqlite.tpl.html b/templates/queries-ids-episode-sqlite.tpl.html
new file mode 100644
index 0000000..71e012a
--- /dev/null
+++ b/templates/queries-ids-episode-sqlite.tpl.html
@@ -0,0 +1,4 @@
+
+
diff --git a/templates/queries-index-mysql.tpl.html b/templates/queries-index-mysql.tpl.html
new file mode 100644
index 0000000..120b936
--- /dev/null
+++ b/templates/queries-index-mysql.tpl.html
@@ -0,0 +1,62 @@
+
+
+
+
diff --git a/templates/queries-index-sqlite.tpl.html b/templates/queries-index-sqlite.tpl.html
new file mode 100644
index 0000000..1029b05
--- /dev/null
+++ b/templates/queries-index-sqlite.tpl.html
@@ -0,0 +1,62 @@
+
+
+
+
diff --git a/templates/rss-query-hpr.tpl.xml b/templates/rss-query-hpr.tpl.xml
index 53e32c2..85443c8 100644
--- a/templates/rss-query-hpr.tpl.xml
+++ b/templates/rss-query-hpr.tpl.xml
@@ -3,7 +3,7 @@
SELECT
eps.id,
eps.explicit,
- strftime(\'%H:%M:%S %d:%m:%Y\', date(eps.date)) AS date,
+ DATE_FORMAT(eps.date, \'%H:%i:%S %d:%m:%Y\') AS \'date\',
eps.license, eps.duration,
eps.title, eps.summary, eps.tags,
eps.notes,
@@ -14,7 +14,7 @@
FROM eps
INNER JOIN hosts ON eps.hostid = hosts.hostid
INNER JOIN miniseries ON eps.series = miniseries.id
- WHERE eps.date < date(\'now\', \'+1 days\')
+ WHERE eps.date < DATE_ADD(NOW(), INTERVAL 1 DAY)
ORDER BY eps.date DESC
LIMIT 10
')
diff --git a/templates/rss-query-hpr_total.tpl.xml b/templates/rss-query-hpr_total.tpl.xml
index 1465690..4846f16 100644
--- a/templates/rss-query-hpr_total.tpl.xml
+++ b/templates/rss-query-hpr_total.tpl.xml
@@ -3,7 +3,7 @@
SELECT
eps.id,
eps.explicit,
- strftime(\'%H:%M:%S %d:%m:%Y\', date(eps.date)) AS date,
+ DATE_FORMAT(eps.date, \'%H:%i:%S %d:%m:%Y\') AS \'date\',
eps.license, eps.duration,
eps.title, eps.summary, eps.tags,
eps.notes,
@@ -14,7 +14,7 @@
FROM eps
INNER JOIN hosts ON eps.hostid = hosts.hostid
INNER JOIN miniseries ON eps.series = miniseries.id
- WHERE eps.date < date(\'now\', \'+1 days\')
+ WHERE eps.date < DATE_ADD(NOW(), INTERVAL 1 DAY)
ORDER BY eps.date DESC
')
%-->
diff --git a/templates/shared-call_for_shows.tpl.html b/templates/shared-call_for_shows.tpl.html
index ece6c06..d09e8fc 100644
--- a/templates/shared-call_for_shows.tpl.html
+++ b/templates/shared-call_for_shows.tpl.html
@@ -1,12 +1,9 @@
+
-
-
+