The Little Box of Witter

I’ve made a Little Box of Poems with an Arduino, Raspberry Pi and even BBC micro:bit, now I want to make a Little Box of Witter: a gadget that will play the latest episode of my favourite radio programme, Wittertainment (aka BBC Radio 5Live’s Kermode and Mayo Film Review).

I’m still trying to decide if it should have physical buttons, either wired using GPIO pins or even a MakeyMakey. Should it have a display, and if so what kind? A Pimoroni HyperPixel or InkyPhat? Or an LCD shield with physical buttons like the Displayotron3000?

Anyway, while I ponder these things, here is a VERY simple shell script which, I think, downloads the latest episode of the podcast to your Raspberry Pi and plays it. You can control the player using the keyboard when the terminal has focus. It’s a cut-down version of Raphael’s elegantly simple podcast downloader. It requires nothing else to be installed and should work on any Raspberry Pi. You could, I suppose, modify this to download and play other podcasts, but you’d need to find the URL for its RSS feed.

Save this on your Pi as wittertainment.sh and make it executable with
chmod +x wittertainment.sh
Then run it by typing
./wittertainment.sh
from the same folder in the terminal.

Tinkety-tonk, old fruits and Hello to Jason Isaacs!

#!/bin/bash
# a shell script to download and play the latest
# episode of Wittertainment, the 5Live film programme.
# @blogmywiki based this on http://blog.rphl.io/raspberry-pi-podcast-downloader/
# Make this file executable with chmod +x wittertainment.sh
# Run with ./wittertainment.sh
# While it is playing and terminal has focus you can use the following keys:
# p / space - pause
# up / down arrows - skip forward/back 10 minutes
# left / right arrows - skip forward/back 30 seconds
# q - quit player, +/- increase/decrease volume

# path to folder where the podcast will be downloaded
SAVE_DIR=/home/pi/Downloads/

# address of Wittertainment podcast RSS feed - you could, I suppose, change this.
url="https://podcasts.files.bbci.co.uk/b00lvdrj.rss"

# Check if new podcast is availiable and download them to local pi storage
str=$(wget -P $SAVE_DIR -q -O- $url | grep -o ']*url="[^"]*' | grep -o '[^"]*$' | head -n 1)
str=${str##*/}

# Replace url encoding spaces with real ones
str=${str//%20/ }
if [[ "$listStr" != *"$str"* ]]
then
	# File isnt in dropbox yet, so download
	wget -P $SAVE_DIR -q -O- $url | grep -o ']*url="[^"]*' | grep -o '[^"]*$' | head -n 1 | xargs wget -c -P $SAVE_DIR > /dev/null
fi

echo "Hello to Jason Isaacs."
omxplayer $str
This entry was posted in BBC, cinema, computers, radio, Raspberry Pi and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>