Twitter Alarm Clock http://foundation.cs.colorado.edu/rpi/s13/prog1.html By Andy Sayler (www.andysayler.com) Spring 2013 University of Colorado Computer Science Foundation Project foundation.cs.colorado.edu Raspberry Pi Project http://foundation.cs.colorado.edu/rpi/ ---MIT (Expat) License--- Copyright (c) 2013 Andy Sayler Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ---About--- This code implements a basic Twitter Alarm Clock. What's a Twitter Alarm Clock? It's a device that waits for the number of tweets that match a specific search criteria (hashtag, etc) to exceed a specified threshold (30 tweets, etc), at which point it triggers some action (play a sound, turn on a light, etc). ---Usage--- usage: twitterAlarm.py [-h] query count Sound alarm when N tweets are detected positional arguments: query Twitter search query count Tweet threshold to sound alarm (max 99) optional arguments: -h, --help show this help message and exit ---Requirements--- Python 3 (Tested with 3.2) aplay (http://linux.die.net/man/1/aplay) Default action is to play 'alarm.wav' file in the working directory. You must supply this file. pfd branch uses the PiFace Digital I/O Board which requires: https://github.com/piface/pifacedigitalio https://github.com/piface/pifacedigital-emulator ---Branches--- master - Basic TwitterAlarmClock code, runs on basic Linux systems pfd - master code augmented with PiFace Digital support, requires PFD board and Raspberry Pi ---Docs--- Twitter Search API v1: https://dev.twitter.com/docs/api/1/get/search Raspberry Pi: http://www.raspberrypi.org/ PiFace Digital: http://www.farnell.com/datasheets/1686131.pdf