aboutsummaryrefslogtreecommitdiff
path: root/scripts/assert-content.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xscripts/assert-content.sh39
1 files changed, 37 insertions, 2 deletions
diff --git a/scripts/assert-content.sh b/scripts/assert-content.sh
index cdd2a01..558e424 100755
--- a/scripts/assert-content.sh
+++ b/scripts/assert-content.sh
@@ -3,7 +3,10 @@ set -Eeuo pipefail
end="\033[0m"
red="\033[0;31m"
-red() { echo -e "${red}${1}${end}"; }
+yellow="\033[0;33m"
+red() { echo -e "${red}${1}${end}"; }
+yellow() { echo -e "${yellow}${1}${end}"; }
+
## Constant definitions
@@ -98,16 +101,48 @@ assert-frontmatter() {
if [[ "$PREFIX" = '_podcasts/' ]]; then
AUDIO="$(get-x audio "$F")"
+ SLUG="$(get-x slug "$F")"
+
[[ -z "$AUDIO" ]] && fail-attr 'audio' "${URL}"
+ [[ -z "$SLUG" ]] && fail-attr 'slug' "${URL}"
+
+ TITLE_SLUG="$(slugify "$TITLE")"
+ if [[ "$SLUG" != "$TITLE_SLUG" ]]; then
+ red "slug and title don't match."
+ red "slug: '$SLUG'"
+ red "title slug: '$TITLE_SLUG'"
+ exit 1
+ fi
+
for audiofmt in flac ogg; do
DATE="$(get-date "$F")"
URL_BASENAME="$(basename "$(get-url "$F")")"
- AUDIO="resources/podcasts/$LLANG/${DATE}-${REF}.$audiofmt"
+ AUDIO="resources/podcasts/${DATE}-${SLUG}.$audiofmt"
if [[ ! -f "$AUDIO" ]]; then
red "Missing audio file '$AUDIO'."
exit 1
fi
done
+
+ 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'
+
+ for audiofmt in ogg; do
+ OGG="resources/podcasts/$DATE-$SLUG.ogg"
+ TORRENT="$OGG.torrent"
+ WEBSEED="https://euandre.org/$OGG"
+ if [ ! -f "$TORRENT" ]; then
+ yellow "Missing torrent $TORRENT, generating..."
+ mktorrent $TRACKERS \
+ -f \
+ -v \
+ -d \
+ -c "$(cat _podcasts/$DATE-$SLUG.md)" \
+ -n "$TITLE.ogg" \
+ -w "$WEBSEED" \
+ -o "$TORRENT" \
+ "$OGG"
+ fi
+ done
fi
if [[ "$DESIRED_LAYOUT" != 'page' ]]; then