Project

General

Profile

creating a podcast/RSS feed of recordings

Added by Paul M about 6 years ago

The purpose of this is to make all recordings available to a podcast player such as you'd find on a phone or tablet. Such players usually allow people to automatically or manually download media files references by the podcast/rss feed, and thereby make it easy to take recordings with you for playback offline.

  • Install apache2 and set the document root to be /home/hts (you would set this to wherever TVH is storing its recordings).
  • Create this script called /usr/local/bin/make_tvheadend_rss.sh
    #!/bin/bash
    # make an RSS feed of all .ts files
    
    ARG1=$1
    
    # have a guess at the URL
    RSSHOST="http://"`hostname`"/" 
    
    if [ "$ARG1" != "" ] ; then
            RSSHOST="$ARG1" 
    fi
    
    echo "Set RSSHOST to $RSSHOST" 
    
    # set this to the location where iplayer downloads everything
    IDIR=/home/hts
    RSSFILE=tvheadend_feed.rss.xml
    
    # set this to where you downloaded the genRSS.py
    # see https://github.com/speculatrix/genRSS
    GENRSS=/usr/local/bin/genRSS.py
    
    # generate the RSS feed file
    cd $IDIR
    find . -type d -not -path /home/hts/.hts -not -path /home/hts/.xmltv -printf '-d "%p" ' 2> /dev/null |  \
             xargs $GENRSS -H "$RSSHOST" -e ts -t "TVH Feed" -p "TVH Feed" -o "$IDIR/$RSSFILE" 
    

and then I run it with

sudo -u hts -H /usr/local/bin/make_tvheadend_rss.sh

if it works, add a crontab entry so it looks like this:

$ sudo crontab -u hts -l
...snip...
3,30 *  * * *           /usr/local/bin/make_tvheadend_rss.sh

  • Add a URL that looks like this http://myserver/tvheadend_feed.rss.xml to your podcast catcher. I recommend setting the feed to only manually download media files, rather than getting them all, because the .TS files are huge!