potcasse: add Gemini protocol support + update documentation
This commit is contained in:
parent
f5a3671282
commit
c97f6641aa
2
LICENSE
2
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
|
||||
|
|
16
README.md
16
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/`.
|
||||
|
||||
|
|
59
potcasse
59
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() {
|
|||
<channel>
|
||||
<title>${TITLE}</title>
|
||||
<description>${DESCRIPTION}</description>
|
||||
<atom:link href="${SITE}${RSSLINK}" rel="self" type="application/rss+xml" />
|
||||
<atom:link href="${SITE}/${RSSLINK}" rel="self" type="application/rss+xml" />
|
||||
<link>${SITE}</link>
|
||||
<image>
|
||||
<url>${SITE}/logo.png</url>
|
||||
|
@ -95,6 +104,17 @@ gen() {
|
|||
<language>${LANGUAGE}</language>
|
||||
EOF
|
||||
|
||||
cat <<EOF >> $TMPGEMRSS
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>${TITLE}</title>
|
||||
<description>${DESCRIPTION}</description>
|
||||
<atom:link href="${CAPSULE}/${RSSLINK}" rel="self" type="application/rss+xml" />
|
||||
<link>${CAPSULE}</link>
|
||||
<language>${LANGUAGE}</language>
|
||||
EOF
|
||||
|
||||
cat <<EOF >> $TMPHTML
|
||||
<!DOCTYPE html>
|
||||
<html lang="${LANGUAGE}">
|
||||
|
@ -103,14 +123,24 @@ EOF
|
|||
<meta charset="utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Podcast episodes- ${TITLE}</h1>
|
||||
<h1>Podcast episodes - ${TITLE}</h1>
|
||||
<div>
|
||||
<img src="logo.png" width=200 height=200 alt="logo" />
|
||||
<p>${DESCRIPTION}</p>
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="${RSSLINK}">RSS feed</a> (for podcast players).</li>
|
||||
</ul>
|
||||
<ul>
|
||||
EOF
|
||||
|
||||
cat <<EOF >> $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 <<EOF >> $TMPRSS
|
||||
<item>
|
||||
<title>$TITLE</title>
|
||||
|
@ -128,15 +159,33 @@ EOF
|
|||
<guid>${SITE}/episodes/${AUDIOFILE}</guid>
|
||||
<enclosure url="${SITE}/episodes/${AUDIOFILE}" length="${SIZE}" type="audio/${EXT}" />
|
||||
</item>
|
||||
EOF
|
||||
cat <<EOF >> $TMPGEMRSS
|
||||
<item>
|
||||
<title>$TITLE</title>
|
||||
<description></description>
|
||||
<pubDate>${PUBDATE}</pubDate>
|
||||
<guid>${CAPSULE}/episodes/${AUDIOFILE}</guid>
|
||||
<enclosure url="${CAPSULE}/episodes/${AUDIOFILE}" length="${SIZE}" type="audio/${EXT}" />
|
||||
</item>
|
||||
EOF
|
||||
cat <<EOF >> $TMPHTML
|
||||
<li>${PUBDATE} - <a href="episodes/${AUDIOFILE}">${TITLE}</a></li>
|
||||
EOF
|
||||
|
||||
cat <<EOF >> $TMPGMI
|
||||
=> episodes/${AUDIOFILE} ${PUBDATE} - ${TITLE}
|
||||
EOF
|
||||
done
|
||||
|
||||
cat <<EOF >> $TMPRSS
|
||||
</channel>
|
||||
</rss>
|
||||
EOF
|
||||
|
||||
cat <<EOF >> $TMPGEMRSS
|
||||
</channel>
|
||||
</rss>
|
||||
EOF
|
||||
|
||||
cat <<EOF >> $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"
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue