diff options
Diffstat (limited to '_plugins')
-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 |