mirror of git://bitreich.org/potcasse
potcasse: generate an index.html file listing episodes and linking the feed
This commit is contained in:
parent
840b6c097f
commit
1d1105f240
|
@ -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
|
||||
|
||||
|
|
41
potcasse
41
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,22 +108,33 @@ 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>
|
||||
<pubDate>${PUBDATE}</pubDate>
|
||||
<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"
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue