Archived
4
2

Compare commits

..

13 Commits

Author SHA1 Message Date
2a486cb58b
Add SQLite specific query templates 2023-02-08 16:05:36 -05:00
71a63e1beb
Merge branch 'main' into MySQL 2022-12-31 18:39:25 -05:00
8e1232517a Update New Year's Eve show 2023 2022-12-31 15:55:39 -05:00
cb65d25cfc
Refactor MySQL database specific SQL 2022-11-28 22:47:53 -05:00
2b4802508d
Remove superflous WHERE condition 2022-11-28 19:55:51 -05:00
1312e3d374
Refactor MySQL database specific SQL 2022-11-28 19:52:39 -05:00
3cc6da57ad
Refactor MySQL database specific SQL 2022-11-28 19:49:06 -05:00
675f8fa9d5
Refactor MySQL database specific SQL 2022-11-27 14:04:12 -05:00
6f28bb2a16
Refactor MySQL database specific SQL 2022-11-27 13:54:14 -05:00
cb881558ca
Add database type constant for use in templates
This is used to select which database specific SQL query to use.
2022-11-27 13:11:14 -05:00
4e8edf2640
Merge branch 'main' into MySQL 2022-11-11 20:27:47 -05:00
Roan Horning
e86d2c010d Merge pull request '[I60] Implement call for shows feature' (#61) from I60_call-for-shows into main
Reviewed-on: #61
2022-11-11 03:18:38 +00:00
f0fa21ae45
Implement call for shows feature
Add display_call_for_shows MACRO. Update index template to include
call to display_call_for_shows.
2022-11-10 22:14:55 -05:00
24 changed files with 359 additions and 161 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B

View File

@ -198,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},

View File

@ -2,6 +2,7 @@
# with the database.
# dbi:<driver name [SQLite, CSV, ADO, mSQL, etc.]>:<database name>
[DBI]
database: mysql
driver: dbi:mysql:database=hpr_hpr:hostname=localhost
user: hpr-generator
password: zBozqN-Z2zNAz

View File

