Hipsters rejoice, you can actually make those high-tech IPS panels look like crap. Really nostalgic crap. [Kaveen Rodrigo] wrote in to show how he displays weather data as his Apple ][ emulated screensaver.
He’s building on the Apple2 package that is part of the xscreensaver available on Linux systems. The program has an option flag that allows you to run another program inside of it. This can be just about anything including using it as your terminal emulator. [Adrian] recently sent us the screenshot shown here for our retro edition. He is running bash and loaded up freenet just to enjoy what it used to be like in the good old days.
In this case, [Kaveen] is using Python to pull in, parse, and print out a Yahoo weather json packet. Since it’s just a program that is called when the screensaver is launched, you can use it as such or just launch it manually and fill your second monitor whenever not in use.
We gave it a whirl, altering his code to take a tuple of zip codes. Every hour it will pull down the data and redraw the screen. But we’ve put enough in there that you’ll be able to replace it with your own data in a matter of minutes. If you do, post a screenshot and what you’re using it for in the comments.
Here’s our example code:
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # # a2.py # Based on the work of Kaveen Rodrigo which can be found here: # http://geeknirvana.org/?p=4 # The original carried the following license: # # Copyright 2014 Kaveen Rodrigo <kaveenr@KNET> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. # # import urllib2,json,time,os locationCodes = (53716,91105,17201) def getIt(postalCode): try: html = urllib2.urlopen("http://query.yahooapis.com/v1/public/yql?q=select%20item%20from%20weather.forecast%20where%20location%3D%22"+str(postalCode)+"%22&format=json").read() return json.loads(html) except: print("Are you on the innernet?") exit() def main(): while True: for code in locationCodes: js = getIt(code) print(js["query"]["results"]["channel"]["item"]["title"]) print(js["query"]["results"]["channel"]["item"]["condition"]["text"]+" Temp "+js["query"]["results"]["channel"]["item"]["condition"]["temp"]+" F") print print time.sleep(3600) os.system('clear') print " apple ][" print return 0 if __name__ == '__main__': main()