aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2020-12-24 18:45:16 -0300
committerEuAndreh <eu@euandre.org>2020-12-24 18:45:43 -0300
commit9c29a0f029f01c566decfed4204c46cd77fad6c7 (patch)
tree6d8fdb00ddc1c624ef64f6eba14797c4665fa6ab
parentUse sh for tests.sh (diff)
downloadeuandre.org-9c29a0f029f01c566decfed4204c46cd77fad6c7.tar.gz
euandre.org-9c29a0f029f01c566decfed4204c46cd77fad6c7.tar.xz
lint-hook.rb: Make Jekyll aware of the generated ogg files
Diffstat (limited to '')
-rw-r--r--_plugins/lint-hook.rb13
-rw-r--r--default.nix1
2 files changed, 8 insertions, 6 deletions
diff --git a/_plugins/lint-hook.rb b/_plugins/lint-hook.rb
index 57c2e27..634db80 100644
--- a/_plugins/lint-hook.rb
+++ b/_plugins/lint-hook.rb
@@ -67,7 +67,7 @@ module Jekyll
'screencasts' => 'cast'
}
- def assert_frontmatter_fields(config, name, document)
+ def assert_frontmatter_fields(site, name, document)
title = assert_field document, 'title'
lang = assert_field document, 'lang'
ref = assert_field document, 'ref'
@@ -112,16 +112,17 @@ module Jekyll
raise "Missing FLAC file '#{flac}'"
end
+ file = "#{date}-#{slug}.ogg"
ogg = "resources/podcasts/#{date}-#{slug}.ogg"
unless File.exist? ogg then
puts "Missing '#{ogg}' file, generating..."
puts `ffmpeg -i #{flac} -ar 48000 -vn -c:a libvorbis -b:a 320k #{ogg}`
+ site.static_files << Jekyll::StaticFile.new(site, site.source, '', ogg)
end
torrent = "#{ogg}.torrent"
unless File.exist? torrent then
- webseed = "#{config['url']}/#{ogg}"
- file = "#{date}-#{slug}.ogg"
+ webseed = "#{site.config['url']}/#{ogg}"
puts "Missing '#{torrent}' file, generating..."
puts `mktorrent #{TRACKERS} -f -v -d -c '#{document.content}' -n #{file} -w #{webseed} -o #{torrent} #{ogg}`
end
@@ -135,7 +136,7 @@ module Jekyll
torrent = "#{mkv}.torrent"
unless File.exist? torrent then
- webseed = "#{config['url']}/#{mkv}"
+ webseed = "#{site.config['url']}/#{mkv}"
file = "#{date}-#{slug}.mkv"
puts "Missing '#{torrent}' file, generating..."
puts `mktorrent #{TRACKERS} -f -v -d -c '#{document.content}' -n #{file} -w #{webseed} -o #{torrent} #{mkv}`
@@ -146,13 +147,13 @@ module Jekyll
def assert_frontmatter(site)
site.collections.each do |name, collection|
collection.docs.each do |document|
- assert_frontmatter_fields site.config, name, document
+ assert_frontmatter_fields site, name, document
end
end
site.pages.each do |page|
unless IGNORED_PAGES.include? page.path
- assert_frontmatter_fields site.config, 'page', page
+ assert_frontmatter_fields site, 'page', page
end
end
end
diff --git a/default.nix b/default.nix
index f36526a..f642282 100644
--- a/default.nix
+++ b/default.nix
@@ -25,6 +25,7 @@ let
jekyllEnv
pkgs-next.mdpo
mktorrent-newer
+ ffmpeg
perl
graphviz