Code Challenge 17 – Never Miss a Good Podcast

By on 1 May 2017

There is nothing like a challenge to bring out the best in man. – Sean Connery

Hi Pythonistas, a new week, a new ‘bite’ of Python coding! This week we’ll let you import a Podcast feed, store it in SQLite, and email unplayed episodes at a regular interval. Inspiration here. Enjoy!

The Challenge

Of course Talk Python is a good use case or another Python Podcast, but take any podcast you want.

We want to keep the challenges as open as possible: last two times that worked pretty well, and our poll on Twitter showed the same:

our challenge poll

However even free form needs some structure to talk the same language. That’s why we’d like you to try the following:

  • Pick your favorite podcast and find its feed.

  • You can probably use feedparser to easily parse the feed. Don’t re-invent the wheel here, use PyPI.

  • Load the data into SQLite or some other persistence form. We recommend the sqlite3 module though: it is stdlib and easy to use. For starters we recommend this article.

  • Mark the episodes as unplayed.

  • Figure out how to email from your env. We wrote about this here and here.

  • Figure out how to use cronjob in your env or do it with Python (see sched or schedule).

  • Set up one or two jobs to: A) send a daily (or weekly) email with podcast link(s) for you to consume, and B) update the DB with new episodes.

  • Mark the episode(s) as played (done) in the DB.

Bonus:

  • As this is code challenge towards a podcast challenge (“listen all episodes of podcast x”), show some stats in each email, for example: “x % done (y out of z)”.

Getting ready

See our INSTALL doc how to fork our challenges repo to get cracking.

This doc also provides you with instructions how you can submit your code to our community branch via a Pull Request (PR). Cool PRs will be featured in our end-of-the-week challenge review.

Archive

You can find all our code challenges so far here. If you have ideas for a future challenge or find any issues, please contact us or open a GH Issue.

Last but not least: there is no best solution, only learning more and better Python. Good luck!


Keep Calm and Code in Python!

— Bob and Julian

Want a career as a Python Developer but not sure where to start?