Archived
4
2

Merge pull request '[I52] Allow audio content to be hosted on at different url' (#53) from I52_media_urls into main

Reviewed-on: #53
This commit is contained in:
Roan Horning 2022-10-02 18:17:14 +00:00
commit bf8bf8daad
7 changed files with 52 additions and 27 deletions

View File

@ -140,12 +140,13 @@ sub main {
$page_config->{'root_template'} = $config{root_template}{content};
}
if (exists $config{root_template}{baseurl}) {
$page_config->{'baseurl'} = $config{root_template}{baseurl};
# Set all config root_template properties as default page config properties
# except the previously set root_template content property
my @root_args = grep { $_ ne 'content' } keys %{$config{root_template}};
foreach my $root_arg (@root_args) {
if (exists $page_config->{$root_arg} == 0) {
$page_config->{$root_arg} = $config{root_template}{$root_arg};
}
if (exists $config{root_template}{media_hostname}) {
$page_config->{'media_hostname'} = $config{root_template}{media_hostname};
}
if ($page_config->{'multipage'} && $page_config->{'multipage'} eq 'true') {

View File

@ -75,7 +75,7 @@ Hosted by <a href="<!--% absolute_path(baseurl) %-->correspondents/<!--% zero_pa
</header>
<div><!--% episode.notes %--></div>
<footer>
<!--% listen_now(episode, "hpr", baseurl, media_hostname) %-->
<!--% listen_now(episode, "hpr", baseurl, media_baseurl) %-->
<p>
<!--% episode_navigation %-->
</p>

View File

@ -84,7 +84,7 @@
</header>
<!--% latest_episodes.notes %-->
<footer>
<!--% listen_now(latest_episodes, "hpr", baseurl, media_hostname) %-->
<!--% listen_now(latest_episodes, "hpr", baseurl, media_baseurl) %-->
</footer>
</article>
<!--% END %-->

View File

@ -58,14 +58,14 @@
<img src="<!--% absolute_path(baseurl) %-->images/<!--% get_avatar(episode.hostid) %-->" height="80" width="80" alt="" /></a><br><!--% END %-->
Hosted by <a href="<!--% absolute_path(baseurl) %-->correspondents/<!--% zero_pad_left(episode.hostid) %-->.html"><!--% episode.host %--></a> on <span><!--% episode.date %--></span> is flagged as <span><!--% display_explicit(episode.explicit) %--></span> and is released under a <span><!--% episode.license %--> license</span>. <br>
<!--% display_tags(episode.tags) %--> <br>
<!--% display_listen_in(episode.id) %-->
<!--% display_listen_in(episode.id, "twat") %-->
</p>
<h3><!--% show_series(episode.series, episode.seriesid, "Part of the series") %--></h3>
<p><em><!--% episode.series_description %--></em></p>
</header>
<div><!--% episode.notes %--></div>
<footer>
<!--% listen_now(episode, "twat", baseurl, media_hostname) %-->
<!--% listen_now(episode, "twat", baseurl, media_baseurl) %-->
<p>
<!--% episode_navigation %-->
</p>

View File

@ -11,8 +11,15 @@
<span><label>Tags:</label> <em><!--% tags %--></em>.</span>
<!--% END %-->
<!--% MACRO display_listen_in(eps_id) BLOCK %-->
Listen in <a href="<!--% media_baseurl(baseurl, media_hostname) %-->local/hpr<!--% eps_id %-->.ogg">ogg</a>, <a href="<!--% media_baseurl(baseurl, media_hostname) %-->local/hpr<!--% eps_id %-->.spx">spx</a>, or <a href="<!--% media_baseurl(baseurl, media_hostname) %-->local/hpr<!--% eps_id %-->.mp3">mp3</a> format.
<!--% MACRO display_listen_in(eps_id, episode_type) BLOCK %-->
<!--% IF episode_type == "" %--><!--% episode_type = 'hpr' %--><!--% END %-->
Listen in
<!--% IF episode_type == 'hpr' %-->
<a href="<!--% media_path(eps_id, episode_type, 'ogg', baseurl, media_baseurl) %-->">ogg</a>,
<a href="<!--% media_path(eps_id, episode_type, 'spx', baseurl, media_baseurl) %-->">spx</a>,
or
<!--% END %-->
<a href="<!--% media_path(eps_id, episode_type, 'mp3', baseurl, media_baseurl) %-->">mp3</a> format.
<!--% END %-->
<!--% MACRO display_comments_tally(eps_id, tally) BLOCK %-->

View File

@ -1,19 +1,16 @@
<!--% MACRO listen_now(episode, episode_type, baseurl, media_hostname) BLOCK %-->
<!--% IF episode_type == "twat" %-->
<!--% media_folder = "eps" %--><!--% ELSE %--><!--% media_folder = "local" %-->
<!--% END %-->
<!--% MACRO listen_now(episode, episode_type, baseurl, media_baseurl) BLOCK %-->
<h2>Listen Now</h2>
<p>Duration: <!--% display_episode_duration(episode.duration) %--></p>
<audio controls preload="none">
<source src="<!--% media_baseurl(baseurl, media_hostname) %--><!--% media_folder %-->/<!--% episode_type %--><!--% episode.id %-->.ogg" type="audio/ogg" >
<source src="<!--% media_baseurl(baseurl, media_hostname) %--><!--% media_folder %-->/<!--% episode_type %--><!--% episode.id %-->.mp3" type="audio/mpeg" >
<source src="<!--% media_path(episode.id, episode_type, 'ogg', baseurl, media_baseurl) %-->" type="audio/ogg" >
<source src="<!--% media_path(episode.id, episode_type, 'mp3', baseurl, media_baseurl) %-->" type="audio/mpeg" >
</audio>
<ul>
<!--% IF episode_type != "twat" %-->
<li>ogg: <a href="<!--% media_baseurl(baseurl, media_hostname) %--><!--% media_folder %-->/<!--% episode_type %--><!--% episode.id %-->.ogg"><!--% media_baseurl(baseurl, media_hostname) %--><!--% media_folder %-->/<!--% episode_type %--><!--% episode.id %-->.ogg</a></li>
<li>spx: <a href="<!--% media_baseurl(baseurl, media_hostname) %--><!--% media_folder %-->/<!--% episode_type %--><!--% episode.id %-->.spx"><!--% media_baseurl(baseurl, media_hostname) %--><!--% media_folder %-->/<!--% episode_type %--><!--% episode.id %-->.spx</a></li>
<li>ogg: <a href="<!--% media_path(episode.id, episode_type, 'ogg', baseurl, media_baseurl) %-->"><!--% media_path(episode.id, episode_type, 'ogg', baseurl, media_baseurl) %--></a></li>
<li>spx: <a href="<!--% media_path(episode.id, episode_type, 'spx', baseurl, media_baseurl) %-->"><!--% media_path(episode.id, episode_type, 'spx', baseurl, media_baseurl) %--></a></li>
<!--% END %-->
<li>mp3: <a href="<!--% media_baseurl(baseurl, media_hostname) %--><!--% media_folder %-->/<!--% episode_type %--><!--% episode.id %-->.mp3"><!--% media_baseurl(baseurl, media_hostname) %--><!--% media_folder %-->/<!--% episode_type %--><!--% episode.id %-->.mp3</a></li>
<li>mp3: <a href="<!--% media_path(episode.id, episode_type, 'mp3', baseurl, media_baseurl) %-->"><!--% media_path(episode.id, episode_type, 'mp3', baseurl, media_baseurl) %--></a></li>
</ul>
<!--% END %-->

View File

@ -1,6 +1,11 @@
<!--% MACRO zero_pad_left(word) BLOCK %-->
<!--% MACRO zero_pad_left(word, pad_length) BLOCK %-->
<!--% IF pad_length %-->
<!--% zero_pad_format = "%0${pad_length}s" %-->
<!--% ELSE %-->
<!--% zero_pad_format = "%04s" %-->
<!--% END %-->
<!--% USE String(word) %-->
<!--% String.format("%04s") %-->
<!--% String.format(zero_pad_format) %-->
<!--% END %-->
<!--% MACRO display_choice(choice, display_when_true, display_when_false) BLOCK %-->
@ -39,10 +44,25 @@
<!--% IF baseurl %-->./<!--% ELSE %-->/<!--% END %-->
<!--% END %-->
<!--% MACRO media_baseurl(baseurl, media_hostname) BLOCK %-->
<!--% IF media_hostname %-->
https://<!--% media_hostname %-->/<!--% ELSE %-->
<!--% baseurl %-->/<!--% END %-->
<!--% MACRO media_basepath(baseurl, media_baseurl) BLOCK %-->
<!--% IF media_baseurl %-->
<!--% media_baseurl %--><!--% ELSE %-->
<!--% IF baseurl %--><!--% baseurl %--><!--% ELSE %-->/<!--% END %-->
<!--% END %-->
<!--% END %-->
<!--% MACRO media_path(episode_id, episode_type, media_type, baseurl, media_baseurl) BLOCK %-->
<!--% IF episode_type == "twat" %-->
<!--% padding = 3 %-->
<!--% media_folder = "eps/"; padding = 3 %-->
<!--% ELSE %-->
<!--% media_folder = "local/" %-->
<!--% END %-->
<!--% IF media_baseurl %-->
<!--% media_folder = "" %-->
<!--% media_baseurl = media_baseurl.replace('\$eps_id', zero_pad_left(episode_id)) %-->
<!--% END %-->
<!--% media_basepath(baseurl, media_baseurl) %--><!--% media_folder %--><!--% episode_type %--><!--% zero_pad_left(episode_id, padding) %-->.<!--% media_type %-->
<!--% END %-->
<!--% MACRO step_navigation(baseurl, links, folder) BLOCK %-->