blog.humaneguitarist.org

South Park Launcher: Python and VB editions

[Fri, 27 Nov 2009 14:12:34 +0000]
It seems that about a year ago, the creators of South Park started freely offering their episodes online at southparkstudios.com [http://www.southparkstudios.com/]. The move was made, in part, to offer a legal way for fans without television access or even televisions (that's me!) to watch the show. As the creators stated, "(we got) really sick of having to download our own show illegally all the time. So we gave ourselves a legal alternative." [http://www.wired.com/underwire/2008/03/south-park-to-o/] This was great for me because I admittedly was downloading those shows as well. One of the other great things about it is the Random Episode [http://www.southparkstudios.com/episodes/random.php] link which, you guessed it, launches a random episode of the show. The only thing that makes it less than perfect is that I can't set it to repeatedly play more random episodes. Until now. I decided to sit down and write the most important code I may ever write: a program that leverages the Random Episode feature to launch successive random episodes of the great social commentary, courtesy of Matt and Trey. Here's the core of the code, from a Python perspective: import sys, webbrowser, time url = 'http://www.southparkstudios.com/episodes/random.php' i=1 while i <= 5: webbrowser.open(url) time.sleep(1440) # 1440 seconds = 24 minutes, the average length of an episode plus ads. i=i+1 sys.exit() Basically this is a loop that keeps launching a episode every 24 minutes while the variable "i" is less than or equal to 5. After every episode, "i" grows by one so when "i" equals 6, the program shuts down. BTW: after the program starts, the user does have to manually initiate playback of the first episode, but the last 4 episodes play automatically. Now, this works fine and I even embellished the code so that the user can select from 2 to 10 episodes to launch. But I was still thinking, "This would be great to share with my friends, but they aren't going to run software from the command line!" So I wrote a version using Microsoft's Visual Studio Express [http://www.microsoft.com/express/download/], a free version of their software that allows one to create GUI applications with a mixture of visual tools and the Visual Basic language. It's a really great tool that I hope to use more in the future although I do worry about the extra time required just to make software have a graphical interface. [DEL: Anyway, here's a ZIP file [http://blog.humaneguitarist.org/uploads/SouthParkLauncher.zip] that contains both the installer for the Windows version of South Park Launcher as well as the Python version for Windows and other platforms. Make sure to read the ReadMe.txt file first! :DEL] You assume all responsibility for use. Update, March 14, 2010: Looks like the South Park site now requires one to click the "play" button to start each and every episode, so South Park Launcher isn't very useful anymore. Oh well. It was fun while it lasted. Update, September, 2011: I've removed the link to the ZIP file as it wasn't a good program nor should I have been distributing code so early in my coding experience.