diff options
Diffstat (limited to '')
-rwxr-xr-x | scripts/assert-content.sh | 40 | ||||
-rw-r--r-- | scripts/spelling/eo.txt | 1 | ||||
-rw-r--r-- | scripts/spelling/pt.txt | 2 |
3 files changed, 29 insertions, 14 deletions
diff --git a/scripts/assert-content.sh b/scripts/assert-content.sh index fd017b0..e8d0382 100755 --- a/scripts/assert-content.sh +++ b/scripts/assert-content.sh @@ -45,10 +45,6 @@ get-lang() { echo "${1}" | base64 --decode | jq -r .lang } -get-ref() { - echo "${1}" | base64 --decode | jq -r .ref -} - get-url() { # Remove leading / to match more closely the filesystem hierarchy echo "${1}" | base64 --decode | jq -r .url | sed 's_^/__' @@ -58,12 +54,8 @@ get-date() { echo "${1}" | base64 --decode | jq -r .date | awk '{print $1}' } -get-title() { - echo "${1}" | base64 --decode | jq -r .title -} - -get-layout() { - echo "${1}" | base64 --decode | jq -r .layout +get-x() { + echo "${2}" | base64 --decode | jq -r ".$1" } is-ignored() { @@ -84,10 +76,10 @@ assert-frontmatter() { PREFIX="${3:-}" EXTENSION="${4:-md}" LLANG="$(get-lang "$F")" - REF="$(get-ref "$F")" + REF="$(get-x ref "$F")" URL="$(get-url "$F")" - LAYOUT="$(get-layout "$F")" - TITLE="$(get-title "$F")" + LAYOUT="$(get-x layout "$F")" + TITLE="$(get-x title "$F")" [[ -z "${LLANG}" ]] && fail-attr 'lang' "${URL}" [[ -z "${REF}" ]] && fail-attr 'ref' "${URL}" @@ -104,6 +96,20 @@ assert-frontmatter() { exit 1 fi + if [[ "$PREFIX" = '_podcasts/' ]]; then + AUDIO="$(get-x audio "$F")" + [[ -z "$AUDIO" ]] && fail-attr 'audio' "${URL}" + for audiofmt in flac ogg; do + DATE="$(get-date "$F")" + URL_BASENAME="$(basename "$(get-url "$F")")" + AUDIO="resources/podcasts/$LLANG/${DATE}-${REF}.$audiofmt" + if [[ ! -f "$AUDIO" ]]; then + red "Missing audio file '$AUDIO'." + exit 1 + fi + done + fi + if [[ "$DESIRED_LAYOUT" != 'page' ]]; then DATE="$(get-date "$F")" URL_BASENAME="$(basename "$(get-url "$F")")" @@ -159,6 +165,11 @@ for slide in $(jq -r '.slides[] | @base64' "${JSON}"); do assert-frontmatter "$slide" 'slides' '_slides/' 'slides' done +echo Linting podcasts... >&2 +for podcast in $(jq -r '.podcasts[] | @base64' "${JSON}"); do + assert-frontmatter "$podcast" 'podcast' '_podcasts/' +done + echo Asserting unique refs... >&2 KNOWN_IDS=() assert-unique-ref() { @@ -167,7 +178,7 @@ assert-unique-ref() { URL="$(get-url "$page")" if ! is-ignored "${URL}"; then LLANG="$(get-lang "$page")" - REF="$(get-ref "$page")" + REF="$(get-x ref "$page")" ID="${TYPE}:${LLANG}:${REF}" if contains-element "${ID}" "${KNOWN_IDS[@]}"; then @@ -186,5 +197,6 @@ 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 '.slides[] | @base64' "${JSON}")" 'slides' +assert-unique-ref "$(jq -r '.podcasts[] | @base64' "${JSON}")" 'podcasts' echo Done. >&2 diff --git a/scripts/spelling/eo.txt b/scripts/spelling/eo.txt index aa19e9f..8629511 100644 --- a/scripts/spelling/eo.txt +++ b/scripts/spelling/eo.txt @@ -6,5 +6,6 @@ H HML L M +Podkastaĵoj ernis odiaŭ diff --git a/scripts/spelling/pt.txt b/scripts/spelling/pt.txt index 59e4113..9a0bfa5 100644 --- a/scripts/spelling/pt.txt +++ b/scripts/spelling/pt.txt @@ -12,6 +12,7 @@ L Lista Me Patches +Podcast Postado Postagens Quando @@ -96,6 +97,7 @@ padrão para parar pessoal +podcast por post postagens |