Created
December 27, 2012 01:55
-
-
Save crlane/4384779 to your computer and use it in GitHub Desktop.
Speaks the lyrics to 'Fitter Happier' from OK Computer. Requires python and Mac OS.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
''' | |
File: fitter_happier.py | |
Author: Cameron Lane | |
Description: Demonstration of the mac os x `say` command from within python. | |
''' | |
import sys,os,urllib2 | |
def main(): | |
""" | |
accesses a text file containing the lyrics to 'Fitter Happier' from OK Computer by Radiohead | |
and speaks the text of the file using Mac OS X's say command. | |
""" | |
URL = 'http://cameronlane.org/misc/fitter_happier.txt' | |
try: | |
f = urllib2.urlopen(URL) | |
os.system('sty -v fred %s' % f.read()) | |
except: | |
print "File not found. It's possible it has been moved" | |
print "done!" | |
sys.exit(0) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@paulstuart Thanks! Yeah, I'm not surprised it's broken or that there's an easier way. This is pretty old, but hope it was useful in some small way. Thanks again.