diff options
author | EuAndreh <eu@euandre.org> | 2020-12-24 14:06:39 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-12-24 14:08:58 -0300 |
commit | 7fb28b72c921b3840fc5017665621b9719ad4d11 (patch) | |
tree | 5ee9434563abc3d822acbf6590f4f47db2ea8b00 /scripts/assert-content.sh | |
parent | default.nix: Fix phases of test attribute (diff) | |
download | euandre.org-7fb28b72c921b3840fc5017665621b9719ad4d11.tar.gz euandre.org-7fb28b72c921b3840fc5017665621b9719ad4d11.tar.xz |
assert-content.sh: Strip frontmatter from cast notes
Diffstat (limited to '')
-rwxr-xr-x | scripts/assert-content.sh | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/scripts/assert-content.sh b/scripts/assert-content.sh index 6694153..08b256a 100755 --- a/scripts/assert-content.sh +++ b/scripts/assert-content.sh @@ -8,7 +8,21 @@ red() { echo -e "${red}${1}${end}"; } yellow() { echo -e "${yellow}${1}${end}"; } TRACKERS='-a udp://tracker.coppersurfer.tk:6969/announce -a udp://tracker.ccc.de:80/announce -a udp://tracker.publicbt.com:80 -a udp://tracker.istole.it:80 -a http://tracker.openbittorrent.com:80/announce -a http://tracker.ipv6tracker.org:80/announce' +AWK_S=' +BEGIN { + FRONTMATTER=0 +} + +/^---$/ { + FRONTMATTER=!FRONTMATTER; + getline; # strip empty line below end of frontmatter + next; +} +FRONTMATTER==0 { + print $0; +} +' ## Constant definitions @@ -131,14 +145,15 @@ assert-frontmatter() { if [ ! -f "$TORRENT" ]; then yellow "Missing torrent $TORRENT, generating..." # shellcheck disable=2086 - mktorrent $TRACKERS \ - -f \ - -v \ - -d \ - -c "$(cat "_podcasts/$DATE-$SLUG.md")" \ - -n "$TITLE.ogg" \ - -w "$WEBSEED" \ - -o "$TORRENT" \ + NOTES="$(awk "$AWK_S" "_podcasts/$DATE-$SLUG.md")" + mktorrent $TRACKERS \ + -f \ + -v \ + -d \ + -c "$NOTES" \ + -n "$TITLE.ogg" \ + -w "$WEBSEED" \ + -o "$TORRENT" \ "$OGG" fi fi @@ -172,14 +187,15 @@ assert-frontmatter() { if [ ! -f "$TORRENT" ]; then yellow "Missing torrent $TORRENT, generating..." # shellcheck disable=2086 - mktorrent $TRACKERS \ - -f \ - -v \ - -d \ - -c "$(cat "_screencasts/$DATE-$SLUG.md")" \ - -n "$TITLE.webm" \ - -w "$WEBSEED" \ - -o "$TORRENT" \ + NOTES="$(awk "$AWK_S" "_screencasts/$DATE-$SLUG.md")" + mktorrent $TRACKERS \ + -f \ + -v \ + -d \ + -c "$NOTES" \ + -n "$TITLE.webm" \ + -w "$WEBSEED" \ + -o "$TORRENT" \ "$WEBM" fi fi |