potcasse: generate an index.html file listing episodes and linking the feed - potcasse - Podcast publication made easy HTML git clone git://bitreich.org/potcasse git://hg6vgqziawt5s4dj.onion/potcasse DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 1d1105f240f63af0cb57ce2649b7c71eefb70959 DIR parent 840b6c097f826bd21ce64c2b5a4188c3fdcff19a HTML Author: Solene Rapenne <solene@perso.pw> 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(-) --- DIR diff --git a/README.md b/README.md @@ -11,6 +11,8 @@ potcasse is meant to help people to publish and self host a podcast easily witho 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. +A simple `index.html` file is also generated in the process to give an easy list without using the RSS file. + ## First time ``` @@ -49,7 +51,7 @@ 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 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. # Real world example DIR 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}" type="audio/${EXT}" /> </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" }