From 7904f2d53602222940db0898c2dc2fcadf8f4e5f Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 29 Apr 2025 09:00:07 -0300 Subject: Makefile: Support flac -> ogg conversion and torrent file generation --- Makefile | 13 ++++++++++- deps.mk | 18 +++++++++++++++ mkdeps.sh | 25 +++++++++++++++++---- .../en/podcasts/2020/12/19/test-entry.flac.torrent | Bin 0 -> 544 bytes src/content/en/podcasts/2020/12/19/test-entry.ogg | Bin 0 -> 97060 bytes .../en/podcasts/2020/12/19/test-entry.ogg.torrent | 1 + .../screencasts/2021/02/07/autoqemu.webm.torrent | Bin 0 -> 7646 bytes src/symlinks.txt | 6 ++--- 8 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 src/content/en/podcasts/2020/12/19/test-entry.flac.torrent create mode 100644 src/content/en/podcasts/2020/12/19/test-entry.ogg create mode 100644 src/content/en/podcasts/2020/12/19/test-entry.ogg.torrent create mode 100644 src/content/en/screencasts/2021/02/07/autoqemu.webm.torrent diff --git a/Makefile b/Makefile index ae9ace0..d9b2f82 100644 --- a/Makefile +++ b/Makefile @@ -20,13 +20,15 @@ EXEC = ./ DESTDIR = LDLIBS = PUBURL = public.asc.txt +FFMFLAGS = -y -hide_banner -loglevel warning +BASEURL = / .SUFFIXES: .SUFFIXES: .adoc .conf .snippets .indexentry .feedentry .sortdata .xml .txt .SUFFIXES: .htmlbody .htmlheader .htmlfooter .htmllisting .html .links .caslinks -.SUFFIXES: .categorydata .gz +.SUFFIXES: .categorydata .gz .torrent .flac .ogg .adoc.conf: mkwb conf src/global.conf $< > $@ @@ -66,6 +68,9 @@ PUBURL = public.asc.txt printf "%s\n" "_" | sha256sum | \ printf "%s\t%s\n" "`cut -d" " -f1`" "_"' > $@ +.flac.ogg: + ffmpeg $(FFMFLAGS) -i $< -ar 48000 -vn -c:a libvorbis -b:a 320k $@ + all: @@ -93,6 +98,7 @@ categories.htmllisting = $(categories.adoc:.adoc=.htmllisting) categories.txt = $(categories.adoc:.adoc=.txt) categories.xml = $(categories.adoc:.adoc=.xml) categories.xml.gz = $(categories.adoc:.adoc=.xml.gz) +sources.media.torrent = $(sources.media:=.torrent) sources = \ $(sources.adoc) \ @@ -189,6 +195,7 @@ captured-assets = \ src/content/$(PUBURL) \ src/content/favicon.ico \ src/content/favicon.png \ + $(sources.media.torrent) \ side-assets = \ src/collections/*/*/*/*/*.html.*.txt \ @@ -276,6 +283,10 @@ src/content/favicon.ico: src/content/img/favicon.svg src/content/favicon.png: src/content/img/favicon.svg convert src/content/img/favicon.svg $@ +$(sources.media.torrent): + F="`printf '%s\n' $* | cut -d/ -f3-`" && \ + mktorrent -xfd -n $(*F) -o $@ -w "https://$(NAME)$(BASEURL)$${F}" $* + email.txt: meta.json jq -r '.email' < meta.json > $@ diff --git a/deps.mk b/deps.mk index 2ae1186..cbf049b 100644 --- a/deps.mk +++ b/deps.mk @@ -102,6 +102,19 @@ images.svg = \ src/content/img/logo/dark.svg \ src/content/img/logo/light.svg \ +sources.media = \ + src/content/en/podcasts/2020/12/19/test-entry.flac \ + src/content/en/podcasts/2020/12/19/test-entry.ogg \ + src/content/en/screencasts/2021/02/07/autoqemu.webm \ + +sources.tarballs = \ + src/content/en/blog/2020/10/05/cargo2nix-demo.tar.gz \ + src/content/en/blog/2020/10/05/cargo2nix.tar.gz \ + src/content/en/blog/2020/10/05/swift2nix-demo.tar.gz \ + src/content/en/blog/2020/10/05/swift2nix.tar.gz \ + src/content/en/blog/2021/02/17/fallible.tar.gz \ + src/content/en/screencasts/2021/02/07/autoqemu.tar.gz \ + sources.extras = \ src/content/en/blog/2020/10/05/cargo2nix-demo.tar.gz \ src/content/en/blog/2020/10/05/cargo2nix.tar.gz \ @@ -109,6 +122,7 @@ sources.extras = \ src/content/en/blog/2020/10/05/swift2nix.tar.gz \ src/content/en/blog/2021/02/17/fallible.tar.gz \ src/content/en/podcasts/2020/12/19/test-entry.flac \ + src/content/en/podcasts/2020/12/19/test-entry.ogg \ src/content/en/screencasts/2021/02/07/autoqemu.tar.gz \ src/content/en/screencasts/2021/02/07/autoqemu.webm \ @@ -891,6 +905,10 @@ src/content/en/podcasts/categories.html: src/content/en/podcasts/categories.html src/content/en/screencasts/categories.html: src/content/en/screencasts/categories.htmllisting src/content/en/screencasts/categories.htmlbody src/content/en/tils/categories.html: src/content/en/tils/categories.htmllisting src/content/en/tils/categories.htmlbody +src/content/en/podcasts/2020/12/19/test-entry.flac.torrent: src/content/en/podcasts/2020/12/19/test-entry.flac +src/content/en/podcasts/2020/12/19/test-entry.ogg.torrent: src/content/en/podcasts/2020/12/19/test-entry.ogg +src/content/en/screencasts/2021/02/07/autoqemu.webm.torrent: src/content/en/screencasts/2021/02/07/autoqemu.webm + articles.blog.adoc = \ diff --git a/mkdeps.sh b/mkdeps.sh index 96fb138..5a9ae5d 100755 --- a/mkdeps.sh +++ b/mkdeps.sh @@ -24,11 +24,23 @@ categories() { find src/collections/*/categories.adoc | normalize } +media() { + find src/content/ \( -type f -and \! -type l \) -and \( \ + -name '*.flac' -or \ + -name '*.ogg' -or \ + -name '*.webm' \ + \) +} + +tarballs() { + find src/content/ \( -type f -and \! -type l \) -and \( \ + -name '*.tar.gz' \ + \) +} + extras() { - find src/content/ -type f \ - -name '*.flac' -or \ - -name '*.webm' -or \ - -name '*.tar.gz' + media + tarballs } listings() { @@ -49,6 +61,8 @@ categories | varlist 'categories.adoc' indexes | varlist 'indexes.adoc' indexes | sed 's|/index\.adoc$|/feed.xml|' | varlist 'feeds.xml' find src/content/img/ -name '*.svg' | varlist 'images.svg' +media | varlist 'sources.media' +tarballs | varlist 'sources.tarballs' extras | varlist 'sources.extras' @@ -80,6 +94,9 @@ listings | sed 's/^\(.*\)\.adoc$/\1.html:\t\1.htmlheader\t\1.htmlfooter/' listings | sed 's/^\(.*\)\.adoc$/\1.html:\t\1.htmllisting\t\1.htmlbody/' printf '\n' +media | sed 's/\(.*\)$/\1.torrent:\t\1/' +printf '\n' + for colllink in src/collections/*; do c="$(printf '%s' "$colllink" | normalize)" diff --git a/src/content/en/podcasts/2020/12/19/test-entry.flac.torrent b/src/content/en/podcasts/2020/12/19/test-entry.flac.torrent new file mode 100644 index 0000000..519fb2f Binary files /dev/null and b/src/content/en/podcasts/2020/12/19/test-entry.flac.torrent differ diff --git a/src/content/en/podcasts/2020/12/19/test-entry.ogg b/src/content/en/podcasts/2020/12/19/test-entry.ogg new file mode 100644 index 0000000..9bf5500 Binary files /dev/null and b/src/content/en/podcasts/2020/12/19/test-entry.ogg differ diff --git a/src/content/en/podcasts/2020/12/19/test-entry.ogg.torrent b/src/content/en/podcasts/2020/12/19/test-entry.ogg.torrent new file mode 100644 index 0000000..901eac3 --- /dev/null +++ b/src/content/en/podcasts/2020/12/19/test-entry.ogg.torrent @@ -0,0 +1 @@ +d10:created by13:mktorrent 1.14:infod6:lengthi97060e12:x_cross_seed42:mktorrent-9934A4BD4BF787E1BD685FCE62C6057A4:name14:test-entry.ogg12:piece lengthi32768e6:pieces60:dTÝK«f^”Q_eõù]O´ðI}PúG“+'wgäË/É2áýÒ¤¢«þ³p_yæ¯_ü£6Ó!ÇSè