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:
@ -0,0 +1,65 @@
|
||||
{{/* Source: https://gitlab.com/Roneo/hugo-shortcode-roneo-collection */}}
|
||||
|
||||
{{- $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 'audio-archive.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") }}
|
||||
{{/* Only MP3: */}}
|
||||
{{/* {{ if eq .format "VBR MP3" }} */}}
|
||||
<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>
|
||||
Reference in New Issue
Block a user