New post in drafts and almost ready. Also on a new computer, so had to re-download all the theme and submodules. Thinking of just converting the box submodule to be native to my blog for easier maintenence. Need to proof this last post on google sheets and publish tomorrow morning.

This commit is contained in:
Norm Rasmussen
2024-02-26 16:42:10 -05:00
parent b55aa03260
commit 37e4a34de7
14418 changed files with 60935 additions and 1182 deletions

View File

@ -0,0 +1,64 @@
{{/* Source: https://gitlab.com/Roneo/hugo-shortcode-roneo-collection */}}
{{/* OUTDATED: this shortcode is now named "audio-archive", please fix your Markdown files and see this shortcode for an updated version */}}
{{- $src := .Get 0 -}}
{{/* Convert URL from archive.org/details/foo to archive.org/metadata/foo */}}
{{ $archiveMetadata := replace $src "/details/" "/metadata/" }}
{{/* Get JSON */}}
{{ $dataJ := getJSON $archiveMetadata }}
{{- $identifier := $dataJ.metadata.identifier -}}
{{- $root := "https://archive.org/download" -}}
{{ "<!-- Shortcode 'archive-audio.html' -->" | safeHTML }}
<style>
.audio-treeview {
list-style: none;
padding-bottom: 2em;
}
.audio-treeview li {
padding-top: 2em;
}
.audio-treeview li figure {
padding-top: 1em;
}
</style>
<ul class="audio-treeview">
{{ range $dataJ.files }}
{{/* Show Audio files only */}}
{{ if or (eq .format "VBR MP3") (eq .format "MPEG-4 Audio") }}
<li>
{{$path := print $root "/" $identifier "/" .name}}
{{/* <a href="{{ $path }}" target="_blank" aria-label="Download {{ index .name }}" download>{{ index .name }}</a> */}}
{{/* "index .name:" {{ index .name }} <br> */}}
{{/* Remove folder from path */}}
{{ $fileHeading := replaceRE ".*/" "" .name }}
{{/* Remove file extension and display */}}
{{ strings.TrimSuffix (path.Ext $fileHeading) $fileHeading }}
{{/* Embed HTML player */}}
<figure>
<audio controls class="player">
<source src="{{- $path -}}" type="audio/mpeg">
</audio>
</figure>
{{/* Add a label depending on metadata */}}
{{/* {{ if in .source "original" }}
<b>ORIGINAL</b>
{{ end }} */}}
</li>
{{ end }}
{{ end }}
</ul>