@ -1,6 +1,7 @@
<!--% 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) %-->
<!--% query_hpr_show_count = DBI.prepare('
SELECT id
@ -8,26 +9,10 @@
WHERE eps.hostid = ?
')
%-->
<!--% query_hpr_shows = DBI.prepare('
SELECT
eps.id,
CASE eps.explicit WHEN 1 THEN \'Explicit\' ELSE \'Clean\' END AS 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
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
')
<!--% results_hpr_shows = DBI.prepare(query_hpr_shows)
%-->
<!--% hpr_shows_to_count = query_hpr_show_count.execute(id); %-->
<!--% hpr_shows = query_hpr_shows.execute(id); %-->
<!--% hpr_shows = results_hpr_shows.execute(id); %-->
<!--% hpr_show_count = 0 %-->
<!--% FOREACH show IN hpr_shows_to_count %-->
<!--% hpr_show_count = hpr_show_count +1; %-->

View File

@ -2,57 +2,9 @@
<!--% PROCESS 'shared-avatar.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) %-->
<!--% query_episodes = DBI.prepare('
WITH episode_maxmin AS (
SELECT MAX(id) AS \'latest\', MIN(id) AS \'earliest\', ? AS \'id\'
FROM eps
WHERE eps.date < DATE_ADD(NOW(), INTERVAL 1 DAY)
),
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 = ?
')
<!--% query_episodes = DBI.prepare(query_episode_maxmin)
%-->
<!--% episode_result = query_episodes.execute(id, id, id, id, id) %-->
<!--% FOREACH episode IN episode_result %-->

View File

@ -1,4 +1,5 @@
<!--% PROCESS 'shared-episode-summary.tpl.html' %-->
<!--% PROCESS "queries-episodes-${constants.database}.tpl.html" %-->
<article>
<header>
<h1>Complete Archive of Shows.</h1>
@ -7,21 +8,7 @@
</p>
</header>
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% FOREACH episodes IN DBI.query('
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 < DATE_ADD(NOW(), INTERVAL 1 DAY)
ORDER BY eps.id DESC
')
<!--% FOREACH episodes IN DBI.query(query_episodes)
%-->
<!--% show_summary(episodes) %-->
<!--% END %-->

View File

@ -1,17 +1,16 @@
<!--% PROCESS 'shared-utils.tpl.html' %-->
<hr>
<h2><u>The Eleventh Annual 26 Hour New Years Eve Show</u></h2>
<!--
<p>
<img src="livestream.png" /><br />
<img src="<!--% absolute_path(baseurl) %-->images/livestream.png" /><br />
<audio controls autoplay>
<source src="http://shownotes.ooguy.com:8000/stream" type="audio/mpeg" >
<source src="https://stream.lugcast.mywire.org/stream" type="audio/mpeg" >
</audio> <br />
<a href="http://shownotes.ooguy.com:8000/stream">http://shownotes.ooguy.com:8000/stream.m3u</a><br />
<a href="https://stream.lugcast.mywire.org/stream">https://stream.lugcast.mywire.org/stream</a><br />
<a href="https://hackerpublicradio.org/live">https://hackerpublicradio.org/live</a><br />
</p>
-->
<h3>Welcome every <a href="https://www.timeanddate.com/counters/multicountdown.html">TimeZone</a>!</h3>
<p><em>If you keep talking, we'll keep recording.</em> </p>
@ -34,11 +33,11 @@ Channel: <strong>HPR</strong></p>
<p>For those who have never used Mumble before, see this <a href="<!--% absolute_path(baseurl) %-->mumble-howto.html">how-to explaining the setup of the desktop Mumble client</a>, or listen to <a href="<!--% absolute_path(baseurl) %-->eps/hpr3503/index.html">hpr3503 :: Configuring Mumble</a>.</p>
<!--<h3>Add to the Show-notes</h3>
<h3>Add to the Show-notes</h3>
<p>
<strong>Please help fill out the show notes</strong><br />
<a href="http://shownotes.ooguy.com:9001/p/HPR-NYE-2022">http://shownotes.ooguy.com:9001/p/HPR-NYE-2022</a><br />
<a href="https://shownotes.lugcast.mywire.org/p/hpr-nye-2022">https://shownotes.lugcast.mywire.org/p/hpr-nye-2022</a><br />
We are using Etherpad for people to share links and info to things they are discussing. The Etherpad will be used for the HPR audio shownotes so please feel free to add to it. The entire event will be broken into 2 to 3 hour segments and made available as HPR episodes.<br/>
<em>This really, really helps us out to post the show faster !</em>
</p>
@ -49,9 +48,9 @@ We are using Etherpad for people to share links and info to things they are disc
We're going to release the show as a podcast, so it would be great if you could grab a copy as a backup.
<pre>
while true;do timestamp="$HOSTNAME-$(\date -u +%Y-%m-%d_%H-%M-%SZ_%A)"; echo "Recording ${timestamp}";cvlc "http://shownotes.ooguy.com:8000/stream.m3u" --sout "file/mp3:${timestamp}.mp3" --run-time="3600" vlc://quit;done
while true;do timestamp="$HOSTNAME-$(\date -u +%Y-%m-%d_%H-%M-%SZ_%A)"; echo "Recording ${timestamp}";cvlc "https://stream.lugcast.mywire.org/stream" --sout "file/mp3:${timestamp}.mp3" --run-time="3600" vlc://quit;done
</pre>
</p>-->
</p>
<!--
while true;do ffmpeg -i https://hackerpublicradio.org/live -c copy hprnye-$( \date -u +%s )-$( \date -u +%Y%m%dT%H%M%SZ )-${HOSTNAME}.mp3; done
@ -59,7 +58,6 @@ while true;do ffmpeg -i https://hackerpublicradio.org/live -c copy hprnye-$( \da
<p>
The show will be held on the <a href="mumble://chatter.skyehaven.net:64738/Hacker%20Public%20Radio?version=1.2.0">HPR Room on Mumble</a>, so now you can prepare by installing the <a href="https://wiki.mumble.info/wiki/Main_Page">mumble PC Client</a>, or the <a href="https://f-droid.org/packages/se.lublin.mumla">mumla Android Client</a>. The Server we will use is: <strong>chatter.skyehaven.net</strong>, Port: <strong>64738</strong>, Channel: <strong>HPR</strong>
</p>
-->
<h3>Spread the Word</h3>
@ -69,7 +67,6 @@ The show will be held on the <a href="mumble://chatter.skyehaven.net:64738/Hacke
<source src="https://hackerpublicradio.org/promote/new-year-show-promo.mp3" type="audio/mpeg" >
</audio></p>
<!--
<p>
If you prefer to just listen to the show and not participate using Mumble, use the link below for the live audio stream using your web browser or favorite audio application such as VLC, or live in your web browser.<br/>
</p>

View File

@ -1,7 +1,9 @@
<!--% PROCESS 'shared-avatar.tpl.html' %-->
<!--% PROCESS 'shared-utils.tpl.html' %-->
<!--% PROCESS 'shared-listen-now.tpl.html' %-->
<!--% PROCESS 'shared-call_for_shows.tpl.html' %-->
<!--% INCLUDE 'content-index-announcement.tpl.html' %-->
<!--% PROCESS "queries-index-${constants.database}.tpl.html" %-->
<hr>
<article>
<header>
@ -9,21 +11,7 @@
</header>
<!--% days_till_next_episode = 0 %-->
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% FOREACH next_available_episode_result IN DBI.query('
WITH next_id AS (
SELECT id, id + 1 AS \'id_next\', date as \'last_date\'
FROM eps
WHERE eps.date > NOW()
)
SELECT
MIN(next_id.id_next) AS \'next_id\',
DATE_FORMAT(MIN(last_date), \'%Y\') AS \'last_year\',
DATE_FORMAT(MIN(last_date), \'%d\') AS \'last_day\',
DATE_FORMAT(MIN(last_date), \'%m\') AS \'last_month\'
FROM next_id
LEFT JOIN eps ON next_id.id_next = eps.id
WHERE eps.id IS NULL
')
<!--% FOREACH next_available_episode_result IN DBI.query(query_next_available_episode)
%-->
<!--% USE date %-->
<!--% calc = date.calc %-->
@ -32,7 +20,10 @@
<!--% USE date %-->
<!--% delta = date.calc.N_Delta_YMD(2005,9,19, date.format(date.now, '%Y'),date.format(date.now, '%m'),date.format(date.now, '%d')) %-->
<p>We started producing shows as <a href="<!--% absolute_path(baseurl) %-->eps/index.html#twat_episodes"><em>Today with a Techie</em></a> on 2005-09-19, <!--% delta.0 %--> years, <!--% delta.1 %--> months, <!--% delta.2 %--> days ago. our shows are produced by <a href="<!--% absolute_path(baseurl) %-->correspondents/index.html">listeners</a> like you and can be on any <a href="<!--% absolute_path(baseurl) %-->eps/index.html">topic</a> that <strong>"are of interest to <a href="https://en.wikipedia.org/wiki/hacker_(hobbyist)">hackers</a>"</strong>. if you listen to HPR then please consider contributing one show a year. if you <a href="<!--% absolute_path(baseurl) %-->contribute.html">record</a> your show now it could be <a href="https://www.hackerpublicradio.org/calendar.php">released</a> in <strong><!--% days_till_next_episode %--></strong> days.</p>
<h4>Meet the team</h4>
</article>
<!--% display_call_for_shows() %-->
<article>
<h4>Meet the team</h4>
<p>
<audio controls preload="none">";
<source src="<!--% absolute_path(baseurl) %-->media/promos/all-hpr-hosts.ogg" type="audio/ogg" >
@ -43,33 +34,7 @@
<hr>
<!--% PROCESS 'shared-episode-summary.tpl.html' %-->
<h1>Latest Shows</h1>
<!--% FOREACH latest_episodes IN DBI.query('
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 < DATE_ADD(NOW(), INTERVAL 1 DAY)
ORDER BY eps.id DESC
LIMIT 10
')
<!--% FOREACH latest_episodes IN DBI.query(query_latest_episodes)
%-->
<hr>
<article>
@ -95,22 +60,7 @@
<hr>
<h1>Previous five weeks</h1>
</header>
<!--% FOREACH last_5_weeks_episodes IN DBI.query('
SELECT
eps.id,
CASE eps.explicit WHEN 1 THEN \'Explicit\' ELSE \'Clean\' END AS 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 < DATE_ADD(NOW(), INTERVAL 1 DAY)
ORDER BY eps.id DESC
LIMIT 30 OFFSET 10
')
<!--% FOREACH last_5_weeks_episodes IN DBI.query(query_last_5_weeks_episodes)
%-->
<!--% show_summary(last_5_weeks_episodes) %-->
<!--% END %-->

View File

@ -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_ADD(NOW(), INTERVAL 1 DAY)
),
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 < NOW()
)
SELECT eps.id, eps.date, eps.title, eps.duration,
eps.summary, eps.notes, eps.explicit, eps.license,

View File

@ -1,8 +1,6 @@
<!--% PROCESS "queries-ids-episode-${constants.database}.tpl.html" %-->
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% FOREACH episode IN DBI.query(
'select eps.id from eps
where eps.date < DATE_ADD(NOW(), INTERVAL 1 DAY) '
) %-->
<!--% FOREACH episode IN DBI.query(query_ids_episode) %-->
,<!--% episode.id %-->
<!--% END %-->

View File

@ -1,7 +1,6 @@
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% FOREACH episode IN DBI.query(
'select eps.id from twat_eps AS eps
where eps.date < DATE_ADD(NOW(), INTERVAL 1 DAY) '
'select eps.id from twat_eps AS eps'
) %-->
,<!--% episode.id %-->
<!--% END %-->

View File

@ -0,0 +1,6 @@
<!--% query_call_for_shows = '
SELECT CASE WHEN COUNT(id) < 7 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

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

View File

@ -0,0 +1,18 @@
<!--% query_hpr_shows = '
SELECT
eps.id,
CASE eps.explicit WHEN 1 THEN \'Explicit\' ELSE \'Clean\' END AS 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
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
'
%-->

View File

@ -0,0 +1,18 @@
<!--% query_hpr_shows = '
SELECT
eps.id,
CASE eps.explicit WHEN 1 THEN \'Explicit\' ELSE \'Clean\' END AS 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
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(\'now\', \'+1 days\')
ORDER BY eps.id + 0 DESC
'
%-->

View File

@ -0,0 +1,51 @@
<!--% query_episode_maxmin = '
WITH episode_maxmin AS (
SELECT MAX(id) AS \'latest\', MIN(id) AS \'earliest\', ? AS \'id\'
FROM eps
WHERE eps.date < DATE_ADD(NOW(), INTERVAL 1 DAY)
),
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

@ -0,0 +1,51 @@
<!--% query_episode_maxmin = '
WITH episode_maxmin AS (
SELECT MAX(id) AS \'latest\', MIN(id) AS \'earliest\', ? AS \'id\'
FROM eps
WHERE eps.date < date(\'now\', \'+1 days\')
),
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 < 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

@ -0,0 +1,15 @@
<!--% 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 < DATE_ADD(NOW(), INTERVAL 1 DAY)
ORDER BY eps.id DESC'
%-->

View File

@ -0,0 +1,15 @@
<!--% 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 < date(\'now\', \'+1 days\')
ORDER BY eps.id + 0 DESC'
%-->

View File

@ -0,0 +1,4 @@
<!--% query_ids_episode = 'select eps.id from eps
where eps.date < DATE_ADD(NOW(), INTERVAL 1 DAY) '
%-->

View File

@ -0,0 +1,4 @@
<!--% query_ids_episode = 'select eps.id from eps
where eps.date < date(\'now\', \'+1 days\')'
%-->

View File

@ -0,0 +1,62 @@
<!--% query_next_available_episode = '
WITH next_id AS (
SELECT id, id + 1 AS \'id_next\', date as \'last_date\'
FROM eps
WHERE eps.date > NOW()
)
SELECT
MIN(next_id.id_next) AS \'next_id\',
DATE_FORMAT(MIN(last_date), \'%Y\') AS \'last_year\',
DATE_FORMAT(MIN(last_date), \'%d\') AS \'last_day\',
DATE_FORMAT(MIN(last_date), \'%m\') AS \'last_month\'
FROM next_id
LEFT JOIN eps ON next_id.id_next = eps.id
WHERE eps.id IS NULL
'
%-->
<!--% 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 < DATE_ADD(NOW(), INTERVAL 1 DAY)
ORDER BY eps.id DESC
LIMIT 10
'
%-->
<!--% query_last_5_weeks_episodes = '
SELECT
eps.id,
CASE eps.explicit WHEN 1 THEN \'Explicit\' ELSE \'Clean\' END AS 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 < DATE_ADD(NOW(), INTERVAL 1 DAY)
ORDER BY eps.id DESC
LIMIT 30 OFFSET 10
'
%-->

View File

@ -0,0 +1,62 @@
<!--% query_next_available_episode = '
WITH next_id AS (
SELECT id, id + 1 AS \'id_next\', date as \'last_date\'
FROM eps
WHERE eps.date > date(\'now\')
)
SELECT
MIN(next_id.id_next) AS \'next_id\',
strftime(\'%Y\', MIN (last_date)) AS \'last_year\',
strftime(\'%d\', MIN (last_date)) AS \'last_day\',
strftime(\'%m\', MIN (last_date)) AS \'last_month\'
FROM next_id
LEFT JOIN eps ON next_id.id_next = eps.id
WHERE eps.id IS NULL
'
%-->
<!--% 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 < date(\'now\', \'+1 days\')
ORDER BY eps.id + 0 DESC
LIMIT 10
'
%-->
<!--% query_last_5_weeks_episodes = '
SELECT
eps.id,
CASE eps.explicit WHEN 1 THEN \'Explicit\' ELSE \'Clean\' END AS 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 < date(\'now\', \'+1 days\')
ORDER BY eps.id + 0 DESC
LIMIT 30 OFFSET 10
'
%-->

View File

@ -0,0 +1,18 @@
<!--% PROCESS 'shared-utils.tpl.html' %-->
<!--% PROCESS "queries-call_for_shows-${constants.database}.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() %-->
<!--% IF results_call_for_shows.0.request_for_shows == 1 %-->
<!--% USE date %-->
<article>
<header>
<h3>Call for shows</h3>
</header>
<p><strong><em>We are running very low on shows</em></strong> at the moment. Have a look at the <a href="<!--% absolute_path(baseurl) %-->correspondents/index.html">hosts</a> page and if you don't see "<!--% date.format(date.now, '%Y') %-->-??-??" next to your name, or if your name is not listed, you might consider sending us in something.</p>
<!-- <img src="/images/hprstats.png" alt="hpr queue showing an graph showing how few shows we have" /> -->
<p>There are no files to process on the FTP server.</p>
</article>
<!--% END %-->
<!--% END %-->