Motivational Speech Alarm Clock
This is the code I used to make an alarm clock out of a Raspberry Pi (model 1 B+, 512MB RAM) that plays motivational speeches at 6:30 in the morning to get my ass out of bed.
At first I was using a CLI YouTube client, but it would hang after a while due to not running on an interactive console
(being launched by
crond), and the audio support on Pi's have always been somewhat flaky.
I ended up using
youtube-dl to pre-download a playlist and using
omxplayer for its hardware-accelerated decoding
support. Works pretty well, except
omxplayer has no support for things like "playlists" or "shuffling" so I needed
some bash scripts to help me out.
Download a Playlist
$ youtube-dl --ignore-errors 'https://www.youtube.com/watch?v=v13H1vVzW0U&list=PL_jAJinh0XEdy53PBxGTTo-9nGxfkzSS9'
Then I moved all the
*.mkv files to a flash drive attached to the Pi.