potcasse: generate an index.html file listing episodes and linking the feed - p… | |
git clone git://bitreich.org/potcasse git://hg6vgqziawt5s4dj.onion/potcasse | |
Log | |
Files | |
Refs | |
Tags | |
README | |
LICENSE | |
--- | |
commit 1d1105f240f63af0cb57ce2649b7c71eefb70959 | |
parent 840b6c097f826bd21ce64c2b5a4188c3fdcff19a | |
Author: Solene Rapenne <[email protected]> | |
Date: Tue, 20 Jul 2021 23:19:11 +0200 | |
potcasse: generate an index.html file listing episodes and linking the feed | |
Diffstat: | |
M README.md | 4 +++- | |
M potcasse | 41 ++++++++++++++++++++++++++---… | |
2 files changed, 38 insertions(+), 7 deletions(-) | |
--- | |
diff --git a/README.md b/README.md | |
@@ -11,6 +11,8 @@ potcasse is meant to help people to publish and self host a p… | |
The idea is to regroup audio files with their metadata in a directory and gene… | |
+A simple `index.html` file is also generated in the process to give an easy li… | |
+ | |
## First time | |
``` | |
@@ -49,7 +51,7 @@ potcasse episode "Episode XX: trying something weird" /path/t… | |
potcasse gen | |
``` | |
-this will create or update the `output_html` directory with your audio files, … | |
+this will create or update the `output_html` directory with your audio files, … | |
# Real world example | |
diff --git a/potcasse b/potcasse | |
@@ -58,7 +58,8 @@ EOF | |
gen() { | |
test -d episodes || exitp "You need to import episodes before generation" | |
- TMPFILE=$(mktemp /tmp/potcasse.XXXXXXXXXXXXXXXXXXXXX) | |
+ TMPRSS=$(mktemp /tmp/potcasse.XXXXXXXXXXXXXXXXXXXXX) | |
+ TMPHTML=$(mktemp /tmp/potcasse.XXXXXXXXXXXXXXXXXXXXX) | |
. ./metadata.sh | |
mkdir -p output_html/episodes | |
@@ -68,7 +69,7 @@ gen() { | |
cp logo.png output_html/logo.png | |
fi | |
- cat <<EOF >> $TMPFILE | |
+ cat <<EOF >> $TMPRSS | |
<?xml version="1.0" encoding="UTF-8"?> | |
<rss version="2.0"> | |
<channel> | |
@@ -83,6 +84,23 @@ gen() { | |
<language>${LANG}</language> | |
EOF | |
+ cat <<EOF >> $TMPHTML | |
+<!DOCTYPE html> | |
+<html lang="${LANG}"> | |
+ <head> | |
+ <title>${TITLE}</title> | |
+ </head> | |
+ <body> | |
+ <h1>Podcast episodes- ${TITLE}</h1> | |
+ <div> | |
+ <img src="logo.png" width=200 height=200 alt="logo" /> | |
+ </div> | |
+ <ul> | |
+ <li><a href="${RSSLINK}">RSS feed</a> (for podcast players).</li> | |
+ </ul> | |
+ <ul> | |
+EOF | |
+ | |
for episode in episodes/* | |
do | |
echo "Scanning $episode" | |
@@ -90,7 +108,7 @@ EOF | |
SIZE=$(stat -f "%z" "${episode}/${AUDIOFILE}") | |
EXT=${AUDIOFILE##*.} | |
rsync -a "${episode}/${AUDIOFILE}" output_html/episodes/ | |
- cat <<EOF >> $TMPFILE | |
+ cat <<EOF >> $TMPRSS | |
<item> | |
<title>$TITLE</title> | |
<description></description> | |
@@ -98,14 +116,25 @@ EOF | |
<enclosure url="${SITE}/episodes/${AUDIOFILE}" length="${SIZE}" ty… | |
</item> | |
EOF | |
+ cat <<EOF >> $TMPHTML | |
+ <li>${PUBDATE} - <a href="episodes/${AUDIOFILE}">${TITLE}</a></li> | |
+EOF | |
done | |
- cat <<EOF >> $TMPFILE | |
+ cat <<EOF >> $TMPRSS | |
</channel> | |
</rss> | |
EOF | |
- install -m 644 "$TMPFILE" output_html/${RSSLINK} | |
- rm "$TMPFILE" | |
+ | |
+ cat <<EOF >> $TMPHTML | |
+ </ul> | |
+ </body> | |
+</html> | |
+EOF | |
+ | |
+ install -m 644 "$TMPRSS" output_html/${RSSLINK} | |
+ install -m 644 "$TMPHTML" output_html/index.html | |
+ rm "$TMPRSS" "$TMPHTML" | |
} | |