From 9bc8be6e2660c9225420089ff00a1215c4928ef7 Mon Sep 17 00:00:00 2001 From: pdp8 Date: Fri, 2 Feb 2024 20:24:01 +0100 Subject: image/video width/height --- html.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'html.rb') diff --git a/html.rb b/html.rb index 7e9d2f0..1018a31 100755 --- a/html.rb +++ b/html.rb @@ -1,5 +1,4 @@ #!/usr/bin/env ruby -require 'erb' MEDIA_DIR = '/srv/media' MEDIA_URL = 'https://media.pdp8.info' @@ -13,6 +12,7 @@ def nav(cat) cl = c == cat ? 'item current' : 'item' html += " #{c}" end + html += " social" html += " rss" html += " " html += '' @@ -34,7 +34,6 @@ def print_html(basename, html) out = File.join(WWW_DIR, basename + '.html') puts out File.open(out, 'w+') { |f| f.puts html } - File.open('tmp.html', 'w+') { |f| f.puts html } if basename == 'music' puts `tidy -iqm -w 0 #{out} 2>&1` end @@ -51,7 +50,8 @@ def music_html html += "

#{title}

" html += File.read(File.join(dir, 'README')).chomp.gsub("\n\n", '

').gsub("\n", '
') # + '

' cover = File.join(MEDIA_URL, dir.sub(MEDIA_DIR, ''), 'cover.webp') - html += "cover" + w, h = `identify -format "%w %h" #{cover}`.chomp.split(' ') + html += "cover" html += '' copyrights_file = File.join(dir, 'copyrights') copyrights = File.readlines(copyrights_file).collect { |l| l.chomp } if File.exist? copyrights_file @@ -102,15 +102,15 @@ def video_html mp4 = File.join(MEDIA_URL, 'videos', File.basename(dir), title.gsub(' ', '_') + '.mp4') webm = File.join(MEDIA_URL, 'videos', File.basename(dir), title.gsub(' ', '_') + '.webm') poster = File.join(MEDIA_URL, 'videos', File.basename(dir), 'poster.png') + w, h = `ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=p=0 #{webm}`.chomp.split(',') - html += "