From f7e3fbebc0b481ce0ac76506b8a017a9a63bec11 Mon Sep 17 00:00:00 2001 From: pdp8 Date: Fri, 26 Aug 2022 01:24:30 +0200 Subject: flac and webm removed from html5 media --- html.rb | 10 +++------- music.rb | 2 +- video-metadata.rb | 21 +++++++++++++++++++++ 3 files changed, 25 insertions(+), 8 deletions(-) create mode 100755 video-metadata.rb diff --git a/html.rb b/html.rb index 6fc9b81..f543a2b 100755 --- a/html.rb +++ b/html.rb @@ -47,14 +47,12 @@ def music_html cover = File.join("/", dir.sub(ROOT, ''), "cover.jpeg") html += "cover" html += "" - Dir[File.join(dir, "*flac")].each do |flac| - flac = "/" + flac.sub(ROOT, '') - mp3 = flac.sub(".flac", ".mp3") + Dir[File.join(dir, "*mp3")].each do |mp3| + mp3 = "/" + mp3.sub(ROOT, '') html += "" - html += "" + html += "" html += " @@ -90,7 +88,6 @@ def video_html poster = File.join("/videos", File.basename(dir), "poster.png") html += "

@@ -121,4 +118,3 @@ puts `cp "#{File.join(ROOT, last)}" "#{File.join(ROOT, "index.html")}"` "slideshow.js", "robots.txt" ].each { |f| puts `rsync -av "#{File.join(SNIPPETS, f)}" "#{ROOT}"` } -puts `rsync -av #{File.join(SNIPPETS, "Fork-Awesome-1.2.0")} "#{ROOT}"` diff --git a/music.rb b/music.rb index c07b693..60e487b 100755 --- a/music.rb +++ b/music.rb @@ -13,7 +13,7 @@ puts `mkdir -p '#{dest}'` cover = File.join(dest, "cover" + File.extname(input["cover"])) puts `cp -v '#{input["cover"]}' '#{cover}'` puts `exiv2 rm #{cover}` -puts `exiv2 -M"set Xmp.dc.creator pdp8@pdp8.info" -M"set Xmp.dc.rights This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License (http://creativecommons.org/licenses/by-sa/4.0/)." -M"set Xmp.xmpRights.Marked True" #{cover}` +puts `exiv2 -M"set Xmp.dc.creator pdp8@pdp8.info" -M"set Xmp.dc.rights © pdp8@pdp8.info" -M"set Xmp.xmpRights.UsageTerms Creative Commons Attribution-ShareAlike 4.0 International License" -M"set Xmp.dc.license http://creativecommons.org/licenses/by-sa/4.0/)" -M"set Xmp.xmpRights.Marked True" #{cover}` n = 1 input["tracks"].each do |t, s| File.open(File.join(dest, "README"), "w+") { |f| f.puts input["text"] } diff --git a/video-metadata.rb b/video-metadata.rb new file mode 100755 index 0000000..654ce0c --- /dev/null +++ b/video-metadata.rb @@ -0,0 +1,21 @@ +#!/usr/bin/env ruby +require 'json' + +Dir[File.join(ARGV[0], "videos", "*", "*.mp4")].each do |video| + # tmp = File.join("/tmp", File.basename(video)) + tmp = video + "~" + print `cp #{video} #{tmp}` + meta = { + "title" => File.basename(video, ".mp4").gsub("_", " "), + "date" => video.split("/")[-2].split("_")[0], + "artist" => "pdp8@pdp8.info", + "copyright" => "© pdp8@pdp8.info Creative Commons Attribution-ShareAlike 4.0 International License", + } + cmd = "ffmpeg -i #{tmp} -c copy " + meta.each do |k, v| + cmd += "-metadata #{k}=\"#{v}\" " + end + cmd += " #{video}" + puts cmd + print `#{cmd}` +end -- cgit v1.2.3

#{File.basename(flac, '.flac')}#{File.basename(mp3, '.mp3')}