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 | |
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-- | Makefile | 44 | ||||
-rw-r--r-- | _config.yml | 1 | ||||
-rw-r--r-- | _plugins/generate-media-files.rb | 32 | ||||
-rw-r--r-- | _plugins/linter.rb | 8 |
4 files changed, 41 insertions, 44 deletions
@@ -9,6 +9,9 @@ .midi.ogg: timidity -Ov $< +.flac.ogg: + ffmpeg -y -i $< -ar 48000 -vn -c:a libvorbis -b:a 320k $@ + lilypond.ly = \ music/choro-da-saudade.ly \ @@ -24,18 +27,47 @@ lilypond = \ favicons = static/favicon.png favicon.ico +podcasts.flac = \ + resources/podcasts/2020-12-19-a-test-entry.flac +podcasts.ogg = $(podcasts.flac:.flac=.ogg) + +torrents-in = \ + $(podcasts.flac) \ + $(podcasts.ogg) +torrents = $(torrents-in:=.torrent) + +derived-assets = \ + $(lilypond) \ + $(favicons) \ + $(podcasts.ogg) \ + $(torrents) + -all: $(lilypond) $(favicons) +all: public + +jekyll-deps: $(derived-assets) $(lilypond.pdf): $(lilypond.midi) +torrents-files.txt: $(torrents-in) + echo $(torrents-in) | tr ' ' '\n' > $@ + +torrent-files.mk: torrents-files.txt + printf 'torrent-files = \\\n' > $@ + sed -e 's/^/\t/' -e 's/$$/.torrent \\/' < torrents.txt >> $@ + printf '\n\n' >> $@ + awk '{ printf "%s.torrent: %s\n", $$1, $$1 }' torrents.txt >> $@ + +$(torrents): torrent-files.mk + $(MAKE) -f Makefile.dynamic torrents + static/favicon.png: static/favicon.svg - inkscape -o $@ -w 420 -h 420 -b white $? + inkscape -o $@ -w 2048 -h 2048 -b white static/favicon.svg favicon.ico: static/favicon.svg - convert $? $@ + convert static/favicon.svg $@ check: @@ -48,11 +80,9 @@ check: dev-check: check clean: - rm -rf \ - public/ \ - $(lilypond) $(favicons) + rm -rf public/ $(derived-assets) -public: all +public: jekyll-deps jekyll build publish: public diff --git a/_config.yml b/_config.yml index 0db3b05..1a4893b 100644 --- a/_config.yml +++ b/_config.yml @@ -44,7 +44,6 @@ exclude: - static/graphviz/ - drafts - locale/ - - resources/ - public/ - drafts/ 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 |