perfect alarm clock

This is the place to post any code that you want to share with the community. Only completed scripts should be posted here.
Note: posts here are not necessarily endorsed by the community, and may represent amateur or even bad practices.

perfect alarm clock

Postby igotapochahontas » Thu Apr 24, 2014 2:11 pm

This alarm uses task bomb and sl4a script launcher to wake you up by reading you a joke.
(Written with python for android and sl4a) with a lot of help from the users on this forum.
Code: Select all
import re
import urllib2
import android
droid = android.Android()
def remove_html_tags(text):
    pattern = re.compile(r'</b></a>')
    return pattern.sub('', text)

page = urllib2.urlopen("").read()
umatch ="<span>@</span>(\w+)", page)
user =
utext ="</b></a> (\w.*)", page)
text =
joke = remove_html_tags(text)
print joke
ignore = "... Stop ignoring your alarm, its time to wake up."
droid.ttsSpeak (joke+ignore)
Posts: 20
Joined: Thu Apr 10, 2014 5:51 pm

Re: perfect alarm clock

Postby micseydel » Tue May 06, 2014 12:39 am

I wanted to try this out, but I just took my second shot at trying to get SL4A working without success. What'd you use to get started? I just tried scanning the barcode here, but after it scans, I hear a beep, and then I end up back at a mostly black screen that says "Scripts" at the top and "No matches found" later on. So frustrating D=
Due to the reasons discussed here we will be moving to on October 1, 2016.

This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
User avatar
Posts: 3000
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Re: perfect alarm clock

Postby igotapochahontas » Sun Jul 06, 2014 4:18 pm

you have to add the python for android interpreter after downloading sl4a. sl4a does nothing without an python for android. dont bother though. funtweets changed something on their site so this code doesnt work anymore. i cant figure out what changed because i dont know html well enough to fix the problem.
Posts: 20
Joined: Thu Apr 10, 2014 5:51 pm

Return to Completed Scripts

Who is online

Users browsing this forum: No registered users and 2 guests