summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpdp8 <pdp8@pdp8.info>2022-08-26 01:24:30 +0200
committerpdp8 <pdp8@pdp8.info>2022-08-26 01:24:30 +0200
commitf7e3fbebc0b481ce0ac76506b8a017a9a63bec11 (patch)
treef44b3146c4c513b2da53c8dfa42761f01fbe630e
parent8d2ce11daf87267091ffec971cd46d16937cc69c (diff)
flac and webm removed from html5 media
-rwxr-xr-xhtml.rb10
-rwxr-xr-xmusic.rb2
-rwxr-xr-xvideo-metadata.rb21
3 files changed, 25 insertions, 8 deletions
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 += "<img class='cover' src='#{cover}' alt='cover'>"
html += "<table>"
- 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 += "<tr>"
- html += "<td>#{File.basename(flac, '.flac')}</td>"
+ html += "<td>#{File.basename(mp3, '.mp3')}</td>"
html += "<td>
<audio controls>
- <source src='#{flac}' type='audio/flac'>
<source src='#{mp3}' type='audio/mpeg'>
</audio>
</td>
@@ -90,7 +88,6 @@ def video_html
poster = File.join("/videos", File.basename(dir), "poster.png")
html += "<video controls poster='#{poster}'>
- <source src='#{webm}' type='video/webm'>
<source src='#{mp4}' type='video/mpeg'>
<a href='#{mp4}'>#{mp4}</a>
</video><p>
@@ -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