diff options
-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 |