Ejemplo n.º 1
0
def main():
    api = twitter.Api()
    previous_status = twitter.Status()
    raspberry_pi_farm.init()
    chicken = raspberry_pi_farm.Chicken()

    # what are we searching for?
    if len(sys.argv) > 1:
        search_term = sys.argv[1]
    else:
        search_term = DEFAULT_SEARCH_TERM

    print "Listening to tweets containing the word '%s'." % search_term

    while True:
        # grab the first tweet containing the search_term
        current_status = api.GetSearch(term=search_term, per_page=1)[0]

        # if the status is different then give it to the chicken
        if current_status.id != previous_status.id:
            chicken.start_wobble()
            chicken.say(current_status.text)
            chicken.stop_wobble()

            previous_status = current_status

        # wait for a short while before checking again
        time.sleep(TIME_DELAY)
Ejemplo n.º 2
0
def main():
	api = twitter.Api()
	previous_status = twitter.Status()
	raspberry_pi_farm.init()
	chicken = raspberry_pi_farm.Chicken()

	# who are we listening to?
	if len(sys.argv) > 1:
		user = sys.argv[1]
	else:
		user = DEFAULT_USER

	print "Listening to tweets from '%s'." % user

	while True:
		# grab the users current status
		current_status = api.GetUser(user).status

		# if the status is different then give it to the chicken
		if current_status.id != previous_status.id:
			chicken.start_wobble()
			chicken.say(current_status.text)
			chicken.stop_wobble()

			previous_status = current_status

		# wait for a short while before checking again
		time.sleep(TIME_DELAY)
Ejemplo n.º 3
0
def main():
	api = twitter.Api()
	previous_status = twitter.Status()
	raspberry_pi_farm.init()
	chicken = raspberry_pi_farm.Chicken()

	# what are we searching for?
	if len(sys.argv) > 1:
		search_term = sys.argv[1]
	else:
		search_term = DEFAULT_SEARCH_TERM

	print "Listening to tweets containing the word '%s'." % search_term

	while True:
		# grab the first tweet containing the search_term
		current_status = api.GetSearch(term=search_term, per_page=1)[0]

		# if the status is different then give it to the chicken
		if current_status.id != previous_status.id:
			chicken.start_wobble()
			chicken.say(current_status.text)
			chicken.stop_wobble()

			previous_status = current_status

		# wait for a short while before checking again
		time.sleep(TIME_DELAY)
Ejemplo n.º 4
0
def main():
    api = twitter.Api()
    previous_status = twitter.Status()
    raspberry_pi_farm.init()
    chicken = raspberry_pi_farm.Chicken()

    # who are we listening to?
    if len(sys.argv) > 1:
        user = sys.argv[1]
    else:
        user = DEFAULT_USER

    print "Listening to tweets from '%s'." % user

    while True:
        # grab the users current status
        current_status = api.GetUser(user).status

        # if the status is different then give it to the chicken
        if current_status.id != previous_status.id:
            chicken.start_wobble()
            chicken.say(current_status.text)
            chicken.stop_wobble()

            previous_status = current_status

        # wait for a short while before checking again
        time.sleep(TIME_DELAY)