diff options
author | EuAndreh <eu@euandre.org> | 2020-12-24 10:55:38 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-12-24 13:07:16 -0300 |
commit | 7be007ffb34d4f1be727c9d91570f32b47203117 (patch) | |
tree | 074c665a4c9a3fc51ddca41282d84783bbc432bf | |
parent | TODOs.org (diff) | |
download | euandre.org-7be007ffb34d4f1be727c9d91570f32b47203117.tar.gz euandre.org-7be007ffb34d4f1be727c9d91570f32b47203117.tar.xz |
Add support for screencasts, behind a feature flag
Diffstat (limited to '')
-rw-r--r-- | TODOs.org | 5 | ||||
-rw-r--r-- | _config.yml | 44 | ||||
-rw-r--r-- | _includes/feed.atom | 22 | ||||
-rw-r--r-- | _layouts/cast.html | 28 | ||||
-rw-r--r-- | _layouts/default.html | 13 | ||||
-rw-r--r-- | _layouts/podcast.html | 19 | ||||
-rw-r--r-- | default.nix | 4 | ||||
-rw-r--r-- | screencasts-by-category.md | 13 | ||||
-rw-r--r-- | screencasts-lau-kategorio.md | 13 | ||||
-rw-r--r-- | screencasts-par-categorie.md | 13 | ||||
-rw-r--r-- | screencasts-por-categoria.md | 13 | ||||
-rw-r--r-- | screencasts.en.md | 13 | ||||
-rw-r--r-- | screencasts.eo.md | 13 | ||||
-rw-r--r-- | screencasts.fr.md | 13 | ||||
-rw-r--r-- | screencasts.pt.md | 13 | ||||
-rwxr-xr-x | scripts/assert-content.sh | 67 | ||||
-rw-r--r-- | scripts/spelling/international.txt | 7 | ||||
-rw-r--r-- | scripts/spelling/pt.txt | 2 | ||||
-rw-r--r-- | site.json | 21 |
19 files changed, 299 insertions, 37 deletions
@@ -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 %}<?xml version="1.0" encoding="UTF-8"?> - {% if is_audio %} +{% assign + is_audio=site.atom[include.kind].audio +%}{% assign + is_video=site.atom[include.kind].video +%}<?xml version="1.0" encoding="UTF-8"?> + {% if is_audio or is_video %} <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <channel> <title>{{ site.title | smartify | xml_escape }}</title> - <description>{{ site.t.podcasts.feed.title[include.lang] | smartify | xml_escape }}</description> + <description>{{ site.t[include.kind].feed.title[include.lang] | smartify | xml_escape }}</description> <link>{{ page.url | absolute_url | xml_escape }}</link> <atom:link href="{{ page.url | absolute_url | xml_escape }}" rel="self" type="application/atom+xml" /> <language>{{ include.lang }}</language> @@ -18,7 +22,7 @@ <image> <url>{{ '/' | absolute_url | xml_escape }}static/favicon.png</url> <link>{{ page.url | absolute_url | xml_escape }}</link> - <title>{{ site.t.podcasts.feed.title }}</title> + <title>{{ site.t[include.kind].feed.title }}</title> </image> {% else %} <feed @@ -40,7 +44,7 @@ {% assign entries = include.entries | where:"lang", include.lang | has_category:include.categories_filter | sort: "date" | reverse %} {% for entry in entries %} - {% if is_audio %} + {% if is_audio or is_video %} <item> <title>{{ entry.title | smartify | strip_html | normalize_whitespace | xml_escape }}</title> <link>{{ entry.url | absolute_url | xml_escape }}</link> @@ -48,7 +52,11 @@ <description xml:base="{{ entry.url | absolute_url | xml_escape }}"> {{ entry.content | strip | xml_escape }} </description> - <enclosure url="{{ '/' | absolute_url | xml_escape }}resources/podcasts/{{ include.lang }}/{{ entry.date | date: "%Y-%m-%d" }}-{{ entry.ref }}.ogg" type="audio/ogg" length="11779397" /> + {% if is_audio %} + <enclosure url="{{ '/' | absolute_url | xml_escape }}resources/podcasts/{{ entry.date | date: "%Y-%m-%d" }}-{{ entry.ref }}.ogg" type="audio/ogg" /> + {% elsif is_video %} + <enclosure url="{{ '/' | absolute_url | xml_escape }}resources/screencasts/{{ entry.date | date: "%Y-%m-%d" }}-{{ entry.ref }}.webm.torrent" type="application/x-bittorrent" /> + {% endif %} <category>EuAndreh</category> <pubDate>{{ entry.date | date_to_xmlschema }}</pubDate> </item> @@ -74,7 +82,7 @@ {% endif %} {% endfor %} -{% if is_audio %} +{% if is_audio or is_video %} </channel> </rss> {% 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 %} + <audio controls> + <source src="{% link /resources/podcasts/{{ page.date | date: "%Y-%m-%d" }}-{{ page.slug }}.ogg %}" type="audio/ogg"> + <source src="{% link /resources/podcasts/{{ page.date | date: "%Y-%m-%d" }}-{{ page.slug }}.flac %}" type="audio/flac"> + </audio> + + <div class="torrent-link"> + {% capture torrent-file %}{{ site.url }}/resources/podcasts/{{ page.date | date: "%Y-%m-%d" }}-{{ page.slug }}.ogg.torrent{% endcapture %} + <a href="{{ torrent-file }}">torrent</a> + | + <a href="/torrent.html?torrent={{ torrent-file | uri_escape }}">online webtorrent</a> + </div> +{% endif %} + +{% if page.video %} + <div class="torrent-link"> + {% capture torrent-file %}{{ site.url }}/resources/screencasts/{{ page.date | date: "%Y-%m-%d" }}-{{ page.slug }}.webm.torrent{% endcapture %} + <a href="{{ torrent-file }}">torrent</a> + | + <a href="/torrent.html?torrent={{ torrent-file | uri_escape }}">online webtorrent</a> + </div> +{% 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 %} <link rel="alternate" type="application/atom+xml" href="{{ site.t.podcasts.feed.url[page.lang] }}" hreflang="{{ page.lang }}" title="{{ site.t.podcasts.feed.title[page.lang] }}" /> {% endif %} + {% if site.screencast %} + <link rel="alternate" type="application/atom+xml" href="{{ site.t.screencasts.feed.url[page.lang] }}" hreflang="{{ page.lang }}" title="{{ site.t.screencasts.feed.title[page.lang] }}" /> + {% endif %} <title>{{ page.title }} - EuAndreh</title> <meta property="og:site_name" content="{{ site.title }}" /> @@ -47,6 +50,9 @@ {% if site.podcast %} <a href="{% link {{ site.t.podcasts.url[page.lang] }} %}">{{ site.t.podcasts.name[page.lang] }}</a> {% endif %} + {% if site.screencast %} + <a href="{% link {{ site.t.screencasts.url[page.lang] }} %}">{{ site.t.screencasts.name[page.lang] }}</a> + {% endif %} <a href="{% link {{ site.t.about.url[page.lang] }} %}">{{ site.t.about.name[page.lang] }}</a> </div> {% if page.ref != nil %} @@ -89,6 +95,13 @@ <a href="{{ lpodcast.url }}" class="{{ lpodcast.lang }}">{{ lpodcast.lang }}</a> </li> {% endfor %} + + {% assign lscreencasts=site.screencasts | where:"ref", page.ref | sort: 'lang' %} + {% for lscreencast in lscreencasts %} + <li> + <a href="{{ lscreencast.url }}" class="{{ lscreencast.lang }}">{{ lscreencast.lang }}</a> + </li> + {% endfor %} </ul> {% 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 ---- - -<audio controls> - <source src="{% link /resources/podcasts/{{ page.date | date: "%Y-%m-%d" }}-{{ page.slug }}.ogg %}" type="audio/ogg"> - <source src="{% link /resources/podcasts/{{ page.date | date: "%Y-%m-%d" }}-{{ page.slug }}.flac %}" type="audio/flac"> -</audio> - -<div class="torrent-link"> - {% capture torrent-file %}{{ site.url }}/resources/podcasts/{{ page.date | date: "%Y-%m-%d" }}-{{ page.slug }}.ogg.torrent{% endcapture %} - <a href="{{ torrent-file }}">torrent</a> - {% if site.torrent %} - | - <a href="/torrent.html?torrent={{ torrent-file | uri_escape }}">online webtorrent</a> - {% endif %} -</div> - -{{ 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 @@ -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 %} ] } |