diff options
author | EuAndreh <eu@euandre.org> | 2022-01-11 15:37:21 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2022-01-11 15:37:21 -0300 |
commit | 9010d27237df0dc4a3b321fa4856486e2640c4b5 (patch) | |
tree | c55aece0d42ffdad10605b16644d20f54af254d2 /_plugins | |
parent | _plugins/generate-favicon.rb: Delete file, generate files in Makefile (diff) | |
download | euandre.org-9010d27237df0dc4a3b321fa4856486e2640c4b5.tar.gz euandre.org-9010d27237df0dc4a3b321fa4856486e2640c4b5.tar.xz |
_plugins/generate-media-files.rb: Remove in favor of Makefile
Diffstat (limited to '')
-rw-r--r-- | _plugins/generate-media-files.rb | 32 | ||||
-rw-r--r-- | _plugins/linter.rb | 8 |
2 files changed, 4 insertions, 36 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 diff --git a/_plugins/linter.rb b/_plugins/linter.rb index b3830d5..0ccc92d 100644 --- a/_plugins/linter.rb +++ b/_plugins/linter.rb @@ -144,17 +144,17 @@ module Jekyll ] expected.each do |metadata| unless stdout.include? metadata - tags = expected.join('\\n').gsub(/'/, "'\"'\"'") - add_metadata_cmd = "metaflac --remove-all #{file}\nprintf '#{tags}\\n' | metaflac --import-tags-from=- #{file}" + tags = expected.join("\n").gsub(/'/, "'\"'\"'") + add_metadata_cmd = "metaflac --remove-all-tags #{file}\nprintf '#{tags}\n' | metaflac --import-tags-from=- #{file}" check_metadata_cmd = "metaflac --export-tags-to=- #{file}" - raise "Missing metadata entry '#{metadata}' in '#{file}'.\nAdd it with:\n\n#{add_metadata_cmd}\n\nCheck with:\n #{check_metadata_cmd}" + raise "Missing metadata entry '#{metadata}' in '#{file}'.\nAdd it with:\n\n" + add_metadata_cmd + "\n\nCheck with:\n #{check_metadata_cmd}" end end check_cover_cmd = "metaflac #{file} --export-picture-to=- | diff - static/favicon.png" `#{check_cover_cmd}` unless $?.success? then - add_cover_cmd = "metaflac #{file} --import-picture-from=static/favicon.png" + add_cover_cmd = "metaflac --remove-all #{file}\nmetaflac #{file} --import-picture-from=static/favicon.png" raise "Cover art from '#{file}' doesn't match 'static/favicon.png'.\nFix it with:\n\n#{add_cover_cmd}\n\nCheck with:\n #{check_cover_cmd}" end elsif name == 'screencasts' then |