summaryrefslogtreecommitdiff
path: root/html.rb
diff options
context:
space:
mode:
authorpdp8 <pdp8@pdp8.info>2024-02-14 14:47:10 +0100
committerpdp8 <pdp8@pdp8.info>2024-02-14 14:47:10 +0100
commita781fe5046c4b33cd1c860d284bd799b4ca38f2e (patch)
treedb607bffafb43e650c165026834d06a1e7371c3d /html.rb
parent5df93a11a4447f31f275801c333bb2865a779377 (diff)
picture import
Diffstat (limited to 'html.rb')
-rwxr-xr-xhtml.rb25
1 files changed, 16 insertions, 9 deletions
diff --git a/html.rb b/html.rb
index 8ad6c07..171d487 100755
--- a/html.rb
+++ b/html.rb
@@ -41,6 +41,10 @@ def music_html
music = Dir[File.join(MEDIA_DIR, 'music', '*')].sort.reverse
html = File.read(File.join(SNIPPETS, 'head.html'))
html += nav 'music'
+ html += '<div class="post"><a href="https://faircamp.webr.ing/prev/pdp8.info/music.html">← prev</a> |
+ <a href="https://faircamp.webr.ing/">faircamp webring</a> |
+ <a href="https://faircamp.webr.ing/rand">random</a> |
+ <a href="https://faircamp.webr.ing/next/pdp8.info/music.html">next →</a></div>'
music.each do |dir|
next if dir.match 'alfadeo'
@@ -50,8 +54,9 @@ def music_html
html += "<h1>#{title}</h1>"
html += File.read(File.join(dir, 'README')).chomp.gsub("\n\n", '<p>').gsub("\n", '<br>') # + '<p>'
cover = File.join(MEDIA_URL, dir.sub(MEDIA_DIR, ''), 'cover.webp')
+ alt = File.read(File.join(dir, 'cover.txt')).chomp
w, h = `identify -format "%w %h" #{cover}`.chomp.split(' ')
- html += "<img class='cover' loading='lazy' width='#{w}' height='#{h}' src='#{cover}' alt='cover'>"
+ html += "<img class='cover' loading='lazy' width='#{w}' height='#{h}' src='#{cover}' alt='#{alt}'>"
html += '<table>'
copyrights_file = File.join(dir, 'copyrights')
copyrights = File.readlines(copyrights_file).collect { |l| l.chomp } if File.exist? copyrights_file
@@ -63,7 +68,8 @@ def music_html
html += "<td>#{name}</td>"
html += "<td>
<audio preload='none' controls>
- <source src='#{mp3}' type='audio/mpeg'>
+ <source src='#{mp3}' type='audio/mpeg'>
+ <a href=#{mp3}>#{mp3}</a>
</audio>
</td>"
html += '</tr>'
@@ -119,8 +125,9 @@ def video_html
w, h = `ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=p=0 #{webm}`.chomp.split(',')
html += "<video controls preload='none' width='#{w}' height='#{h}' poster='#{poster}'>
- <source src='#{webm}' type='video/webm'>
- <source src='#{mp4}' type='video/mp4'>
+ <source src='#{webm}' type='video/webm'>
+ <source src='#{mp4}' type='video/mp4'>
+ <a href=#{mp4}>#{mp4}</a>
</video><p>
"
html += lines.join('<br>')
@@ -146,9 +153,9 @@ def climbing_html
html += '<div class="post">'
html += "<h1>#{post[:date]}</h1>"
html += "<video controls preload='none' width='#{w}' height='#{h}' poster=#{post[:webp]}>
- <source src='#{post[:webm]}' type='video/webm'>
- <source src='#{post[:mp4]}' type='video/mp4'>
- <a href=#{post[:mp4]}>#{post[:mp4]}</a>
+ <source src='#{post[:webm]}' type='video/webm'>
+ <source src='#{post[:mp4]}' type='video/mp4'>
+ <a href=#{post[:mp4]}>#{post[:mp4]}</a>
</video><p>
"
html += post[:text]
@@ -160,11 +167,11 @@ def climbing_html
end
music_html
-picture_html
+# picture_html
video_html
climbing_html
-%w[about code contact].each do |basename|
+%w[about code pictures contact].each do |basename|
file_html basename
end