aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile44
-rw-r--r--_config.yml1
-rw-r--r--_plugins/generate-media-files.rb32
-rw-r--r--_plugins/linter.rb8
4 files changed, 41 insertions, 44 deletions
diff --git a/Makefile b/Makefile
index 8359403..ffd427e 100644
--- a/Makefile
+++ b/Makefile
@@ -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