diff options
author | EuAndreh <eu@euandre.org> | 2020-12-24 21:20:05 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-12-25 03:36:24 -0300 |
commit | 998618daf80d2bb1d6848ff0309c0ef9b80d5827 (patch) | |
tree | 2879e695bec0ca783c295ad7d1b1ca5d222e05f7 /_plugins/generate-media-files.rb | |
parent | Don't run linter on generated files (diff) | |
download | euandre.org-998618daf80d2bb1d6848ff0309c0ef9b80d5827.tar.gz euandre.org-998618daf80d2bb1d6848ff0309c0ef9b80d5827.tar.xz |
Move torrent and media generators out of linter.rb
Diffstat (limited to '')
-rw-r--r-- | _plugins/generate-media-files.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/_plugins/generate-media-files.rb b/_plugins/generate-media-files.rb new file mode 100644 index 0000000..2ef92db --- /dev/null +++ b/_plugins/generate-media-files.rb @@ -0,0 +1,20 @@ +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 + end + end + end +end |