aboutsummaryrefslogtreecommitdiff
path: root/_plugins/generate-media-files.rb
diff options
context:
space:
mode:
Diffstat (limited to '_plugins/generate-media-files.rb')
-rw-r--r--_plugins/generate-media-files.rb32
1 files changed, 0 insertions, 32 deletions
diff --git a/_plugins/generate-media-files.rb b/_plugins/generate-media-files.rb
deleted file mode 100644
index 388168c..0000000
--- a/_plugins/generate-media-files.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-module Jekyll
- class MediaFilesGenerator < Generator
- safe true
- priority :high
-
- def generate(site)
- site.collections['podcasts'].docs.each do |document|
- date = document.data['date'].strftime('%Y-%m-%d')
- slug = document.data['slug']
- flac = "resources/podcasts/#{date}-#{slug}.flac"
- 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
-
- checksum_file = "#{ogg}.checksum"
- checksum = `sha256sum #{flac} #{ogg} | sha256sum | awk '{ print $1 }'`
- if File.exist? checksum_file then
- unless checksum == File.read(checksum_file)
- raise "Checksum mismatch for '#{flac}'.\nRe-generate the Ogg files and checksums with:\n\nrm '#{ogg}' '#{checksum_file}'"
- end
- else
- puts "Missing checksum for '#{flac}', generating..."
- File.write(checksum_file, checksum)
- end
- end
- end
- end
-end