1
0
forked from HPR/hpr_generator

Compare commits

..

2 Commits

Author SHA1 Message Date
013beca3c0 Merge pull request 'Issue #259 - Remove MySQL specific code from site generation code' (#261) from paulj/hpr_generator:remove_mysql_code into main
Reviewed-on: HPR/hpr_generator#261
Reviewed-by: Roan Horning <rho_n@josh@dao-mail.com>
2025-04-07 16:47:15 +00:00
86e1d73085 Remove MySQL specific code from site generation code
- site-generator is generic, so no changes.
 - removed mysql information from site.cfg.
 - Updated template files to call sqlite queries directly.
 - Renamed the query files - remove sqlite from file names.
 - Deleted MySQL specific template files.
2025-04-04 10:28:31 +01:00
42 changed files with 99 additions and 317 deletions

View File

@ -81,7 +81,6 @@ or
`wget --directory-prefix=./ https://www.hackerpublicradio.org/hpr.sql`
You can process the file using SQLite:
## Creating an SQLite database file
The SQL of the hpr.sql file must be converted from MySQL specific statements to
@ -112,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
an SQLite database.
a MySQL or SQLite database.
Find the [DBI] section of the file. It should look like the following
@ -123,8 +122,15 @@ Find the [DBI] section of the file. It should look like the following
#driver: dbi:SQLite:hpr.db
#user: (not used - leave blank)
#password: (not used - leave blank)
# Configuration settings for MySQL
#database: mysql
#driver: dbi:mysql:database=hpr_hpr:hostname=localhost
#user: hpr-generator (Suggested user with read-only privileges)
#password: ********* (Password for user)
```
### SQLite
Remove the comment character from the start of the database and driver
option lines:
@ -140,6 +146,26 @@ 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

@ -1,47 +1,65 @@
# hpr_generator
Static web page generator for the Hacker Public Radio website.
## Installation
Steps necessary to install this generator locally:
* Clone or download this repository
* Install the needed Perl modules using your preferred method (distribution
packages, CPAN, etc.)
* With SQLite
* Create the sqlite3 database from the hpr.sql MySQL dump file available on
hackerpublicradio.org. 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.
* An "update-hpr.sh" helper script is available in the utils directory. This
script will download the hpr.sql file, convert it to the SQLite hpr.db file,
and regenerate the website using the site-generator.
1. `cd` into the root of the project directory
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
* Config::Std
* Template
* Template::Plugin::File
* Template::Plugin::DBI
* Template::Plugin::Date
* Template::Plugin::HTML::Strip
* DBI
* Tie::DBI
* DBD::SQLite or DBD::mysql
* Date::Calc
* Text::CSV_XS
* HTML::Entities
* See the [Getting Started](GETTING_STARTED.md) tutorial for more details on
installing the HPR generator.
## Usage
The following utilities are provided to support the process of
generating the website:
* `utils/update-hpr-db.sh` - Download the database and transform it
into the hpr.db SQLite database.
* `utils/update-hpr.sh` - Download HPR.sql and create the SQLite database
using `update-hpr-db.sh`, then run `site-generator` to create the
website.
* `./site-generator` - Using the information in the templates
directory and the show information in the database, generate the
website. Without parameters, the whole site will be generated.
Generate two specific pages:
`site-generator index about`
If you need to generate specific pages (in this example, index and about):
`site-generator index about`
Having downloaded the database, you can also regenerate the whole site:
`site-generator --all`
Generate the whole site:
`site-generator --all`
Generate pages based on the same template:
`site-generator correspondent=1,3,5..10`
## More Information
* See the [Getting Started](GETTING_STARTED.md) tutorial for more details on
installing and using the HPR generator.
## Support
Please [submit an Issue](https://repo.anhonesthost.net/HPR/hpr_generator/issues),
and add the label "**Help Request**" for help running or installing the site-generator.
For discussing HPR site generation in general, please [submit an Issue](https://repo.anhonesthost.net/HPR/hpr_generator/issues) and add the label "**General Discussion**".
## Contributing
Happy to take any contributions or suggestions.
To contribute code or documentation, please create a fork of the project and [submit a pull request](https://repo.anhonesthost.net/HPR/hpr_generator/pulls) or send a patch. If an issue exists that is related to your patch, please assign the issue to yourself, or if it is already assigned to someone else, please coordinate with them to minimize duplicated efforts.
@ -53,13 +71,9 @@ To make a suggestion, please [submit an Issue](https://repo.anhonesthost.net/HPR
and add the label "**Feature Request**".
## Authors and acknowledgment
* Roan "Rho`n" Horning
* Dave Morriss
* gordons
* Ken Fallon
* norrist
* Paul Jewell (paulj)

View File

@ -7,13 +7,6 @@
# Configuration settings for SQLite
database: sqlite
driver: dbi:SQLite:hpr.db
#user: (not used - leave blank)
#password: (not used - leave blank)
# Configuration settings for MySQL
#database: mysql
#driver: dbi:mysql:database=hpr_hpr:hostname=localhost
#user: hpr-generator (Suggested user with read-only privileges)
#password: ********* (Password for user)
# Configure the location of the templates and the generated HTML
[app_paths]

View File

@ -1,8 +1,9 @@
<!--% PROCESS 'shared-episode-summary.tpl.html' %-->
<!--% PROCESS 'shared-utils.tpl.html' %-->
<!--% PROCESS 'shared-listen-now.tpl.html' %-->
<!--% PROCESS "queries-episode-${constants.database}.tpl.html" %-->
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% PROCESS "queries-episode.tpl.html" %-->
<!--% USE DBI(constants.driver) %-->
<h2>Comment Viewer</h2>
<p>Because of the spammers we have had to turn on comment moderation. Sorry about the delay this will cause.</p>
<p><a href="<!--% absolute_path(baseurl) %-->comments.rss">Subscribe</a> to the comment feed.</p>

View File

@ -1,8 +1,8 @@
<!--% PROCESS 'shared-episode-summary.tpl.html' %-->
<!--% PROCESS 'shared-avatar.tpl.html' %-->
<!--% PROCESS 'shared-utils.tpl.html' %-->
<!--% PROCESS "queries-correspondent-${constants.database}.tpl.html" %-->
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% PROCESS "queries-correspondent.tpl.html" %-->
<!--% USE DBI(constants.driver) %-->
<!--% results_hpr_shows = DBI.prepare(query_hpr_shows)
%-->
<!--% results_hpr_show_count = DBI.prepare(query_hpr_show_count) %-->

View File

@ -3,7 +3,7 @@
<article>
<h2 class="title">Correspondents</h2>
<p>For more information on how to become a Correspondent see our <a href="<!--% absolute_url(baseurl) %-->about.html#so_you_want_to_record_a_podcast">contribute</a></center> page. To add a logo here, either email one to admin at hpr or setup your email on <a href="https://en.gravatar.com/">Gravatar</a>. To protect your browsing privacy we gather the images every hour and serve them directly from HPR.<p />
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% USE DBI(constants.driver) %-->
<!--% host_cnt = 0 %-->
<table class="hosts">
<th >Avatar</th>

View File

@ -3,7 +3,7 @@
<!--% PROCESS 'shared-utils.tpl.html' %-->
<!--% PROCESS 'shared-listen-now.tpl.html' %-->
<!--% PROCESS 'shared-show-transcript.tpl.html' %-->
<!--% PROCESS "queries-episode-${constants.database}.tpl.html" %-->
<!--% PROCESS "queries-episode.tpl.html" %-->
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% query_episodes = DBI.prepare(query_episode_maxmin) %-->
<!--% episode_result = query_episodes.execute(id, id, id, id, id) %-->

View File

@ -1,5 +1,5 @@
<!--% PROCESS 'shared-episode-summary.tpl.html' %-->
<!--% PROCESS "queries-episodes-${constants.database}.tpl.html" %-->
<!--% PROCESS "queries-episodes.tpl.html" %-->
<article>
<header>
<h1>Complete Archive of Shows.</h1>
@ -7,7 +7,7 @@
All this information is available to the public. Scrape if you wish but if we can format the data for you then we're happy to help.
</p>
</header>
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% USE DBI(constants.driver) %-->
<!--% FOREACH episodes IN DBI.query(query_episodes)
%-->
<!--% show_summary(episodes) %-->

View File

@ -4,7 +4,7 @@
<!--% PROCESS 'shared-show-transcript.tpl.html' %-->
<!--% PROCESS 'shared-call_for_shows.tpl.html' %-->
<!--% INCLUDE 'content-index-announcement.tpl.html' %-->
<!--% PROCESS "queries-index-${constants.database}.tpl.html" %-->
<!--% PROCESS "queries-index.tpl.html" %-->
<!--% MACRO tidy_notes(all_lines) BLOCK %-->
<!--% lines = all_lines %-->
<!--% after_html = all_lines %-->
@ -29,7 +29,7 @@
<h3>Welcome to HPR, the Community Podcast</h3>
</header>
<!--% days_till_next_episode = 0 %-->
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% USE DBI(constants.driver) %-->
<!--% USE date %-->
<!--% calc = date.calc %-->
<!--% episodes = DBI.query(query_next_available_episode).get_all() %-->

View File

@ -1,7 +1,7 @@
<!--% PROCESS 'shared-utils.tpl.html' %-->
<!--% PROCESS "queries-series-${constants.database}.tpl.html" %-->
<!--% PROCESS "queries-series.tpl.html" %-->
<article>
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% USE DBI(constants.driver) %-->
<h1 class="title">In-Depth Series</h1>
<!--% FOREACH series IN DBI.query(query_episodes) %-->
<h2><a href="<!--% absolute_path(baseurl) %-->series/<!--% zero_pad_left(series.id) %-->.html"><!--% series.name %--></a></h2>

View File

@ -1,7 +1,7 @@
<!--% PROCESS 'shared-episode-summary.tpl.html' %-->
<!--% PROCESS 'shared-avatar.tpl.html' %-->
<!--% PROCESS "queries-series_episodes-${constants.database}.tpl.html" %-->
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% PROCESS "queries-series_episodes.tpl.html" %-->
<!--% USE DBI(constants.driver) %-->
<!--% query_series = DBI.prepare(query_series_sql)
%-->
<!--% series_result = query_series.execute(id) %-->

View File

@ -1,6 +1,6 @@
<!--% PROCESS 'shared-utils.tpl.html' %-->
<!--% PROCESS "queries-tags-${constants.database}.tpl.html" %-->
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% PROCESS "queries-tags.tpl.html" %-->
<!--% USE DBI(constants.driver) %-->
<!--% PERL %-->
$Template::Stash::PRIVATE = undef; # Allow . in tag
<!--% END %-->

View File

@ -2,7 +2,7 @@
<!--% PROCESS 'shared-avatar.tpl.html' %-->
<!--% PROCESS 'shared-utils.tpl.html' %-->
<!--% PROCESS 'shared-listen-now.tpl.html' %-->
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% USE DBI(constants.driver) %-->
<!--% query_episodes = DBI.prepare('
WITH episode_maxmin AS (
SELECT MAX(id) AS \'latest\', MIN(id) AS \'earliest\', ? AS \'id\'

View File

@ -1,4 +1,4 @@
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% USE DBI(constants.driver) %-->
<!--% FOREACH host IN DBI.query(
'select h.hostid from hosts as h'
) %-->

View File

@ -1,5 +1,5 @@
<!--% PROCESS "queries-ids-episode-${constants.database}.tpl.html" %-->
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% PROCESS "queries-ids-episode.tpl.html" %-->
<!--% USE DBI(constants.driver) %-->
<!--% FOREACH episode IN DBI.query(query_ids_episode) %-->
,<!--% episode.id %-->
<!--% END %-->

View File

@ -1,4 +1,4 @@
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% USE DBI(constants.driver) %-->
<!--% FOREACH episode IN DBI.query(
'select eps.id from twat_eps AS eps'
) %-->

View File

@ -1,6 +0,0 @@
<!--% query_call_for_shows = '
SELECT CASE WHEN COUNT(id) < 6 THEN True ELSE False END AS `request_for_shows`
FROM eps
WHERE eps.date > NOW() AND eps.date <= DATE_ADD(NOW(), INTERVAL 10 DAY)
'
%-->

View File

@ -1,24 +0,0 @@
<!--% query_hpr_shows = '
SELECT
eps.id,
eps.explicit,
eps.date, eps.license, eps.duration,
eps.title, eps.summary, eps.tags,
eps.notes,
hosts.local_image,
hosts.hostid,
hosts.host, hosts.email, hosts.profile,
miniseries.name AS series, miniseries.id AS seriesid
FROM eps
INNER JOIN hosts ON eps.hostid = hosts.hostid
INNER JOIN miniseries ON eps.series = miniseries.id
WHERE hosts.hostid = ? AND eps.date < DATE_ADD(NOW(), INTERVAL 1 DAY)
ORDER BY eps.id DESC
'
%-->
<!--% query_hpr_show_count = '
SELECT id
FROM eps
WHERE eps.hostid = ? AND eps.date < DATE_ADD(NOW(), INTERVAL 1 DAY)
'
%-->

View File

@ -1,51 +0,0 @@
<!--% query_episode_maxmin = '
WITH episode_maxmin AS (
SELECT MAX(id) AS \'latest\', MIN(id) AS \'earliest\', ? AS \'id\'
FROM eps
WHERE eps.date <= UTC_DATE()
),
episode_date AS (
SELECT eps.date
FROM eps
WHERE eps.id = ?
),
episode_previous AS (
SELECT MAX(id) AS \'previous\', ? AS \'id\'
FROM eps
INNER JOIN episode_date
ON eps.date < episode_date.date
WHERE eps.id > 1
),
episode_next AS (
SELECT MIN(id) AS \'next\', ? AS \'id\'
FROM eps
INNER JOIN episode_date
ON eps.date > episode_date.date
WHERE eps.date <= NOW()
),
comment_tallies AS (
SELECT
eps_id,
COUNT(eps_id) AS eps_tally
FROM comments
GROUP BY eps_id
)
SELECT eps.id, eps.date, eps.title, eps.duration,
eps.summary, eps.notes, eps.explicit, eps.license,
eps.tags, eps.version, eps.downloads, eps.valid,
episode_maxmin.latest, episode_maxmin.earliest,
episode_previous.previous, episode_next.next,
hosts.hostid, hosts.host,
miniseries.name AS \'series\', miniseries.id AS \'seriesid\',
miniseries.description AS \'series_description\',
COALESCE (comment_tallies.eps_tally, 0) AS eps_tally
FROM eps
INNER JOIN hosts ON eps.hostid = hosts.hostid
INNER JOIN miniseries ON eps.series = miniseries.id
INNER JOIN episode_maxmin ON eps.id = episode_maxmin.id
INNER JOIN episode_previous ON eps.id = episode_previous.id
INNER JOIN episode_next ON eps.id = episode_next.id
LEFT JOIN comment_tallies ON eps.id = comment_tallies.eps_id
WHERE eps.id = ?
'
%-->

View File

@ -1,15 +0,0 @@
<!--% query_episodes = 'SELECT
eps.id,
eps.explicit,
eps.date, eps.license, eps.title, eps.summary,
eps.duration, eps.notes, eps.tags,
hosts.hostid,
hosts.host, hosts.email, hosts.local_image,
miniseries.name AS series, miniseries.id AS seriesid
FROM eps
INNER JOIN hosts ON eps.hostid = hosts.hostid
INNER JOIN miniseries ON eps.series = miniseries.id
WHERE eps.date <= UTC_DATE()
ORDER BY eps.id DESC'
%-->

View File

@ -1,2 +0,0 @@
<!--% query_ids_episode = 'select eps.id from eps order by eps.id' %-->

View File

@ -1,58 +0,0 @@
<!--% query_next_available_episode = '
SELECT id, date FROM eps e WHERE id = (
SELECT id + 1 FROM eps mo
WHERE NOT EXISTS (
SELECT NULL
FROM eps mi
WHERE mi.id = mo.id + 1
)
ORDER BY id
LIMIT 1) - 1
'
%-->
<!--% query_latest_episodes = '
WITH comment_tallies AS (
SELECT
eps_id,
COUNT(eps_id) AS eps_tally
FROM comments
GROUP BY eps_id
)
SELECT
eps.id,
eps.explicit,
eps.date, eps.license, eps.duration,
eps.title, eps.summary, eps.tags,
eps.notes,
hosts.local_image,
hosts.hostid,
hosts.host, hosts.email,
miniseries.name AS series, miniseries.id AS seriesid,
COALESCE (comment_tallies.eps_tally, 0) AS eps_tally
FROM eps
INNER JOIN hosts ON eps.hostid = hosts.hostid
INNER JOIN miniseries ON eps.series = miniseries.id
LEFT JOIN comment_tallies ON eps.id = comment_tallies.eps_id
WHERE eps.date <= UTC_DATE()
ORDER BY eps.id DESC
LIMIT 10
'
%-->
<!--% query_last_5_weeks_episodes = '
SELECT
eps.id,
eps.explicit,
eps.date, eps.license, eps.title, eps.summary,
eps.duration, eps.notes, eps.tags,
hosts.hostid,
hosts.host, hosts.email, hosts.local_image,
miniseries.name AS series, miniseries.id AS seriesid
FROM eps
INNER JOIN hosts ON eps.hostid = hosts.hostid
INNER JOIN miniseries ON eps.series = miniseries.id
WHERE eps.date <= UTC_DATE()
ORDER BY eps.id DESC
LIMIT 30 OFFSET 10
'
%-->

View File

@ -1,15 +0,0 @@
<!--% query_episodes = 'SELECT miniseries.id, miniseries.name, miniseries.description,
miniseries.private, miniseries.image, miniseries.valid,
ep.number_of_episodes, ep.latest_show, ep.earliest_show
FROM miniseries
INNER JOIN
(SELECT series,
COUNT(eps.id) AS number_of_episodes,
MAX(eps.date) AS latest_show,
MIN(eps.date) AS earliest_show
FROM eps
WHERE eps.date < DATE_ADD(NOW(), INTERVAL 1 DAY)
GROUP BY series) AS ep ON ep.series = miniseries.id
ORDER BY name'
%-->

View File

@ -1,29 +0,0 @@
<!--% query_series_sql = 'SELECT miniseries.id, miniseries.name,
miniseries.description,
miniseries.private, miniseries.image, miniseries.valid,
ep.number_of_episodes, ep.latest_show, ep.earliest_show
FROM miniseries
INNER JOIN
(SELECT series,
COUNT(eps.id) AS number_of_episodes,
MAX(eps.date) AS latest_show,
MIN(eps.date) AS earliest_show
FROM eps
WHERE eps.date < DATE_ADD(NOW(), INTERVAL 1 DAY)
GROUP BY series) AS ep ON ep.series = miniseries.id
WHERE miniseries.id = ?
ORDER BY name'
%-->
<!--% query_shows_sql = 'SELECT
id, date, title,
duration, summary, notes,
explicit, eps.license, tags,
hosts.host, hosts.hostid
FROM eps
INNER JOIN hosts
ON eps.hostid = hosts.hostid
WHERE series = ? AND eps.date < DATE_ADD(NOW(), INTERVAL 1 DAY)
ORDER BY eps.id DESC
'
%-->

View File

@ -1 +0,0 @@
<!--% query_tags = 'SELECT id, tags FROM eps' %-->

View File

@ -24,7 +24,7 @@
<width>144</width>
</image>
<atom:link href="<!--% absolute_url(http_baseurl) %-->comments.rss" rel="self" type="application/rss+xml" />
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% USE DBI(constants.driver) %-->
<!--% FOREACH response IN DBI.query('SELECT max( comment_timestamp) AS latest_update FROM comments') %-->
<pubDate><!--% format_feed_date(response.latest_update) %--></pubDate>

View File

@ -1,5 +1,5 @@
<!--% PROCESS 'shared-item.tpl.xml' %-->
<!--% PROCESS "rss-query-hpr-${constants.database}.tpl.xml" %-->
<!--% PROCESS "rss-query-hpr.tpl.xml" %-->
<!--% FOREACH episode IN feed_result %-->
<!--% display_item(episode, media_file_extension, audio_mime_type) %-->
<!--% END %-->

View File

@ -1,5 +1,5 @@
<!--% PROCESS 'shared-item.tpl.xml' %-->
<!--% PROCESS "rss-query-hpr_total-${constants.database}.tpl.xml" %-->
<!--% PROCESS "rss-query-hpr_total.tpl.xml" %-->
<!--% FOREACH episode IN feed_result %-->
<!--% display_item(episode, media_file_extension, audio_mime_type) %-->
<!--% END %-->

View File

@ -1,26 +0,0 @@
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% query_hpr_feed = DBI.prepare('
SELECT
eps.id,
eps.explicit,
DATE_FORMAT(eps.date, \'%H:%i:%S %d:%m:%Y\') AS \'date\',
eps.license, eps.duration,
eps.title, eps.summary, eps.tags,
eps.notes,
hosts.local_image,
hosts.hostid,
hosts.host, hosts.email,
miniseries.name AS series, miniseries.id AS seriesid,
assets.size AS length
FROM eps
INNER JOIN hosts ON eps.hostid = hosts.hostid
INNER JOIN miniseries ON eps.series = miniseries.id
INNER JOIN assets ON eps.id = assets.episode_id
WHERE eps.date <= UTC_DATE()
AND assets.extension = ?
ORDER BY eps.date DESC
LIMIT 10
')
%-->
<!--% feed_result = query_hpr_feed.execute(media_file_extension) %-->

View File

@ -1,4 +1,4 @@
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% USE DBI(constants.driver) %-->
<!--% query_hpr_feed = DBI.prepare('
SELECT
eps.id,

View File

@ -1,25 +0,0 @@
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% query_hpr_feed = DBI.prepare('
SELECT
eps.id,
eps.explicit,
DATE_FORMAT(eps.date, \'%H:%i:%S %d:%m:%Y\') AS \'date\',
eps.license, eps.duration,
eps.title, eps.summary, eps.tags,
eps.notes,
hosts.local_image,
hosts.hostid,
hosts.host, hosts.email,
miniseries.name AS series, miniseries.id AS seriesid,
assets.size AS length
FROM eps
INNER JOIN hosts ON eps.hostid = hosts.hostid
INNER JOIN miniseries ON eps.series = miniseries.id
INNER JOIN assets ON eps.id = assets.episode_id
WHERE eps.date < UTC_DATE()
AND assets.extension = ?
ORDER BY eps.date DESC
')
%-->
<!--% feed_result = query_hpr_feed.execute(media_file_extension) %-->

View File

@ -1,4 +1,4 @@
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% USE DBI(constants.driver) %-->
<!--% query_hpr_feed = DBI.prepare('
SELECT
eps.id,

View File

@ -1,5 +1,5 @@
<!--% PROCESS 'shared-utils.tpl.html' %-->
<!--% PROCESS "queries-call_for_shows-${constants.database}.tpl.html" %-->
<!--% PROCESS "queries-call_for_shows.tpl.html" %-->
<!--% MACRO display_call_for_shows BLOCK %-->
<!--% result_call_for_shows = DBI.prepare(query_call_for_shows) %-->
<!--% results_call_for_shows = result_call_for_shows.execute().get_all() %-->