aboutsummaryrefslogtreecommitdiff
path: root/scripts/assert-content.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xscripts/assert-content.sh67
1 files changed, 58 insertions, 9 deletions
diff --git a/scripts/assert-content.sh b/scripts/assert-content.sh
index 558e424..ff571c3 100755
--- a/scripts/assert-content.sh
+++ b/scripts/assert-content.sh
@@ -7,6 +7,7 @@ yellow="\033[0;33m"
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'
## Constant definitions
@@ -124,8 +125,6 @@ assert-frontmatter() {
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"
@@ -145,6 +144,50 @@ assert-frontmatter() {
done
fi
+ if [[ "$PREFIX" = '_screencasts/' ]]; then
+ VIDEO="$(get-x video "$F")"
+ SLUG="$(get-x slug "$F")"
+
+ [[ -z "$VIDEO" ]] && fail-attr 'video' "${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 videofmt in webm; do
+ DATE="$(get-date "$F")"
+ URL_BASENAME="$(basename "$(get-url "$F")")"
+ VIDEO="resources/screencasts/${DATE}-${SLUG}.$videofmt"
+ if [[ ! -f "$VIDEO" ]]; then
+ red "Missing video file '$VIDEO'."
+ exit 1
+ fi
+ done
+
+ for videofmt in webm; do
+ WEBM="resources/screencasts/$DATE-$SLUG.webm"
+ TORRENT="$WEBM.torrent"
+ WEBSEED="https://euandre.org/$WEBM"
+ if [ ! -f "$TORRENT" ]; then
+ yellow "Missing torrent $TORRENT, generating..."
+ mktorrent $TRACKERS \
+ -f \
+ -v \
+ -d \
+ -c "$(cat _screencasts/$DATE-$SLUG.md)" \
+ -n "$TITLE.webm" \
+ -w "$WEBSEED" \
+ -o "$TORRENT" \
+ "$WEBM"
+ fi
+ done
+ fi
+
if [[ "$DESIRED_LAYOUT" != 'page' ]]; then
DATE="$(get-date "$F")"
URL_BASENAME="$(basename "$(get-url "$F")")"
@@ -202,7 +245,12 @@ done
echo Linting podcasts... >&2
for podcast in $(jq -r '.podcasts[] | @base64' "${JSON}"); do
- assert-frontmatter "$podcast" 'podcast' '_podcasts/'
+ assert-frontmatter "$podcast" 'cast' '_podcasts/'
+done
+
+echo Linting screencasts... >&2
+for screencast in $(jq -r '.screencasts[] | @base64' "${JSON}"); do
+ assert-frontmatter "$screencast" 'cast' '_screencasts/'
done
echo Asserting unique refs... >&2
@@ -228,11 +276,12 @@ assert-unique-ref() {
done
}
-assert-unique-ref "$(jq -r '.pages[] | @base64' "${JSON}")" 'page'
-assert-unique-ref "$(jq -r '.articles[] | @base64' "${JSON}")" 'article'
-assert-unique-ref "$(jq -r '.tils[] | @base64' "${JSON}")" 'til'
-assert-unique-ref "$(jq -r '.pastebins[] | @base64' "${JSON}")" 'pastebin'
-assert-unique-ref "$(jq -r '.slides[] | @base64' "${JSON}")" 'slides'
-assert-unique-ref "$(jq -r '.podcasts[] | @base64' "${JSON}")" 'podcasts'
+assert-unique-ref "$(jq -r '.pages[] | @base64' "${JSON}")" 'page'
+assert-unique-ref "$(jq -r '.articles[] | @base64' "${JSON}")" 'article'
+assert-unique-ref "$(jq -r '.tils[] | @base64' "${JSON}")" 'til'
+assert-unique-ref "$(jq -r '.pastebins[] | @base64' "${JSON}")" 'pastebin'
+assert-unique-ref "$(jq -r '.slides[] | @base64' "${JSON}")" 'slides'
+assert-unique-ref "$(jq -r '.podcasts[] | @base64' "${JSON}")" 'podcasts'
+assert-unique-ref "$(jq -r '.screencasts[] | @base64' "${JSON}")" 'screencasts'
echo Done. >&2