Archived
4
2

Compare commits

...

3 Commits

6 changed files with 92 additions and 39 deletions

View File

@ -1,21 +1,9 @@
<!--% PROCESS 'shared-utils.tpl.html' %-->
<!--% PROCESS "queries-series-${constants.database}.tpl.html" %-->
<article>
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<h1 class="title">In-Depth Series</h1>
<!--% FOREACH series IN DBI.query(
'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
GROUP BY series) AS ep ON ep.series = miniseries.id
ORDER BY name'
) %-->
<!--% FOREACH series IN DBI.query(query_episodes) %-->
<h2><a href="<!--% absolute_path(baseurl) %-->series/<!--% zero_pad_left(series.id) %-->.html"><!--% series.name %--></a></h2>
<ul>
<li>Number of episodes: <!--% series.number_of_episodes %--></li>

View File

@ -1,20 +1,8 @@
<!--% 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) %-->
<!--% query_series = DBI.prepare('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
GROUP BY series) AS ep ON ep.series = miniseries.id
WHERE miniseries.id = ?
ORDER BY name')
<!--% query_series = DBI.prepare(query_series_sql)
%-->
<!--% series_result = query_series.execute(id) %-->
<article>
@ -29,17 +17,7 @@
</ul>
<div><em><!--% series.description %--></em></div>
<!--% END %-->
<!--% query_shows = DBI.prepare('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 = ?
ORDER BY eps.id DESC
')
<!--% query_shows = DBI.prepare(query_shows_sql)
%-->
<!--% show_results = query_shows.execute(id) %-->
<!--% FOREACH show IN show_results %-->

View File

@ -0,0 +1,15 @@
<!--% 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

@ -0,0 +1,15 @@
<!--% 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(\'now\', \'+1 days\')
GROUP BY series) AS ep ON ep.series = miniseries.id
ORDER BY name'
%-->

View File

@ -0,0 +1,29 @@
<!--% 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

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