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.
|
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
|
## First time
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -49,7 +51,7 @@ potcasse episode "Episode XX: trying something weird" /path/to/audio/file this_i
|
||||||
potcasse gen
|
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
|
# Real world example
|
||||||
|
|
||||||
|
|
41
potcasse
41
potcasse
|
@ -58,7 +58,8 @@ EOF
|
||||||
|
|
||||||
gen() {
|
gen() {
|
||||||
test -d episodes || exitp "You need to import episodes before generation"
|
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
|
. ./metadata.sh
|
||||||
mkdir -p output_html/episodes
|
mkdir -p output_html/episodes
|
||||||
|
|
||||||
|
@ -68,7 +69,7 @@ gen() {
|
||||||
cp logo.png output_html/logo.png
|
cp logo.png output_html/logo.png
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat <<EOF >> $TMPFILE
|
cat <<EOF >> $TMPRSS
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<rss version="2.0">
|
<rss version="2.0">
|
||||||
<channel>
|
<channel>
|
||||||
|
@ -83,6 +84,23 @@ gen() {
|
||||||
<language>${LANG}</language>
|
<language>${LANG}</language>
|
||||||
EOF
|
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/*
|
for episode in episodes/*
|
||||||
do
|
do
|
||||||
echo "Scanning $episode"
|
echo "Scanning $episode"
|
||||||
|
@ -90,22 +108,33 @@ EOF
|
||||||
SIZE=$(stat -f "%z" "${episode}/${AUDIOFILE}")
|
SIZE=$(stat -f "%z" "${episode}/${AUDIOFILE}")
|
||||||
EXT=${AUDIOFILE##*.}
|
EXT=${AUDIOFILE##*.}
|
||||||
rsync -a "${episode}/${AUDIOFILE}" output_html/episodes/
|
rsync -a "${episode}/${AUDIOFILE}" output_html/episodes/
|
||||||
cat <<EOF >> $TMPFILE
|
cat <<EOF >> $TMPRSS
|
||||||
<item>
|
<item>
|
||||||
<title>$TITLE</title>
|
<title>$TITLE</title>
|
||||||
<description></description>
|
<description></description>
|
||||||
<pubDate>${PUBDATE}</pubDate>
|
<pubDate>${PUBDATE}</pubDate>
|
||||||
<enclosure url="${SITE}/episodes/${AUDIOFILE}" length="${SIZE}" type="audio/${EXT}" />
|
<enclosure url="${SITE}/episodes/${AUDIOFILE}" length="${SIZE}" type="audio/${EXT}" />
|
||||||
</item>
|
</item>
|
||||||
|
EOF
|
||||||
|
cat <<EOF >> $TMPHTML
|
||||||
|
<li>${PUBDATE} - <a href="episodes/${AUDIOFILE}">${TITLE}</a></li>
|
||||||
EOF
|
EOF
|
||||||
done
|
done
|
||||||
|
|
||||||
cat <<EOF >> $TMPFILE
|
cat <<EOF >> $TMPRSS
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
EOF
|
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