Display New Episodes of Your Favorite Shows on Your Desktop (It's a GeekTool Geeklet)

With the fall TV season about to start I wanted a better way to keep track of when new episodes of my favorite shows are airing. Using GeekTool, this little script displays the series and title of new episodes airing today on my desktop.

If you're new to GeekTool, I suggest reading this tutorial.  It will make everything here much clearer.

This script uses thetvdb.com's new shows rss feed and compares it to the api feed of shows you've selected as favorites on the site.  You can find your account id at the bottom of your account settings on thetvdb.com.  Of course you'll need to register if you don't already have an account, but it's a free site.

It uses the feedparser python lib to handle the rss. You can download that here. (very easy to install)

thetvdb.com new shows list is only updated once a day, so please make sure to set your refresh rate to once a day so it doesn't cause too much traffic for the site. They are an underfunded project so it's important to avoid unnecessary hits.


Once you have feedparser installed, just drag a shell module from GeekTool to the desktop and paste this script into the command field.

#!/usr/bin/env python
import feedparser, urllib2
from xml.etree import ElementTree as ET
# =========== CONFIG =============
# Insert your account id here. You can find it at 
# the bottom of your account settings page on thetvdb.com
ACCOUNTID = 'C2920FF6804FD948'
# ================================

new_shows = feedparser.parse('http://thetvdb.com/rss/newtoday.php')
favorites_feed = urllib2.urlopen('http://thetvdb.com/api/User_Favorites.php?accountid='+ACCOUNTID)
favorites = ET.XML(favorites_feed.read())
shows_list = []

for new_show in new_shows.entries:
 new_show_series = new_show.links[0].href
 new_show_series_id = new_show_series[new_show_series.find("seriesid=")+9:new_show_series.find("&seasonid")]
 for favorite in favorites:
  if(favorite.text == new_show_series_id):

print "New episodes of favorite shows airing today:"   
if (len(shows_list)>0):
 for shows in shows_list:
  print "* "+shows
 print "* No new shows today"

Leave a comment or post a screenshot of it on your desktop.


No comments:

Post a Comment