From c97f6641aaeda85753363bfd73373b39433ffbbf Mon Sep 17 00:00:00 2001 From: Vincent Finance Date: Sun, 8 Aug 2021 20:26:31 +0200 Subject: [PATCH] potcasse: add Gemini protocol support + update documentation --- LICENSE | 2 +- README.md | 16 ++++++++------- potcasse | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 65 insertions(+), 12 deletions(-) diff --git a/LICENSE b/LICENSE index e811e67..87c0faf 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021 Rapenne Solène +Copyright (c) 2021 Rapenne Solène and Vincent Finance All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index 643e721..081153a 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,13 @@ potcasse, pronounced "pot kas" is meant to help people to publish and self host * rsync (could use cp but avoid recopying audio files locally). * a posix compatible OS (Linux, *BSD, Solaris). -* some webserver to host the files. +* some webserver and/or some gemini server to host the files. # How to use -The idea is to regroup audio files with their metadata in a directory and generate the structure that you will publish on a web server. +The idea is to regroup audio files with their metadata in a directory and generate the structure that you will publish on a web server and/or on a Gemini server. -A simple `index.html` file is also generated in the process to give an easy list without using the RSS file. +A simple `index.html` file and a simple `index.gmi` file are also generated in the process to give an easy list without using the RSS file. ## First time @@ -27,11 +27,13 @@ It has the following variables: + `TITLE`: this is the podcast title. + `AUTHOR`: this is the podcast author (doesn't support multiples authors yet). + `SITE`: base HTTP URL where your podcast will be available (for example `https://tilde.example/myname/podcast/`. ++ `CAPSULE`: base Gemini URL where your podcast will be available (for example `gemini://tilde.example/myname/podcast/`. ++ `DESCRIPTION`: description of the podcast. + `RSSLINK`: name of the RSS feed. -+ `IMAGE`: if value is not empty, potcasse will use the file `logo.png`. ++ `IMAGE`: if value is not empty, potcasse will use the file `logo.png` (only used on the web version) + `LANGUAGE`: language code (such as `fr` or `en-us`) that can be potentially used by some players. -You will share the link `$SITE/index.html` or `$SITE/$RSSLINK` to your listeners. +You will share the link `$SITE/index.html`, `$SITE/index.gmi` or `$SITE/$RSSLINK` to your listeners. ## New episode @@ -53,9 +55,9 @@ potcasse episode "Episode XX: trying something weird" /path/to/audio/file this_i potcasse gen ``` -this will create or update the `output_html` directory with your audio files, the RSS file, an index.html file listing all the episodes and the logo file if any. +This will create or update the `output_html` directory with your audio files, the RSS file, an index.html file listing all the episodes and the logo file if any. It will also create or update the `output_gmi` directory according to the same scheme, in order to create a Gemini compatible version of the listing (it will not use the logo file though). -# Real world example +# Real world example (from *solene*) My podcast feed is available at `https://perso.pw/lambda/feed.xml` which is on server `perso.pw` in `/var/www/htdocs/lambda/`. diff --git a/potcasse b/potcasse index 44fa8d4..f56b8fc 100755 --- a/potcasse +++ b/potcasse @@ -1,4 +1,5 @@ #!/bin/sh +## potcasse - Based on solene's potcasse (https://tildegit.org/solene/potcasse) exitp() { echo "$1" @@ -26,9 +27,14 @@ init() { TITLE= # base URL of your website -# must end with a / SITE= +# base URL of your gemini capsule +CAPSULE= + +# description of the podcast +DESCRIPTION= + # filename of the RSS file RSSLINK=feed.xml @@ -69,9 +75,12 @@ EOF gen() { test -d episodes || exitp "You need to import episodes before generation" TMPRSS=$(mktemp /tmp/potcasse.XXXXXXXXXXXXXXXXXXXXX) + TMPGEMRSS=$(mktemp /tmp/potcasse.XXXXXXXXXXXXXXXXXXXXX) TMPHTML=$(mktemp /tmp/potcasse.XXXXXXXXXXXXXXXXXXXXX) + TMPGMI=$(mktemp /tmp/potcasse.XXXXXXXXXXXXXXXXXXXXX) . ./metadata.sh mkdir -p output_html/episodes + mkdir -p output_gmi/episodes if [ -n "$IMAGE" ] then @@ -85,7 +94,7 @@ gen() { ${TITLE} ${DESCRIPTION} - + ${SITE} ${SITE}/logo.png @@ -95,6 +104,17 @@ gen() { ${LANGUAGE} EOF + cat <> $TMPGEMRSS + + + + ${TITLE} + ${DESCRIPTION} + + ${CAPSULE} + ${LANGUAGE} +EOF + cat <> $TMPHTML @@ -103,14 +123,24 @@ EOF -

Podcast episodes- ${TITLE}

+

Podcast episodes - ${TITLE}

logo +

${DESCRIPTION}

    +EOF + + cat <> $TMPGMI +# Podcast episodes - ${TITLE} + +${DESCRIPTION} + +=> ${RSSLINK} RSS feed (for podcast players) + EOF for episode in episodes/* @@ -120,6 +150,7 @@ EOF SIZE=$(stat -f "%z" "${episode}/${AUDIOFILE}") EXT=${AUDIOFILE##*.} rsync -a "${episode}/${AUDIOFILE}" output_html/episodes/ + rsync -a "${episode}/${AUDIOFILE}" output_gmi/episodes/ cat <> $TMPRSS $TITLE @@ -128,15 +159,33 @@ EOF ${SITE}/episodes/${AUDIOFILE} +EOF + cat <> $TMPGEMRSS + + $TITLE + + ${PUBDATE} + ${CAPSULE}/episodes/${AUDIOFILE} + + EOF cat <> $TMPHTML
  • ${PUBDATE} - ${TITLE}
  • +EOF + + cat <> $TMPGMI +=> episodes/${AUDIOFILE} ${PUBDATE} - ${TITLE} EOF done cat <> $TMPRSS +EOF + + cat <> $TMPGEMRSS + + EOF cat <> $TMPHTML @@ -146,8 +195,10 @@ EOF EOF install -m 644 "$TMPRSS" output_html/${RSSLINK} + install -m 644 "$TMPGEMRSS" output_gmi/${RSSLINK} install -m 644 "$TMPHTML" output_html/index.html - rm "$TMPRSS" "$TMPHTML" + install -m 644 "$TMPGMI" output_gmi/index.gmi + rm "$TMPRSS" "$TMPHTML" "$TMPGMI" "$TMPGEMRSS" }