<!--% PROCESS 'shared-avatar.tpl.html' %-->
<!--% PROCESS 'shared-utils.tpl.html' %-->
<!--% PROCESS 'shared-listen-now.tpl.html' %-->
<hr>
  <article>
    <header>
        <h3>Welcome to HPR the Community Podcast</h3>
    </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 > 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
	')
	%-->
	<!--% USE date %-->
	<!--% calc = date.calc %-->
	<!--%  days_till_next_episode = calc.Delta_Days(date.format(date.now, '%Y'),date.format(date.now, '%m'),date.format(date.now, '%d'),next_available_episode_result.last_year,next_available_episode_result.last_month,next_available_episode_result.last_day + 1) %-->
	<!--% END %-->
	<!--% 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>
    <p>
    <audio controls preload="none">";
        <source src="<!--% absolute_path(baseurl) %-->media/promos/all-hpr-hosts.ogg" type="audio/ogg" >
        <source src="<!--% absolute_path(baseurl) %-->media/promos/all-hpr-hosts.mp3" type="audio/mpeg" >
    </audio>
    </p>
  </article>
  <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(\'now\', \'+1 days\')
	ORDER BY date DESC 
	LIMIT 10
	')
%-->
<hr>
<article>
	<header>
			<h1><a href="<!--% absolute_path(baseurl) %-->eps/hpr<!--% zero_pad_left(latest_episodes.id) %-->/index.html">hpr<!--% latest_episodes.id %--> :: <!--% latest_episodes.title %--></a></h1>
		<h3><!--% latest_episodes.summary%--></h3>
		<p class="meta"$><!--% IF get_avatar(latest_episodes.hostid) != 'hpr_logo.png' %-->
		<img src="<!--% absolute_path(baseurl) %-->images/<!--% get_avatar(latest_episodes.hostid) %-->" height="80" width="80" alt="" /></a><!--% END %-->
	<br>Hosted by <a href="<!--% absolute_path(baseurl) %-->correspondents/<!--% zero_pad_left(latest_episodes.hostid) %-->.html"><!--% latest_episodes.host %--></a> on <!--% latest_episodes.date %--> is flagged as <!--% display_explicit(latest_episodes.explicit) %--> and released under a <!--% latest_episodes.license %--> license. <br>
<!--% display_tags(latest_episodes.tags) %--><br>
<small><!--% display_listen_in(latest_episodes.id) %--> <!--% show_series(latest_episodes.series, latest_episodes.seriesid) %--> | 
<!--% display_comments_tally(latest_episodes.id, latest_episodes.eps_tally) %--></small>
		</p>
	</header>
		<!--% latest_episodes.notes %-->
	<footer>
		<!--% listen_now(latest_episodes, "hpr", baseurl, media_hostname) %-->
	</footer>
</article>
<!--% END %-->
<article>
    <header>
        <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(\'now\', \'+1 days\')
    ORDER BY date DESC
	LIMIT 30 OFFSET 10
	') 
%-->
	<!--% show_summary(last_5_weeks_episodes) %-->
<!--% END %-->
</article>
<h1>Older Shows</h1>
	<p>
	Get a <a href="<!--% absolute_path(baseurl) %-->eps/index.html">full list</a> of all our shows.
	</p>