From 7be007ffb34d4f1be727c9d91570f32b47203117 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 24 Dec 2020 10:55:38 -0300 Subject: Add support for screencasts, behind a feature flag --- TODOs.org | 5 +++ _config.yml | 44 +++++++++++++++++++++++++ _includes/feed.atom | 22 +++++++++---- _layouts/cast.html | 28 ++++++++++++++++ _layouts/default.html | 13 ++++++++ _layouts/podcast.html | 19 ----------- default.nix | 4 +-- screencasts-by-category.md | 13 ++++++++ screencasts-lau-kategorio.md | 13 ++++++++ screencasts-par-categorie.md | 13 ++++++++ screencasts-por-categoria.md | 13 ++++++++ screencasts.en.md | 13 ++++++++ screencasts.eo.md | 13 ++++++++ screencasts.fr.md | 13 ++++++++ screencasts.pt.md | 13 ++++++++ scripts/assert-content.sh | 67 +++++++++++++++++++++++++++++++++----- scripts/spelling/international.txt | 7 ++++ scripts/spelling/pt.txt | 2 ++ site.json | 21 ++++++++++++ 19 files changed, 299 insertions(+), 37 deletions(-) create mode 100644 _layouts/cast.html delete mode 100644 _layouts/podcast.html create mode 100644 screencasts-by-category.md create mode 100644 screencasts-lau-kategorio.md create mode 100644 screencasts-par-categorie.md create mode 100644 screencasts-por-categoria.md create mode 100644 screencasts.en.md create mode 100644 screencasts.eo.md create mode 100644 screencasts.fr.md create mode 100644 screencasts.pt.md diff --git a/TODOs.org b/TODOs.org index 07f29c9..a4030df 100644 --- a/TODOs.org +++ b/TODOs.org @@ -39,3 +39,8 @@ $ convert icon-48x48.png favicon.ico :CUSTOM_ID: 1a2f5619-5d55-449f-a401-8c87afd5bea9 :END: - State "TODO" from [2020-12-24 jeu. 10:38] +** TODO Simplify =link-listing.html= by not requiring =entries= +:PROPERTIES: +:CUSTOM_ID: 28dd5b16-1e32-42d4-960e-27a8725fe0b9 +:END: +- State "TODO" from [2020-12-24 jeu. 11:09] diff --git a/_config.yml b/_config.yml index 8cb88e0..d9751d2 100644 --- a/_config.yml +++ b/_config.yml @@ -21,6 +21,8 @@ kramdown: atom: podcasts: audio: true + screencasts: + video: true exclude: - Gemfile @@ -37,6 +39,7 @@ exclude: - tests.sh - static/graphviz/ - drafts + - TODOs.org collections: articles: @@ -54,6 +57,9 @@ collections: podcasts: output: true permalink: /podcast/:year/:month/:day/:title:output_ext + screencasts: + output: true + permalink: /screencast/:year/:month/:title:output_ext t: description: @@ -261,6 +267,44 @@ t: pt: "episodios-do-podcast-por-categoria.md" fr: "episodes-de-podcast-par-categorie.md" eo: "podkastajoj-lau-kategorio.md" + screencasts: + name: + en: "Screencasts" + pt: "Screencasts" + fr: "Screencasts" + eo: "Screencasts" + url: + en: "screencasts.en.md" + pt: "screencasts.pt.md" + fr: "screencasts.fr.md" + eo: "screencasts.eo.md" + listing: + en: "Screencasts listing" + pt: "Lista de screencasts" + fr: "Lise de screencasts" + eo: "Listo de screencasts" + feed: + title: + en: "EuAndreh's screencasts" + pt: "Screencasts do EuAndreh" + fr: "Screencasts d'EuAndreh" + eo: "Screencasts de EuAndreh" + url: + en: "/feed.screencasts.en.atom" + pt: "/feed.screencasts.pt.atom" + fr: "/feed.screencasts.fr.atom" + eo: "/feed.screencasts.eo.atom" + category: + name: + en: "Screencasts by category" + pt: "Screencasts por categoria" + fr: "Screencasts par catégorie" + eo: "Screencasts laŭ kategoria" + url: + en: "screencasts-by-category.md" + pt: "screencasts-por-categoria.md" + fr: "screencasts-par-categorie.md" + eo: "screencasts-lau-kategorio.md" posted_on: en: "Posted on" pt: "Postado em" diff --git a/_includes/feed.atom b/_includes/feed.atom index b7a97ca..9297201 100644 --- a/_includes/feed.atom +++ b/_includes/feed.atom @@ -1,10 +1,14 @@ -{% assign is_audio=site.atom[include.kind].audio %} - {% if is_audio %} +{% assign + is_audio=site.atom[include.kind].audio +%}{% assign + is_video=site.atom[include.kind].video +%} + {% if is_audio or is_video %} {{ site.title | smartify | xml_escape }} - {{ site.t.podcasts.feed.title[include.lang] | smartify | xml_escape }} + {{ site.t[include.kind].feed.title[include.lang] | smartify | xml_escape }} {{ page.url | absolute_url | xml_escape }} {{ include.lang }} @@ -18,7 +22,7 @@ {{ '/' | absolute_url | xml_escape }}static/favicon.png {{ page.url | absolute_url | xml_escape }} - {{ site.t.podcasts.feed.title }} + {{ site.t[include.kind].feed.title }} {% else %} {{ entry.title | smartify | strip_html | normalize_whitespace | xml_escape }} {{ entry.url | absolute_url | xml_escape }} @@ -48,7 +52,11 @@ {{ entry.content | strip | xml_escape }} - + {% if is_audio %} + + {% elsif is_video %} + + {% endif %} EuAndreh {{ entry.date | date_to_xmlschema }} @@ -74,7 +82,7 @@ {% endif %} {% endfor %} -{% if is_audio %} +{% if is_audio or is_video %} {% else %} diff --git a/_layouts/cast.html b/_layouts/cast.html new file mode 100644 index 0000000..330aed7 --- /dev/null +++ b/_layouts/cast.html @@ -0,0 +1,28 @@ +--- +layout: post +--- + +{% if page.audio %} + + + +{% endif %} + +{% if page.video %} + +{% endif %} + +{{ content }} diff --git a/_layouts/default.html b/_layouts/default.html index 8ab772e..441af23 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -11,6 +11,9 @@ {% if site.podcast %} {% endif %} + {% if site.screencast %} + + {% endif %} {{ page.title }} - EuAndreh @@ -47,6 +50,9 @@ {% if site.podcast %} {{ site.t.podcasts.name[page.lang] }} {% endif %} + {% if site.screencast %} + {{ site.t.screencasts.name[page.lang] }} + {% endif %} {{ site.t.about.name[page.lang] }} {% if page.ref != nil %} @@ -89,6 +95,13 @@ {{ lpodcast.lang }} {% endfor %} + + {% assign lscreencasts=site.screencasts | where:"ref", page.ref | sort: 'lang' %} + {% for lscreencast in lscreencasts %} +
  • + {{ lscreencast.lang }} +
  • + {% endfor %} {% else %} {% link break-build-if-any-page-has-a-missing-ref %} diff --git a/_layouts/podcast.html b/_layouts/podcast.html deleted file mode 100644 index 197943f..0000000 --- a/_layouts/podcast.html +++ /dev/null @@ -1,19 +0,0 @@ ---- -layout: post ---- - - - - - -{{ content }} diff --git a/default.nix b/default.nix index 2640e08..331beba 100644 --- a/default.nix +++ b/default.nix @@ -12,7 +12,7 @@ let gemset = ./nix/gemset.nix; }; - mktorrent-newer = pkgs.mktorrent.overrideAttrs(oldAttrs: { + mktorrent-newer = pkgs.mktorrent.overrideAttrs (oldAttrs: { src = pkgs.fetchFromGitHub { owner = "Rudde"; repo = "mktorrent"; @@ -64,7 +64,7 @@ in rec { echo 'Starting a live server with:' echo ' jekyll serve --future --livereload --trace' echo 'Server with feature flags:' - echo ' jekyll serve --future --livereload --trace -c $(cfg torrent podcast)' + echo ' jekyll serve --future --livereload --trace -c $(cfg podcast screencast)' cfg() { T="$(mktemp --suffix .yml)" diff --git a/screencasts-by-category.md b/screencasts-by-category.md new file mode 100644 index 0000000..ef0eb4b --- /dev/null +++ b/screencasts-by-category.md @@ -0,0 +1,13 @@ +--- + +title: Screencasts by category + +layout: page + +lang: en + +ref: screencasts-by-category + +--- + +{% include categories.html kind="screencasts" %} diff --git a/screencasts-lau-kategorio.md b/screencasts-lau-kategorio.md new file mode 100644 index 0000000..be653ea --- /dev/null +++ b/screencasts-lau-kategorio.md @@ -0,0 +1,13 @@ +--- + +title: Screencasts laŭ kategorio + +layout: page + +lang: eo + +ref: screencasts-by-category + +--- + +{% include categories.html kind="screencasts" %} diff --git a/screencasts-par-categorie.md b/screencasts-par-categorie.md new file mode 100644 index 0000000..3f7b828 --- /dev/null +++ b/screencasts-par-categorie.md @@ -0,0 +1,13 @@ +--- + +title: Screencasts par catégorie + +layout: page + +lang: fr + +ref: screencasts-by-category + +--- + +{% include categories.html kind="screencasts" %} diff --git a/screencasts-por-categoria.md b/screencasts-por-categoria.md new file mode 100644 index 0000000..a830663 --- /dev/null +++ b/screencasts-por-categoria.md @@ -0,0 +1,13 @@ +--- + +title: Screencasts por categoria + +layout: page + +lang: pt + +ref: screencasts-by-category + +--- + +{% include categories.html kind="screencasts" %} diff --git a/screencasts.en.md b/screencasts.en.md new file mode 100644 index 0000000..e42a961 --- /dev/null +++ b/screencasts.en.md @@ -0,0 +1,13 @@ +--- + +title: Screencasts + +layout: page + +lang: en + +ref: screencasts + +--- + +{% include link-listing.html entries=site.screencasts kind="screencasts" %} diff --git a/screencasts.eo.md b/screencasts.eo.md new file mode 100644 index 0000000..337bf08 --- /dev/null +++ b/screencasts.eo.md @@ -0,0 +1,13 @@ +--- + +title: Screencasts + +layout: page + +lang: eo + +ref: screencasts + +--- + +{% include link-listing.html entries=site.screencasts kind="screencasts" %} diff --git a/screencasts.fr.md b/screencasts.fr.md new file mode 100644 index 0000000..aee9ba1 --- /dev/null +++ b/screencasts.fr.md @@ -0,0 +1,13 @@ +--- + +title: Screencasts + +layout: page + +lang: fr + +ref: screencasts + +--- + +{% include link-listing.html entries=site.screencasts kind="screencasts" %} diff --git a/screencasts.pt.md b/screencasts.pt.md new file mode 100644 index 0000000..24d1c49 --- /dev/null +++ b/screencasts.pt.md @@ -0,0 +1,13 @@ +--- + +title: Screencasts + +layout: page + +lang: pt + +ref: screencasts + +--- + +{% include link-listing.html entries=site.screencasts kind="screencasts" %} 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 diff --git a/scripts/spelling/international.txt b/scripts/spelling/international.txt index 4fce56c..562c9b7 100644 --- a/scripts/spelling/international.txt +++ b/scripts/spelling/international.txt @@ -104,6 +104,8 @@ Reddit Redux SA SSD +Screencast +Screencasts ShellCheck Slava Sourcehut @@ -122,6 +124,7 @@ UI URL VPN WebAssembly +WebTorrent Wollrath Wyant Yandex @@ -206,16 +209,20 @@ pt rollout rollouts sbcl +screencast +screencasts songbooks sourcehut sr swift2nix systemd só +torrent touchpad txt v8 vlog +webtorrent www xp xyz diff --git a/scripts/spelling/pt.txt b/scripts/spelling/pt.txt index 9a0bfa5..c7da56d 100644 --- a/scripts/spelling/pt.txt +++ b/scripts/spelling/pt.txt @@ -60,6 +60,7 @@ escrevo esforço estou eu +exemplo existentes extra fazer @@ -117,6 +118,7 @@ significa simples sobre tempo +teste texto timestamp transpor diff --git a/site.json b/site.json index 66dac32..f27c7b7 100644 --- a/site.json +++ b/site.json @@ -116,5 +116,26 @@ "slug": "{{ podcast.slug }}" }{% unless forloop.last %},{% endunless %} {% endfor %} + ], + "screencasts": [ + {% assign filtered_screencasts = "" | split:"" %} + {% for screencast in site.screencasts %} + {% unless screencast.plaintext %} + {% assign filtered_screencasts = filtered_screencasts | push:screencast %} + {% endunless %} + {% endfor %} + {% for screencast in filtered_screencasts %} + { + "title": "{{ screencast.title | smartify }}", + "date": "{{ screencast.date }}", + "url": "{{ screencast.url }}", + "lang": "{{ screencast.lang }}", + "ref": "{{ screencast.ref }}", + "layout": "{{ screencast.layout }}", + "content": {{ screencast.content | strip_html | jsonify }}, + "video": "{{ screencast.video }}", + "slug": "{{ screencast.slug }}" + }{% unless forloop.last %},{% endunless %} + {% endfor %} ] } -- cgit v1.2.3