08 Apr

Python Script for an alarm

Today I wanted to get up at 6am to reach college, at time! Submissions, you see! πŸ˜‰

So wanted to keep alarm for that. But my phone’s alarm was not working. I would have told my parents to wake me up, but, they are out of town. Could have told myΒ neighbour, but then waking them up at 2am just to ask them to wake you up at 6am doesn’t seem good, does it? (Agar bell maarta itni raat ko toh mujhe vaise hi maar dete vo πŸ˜› ) So tried to keep an alarm in my laptop using sudo apt-get install toshutils. But that feature was not available for my laptop. *sigh*

Asked 2 friends to wake me up. But then, couldn’t rely on them. πŸ˜› (Even they are humans! And friends ko bhool jaaneki bimaari hoti hai πŸ˜› )

Asked Jay what to do. He said “Python script likh daal for alarm for the laptop” πŸ˜€

So I wrote this python script for alarm. You just need to give time, in 24 hour format, for when you want your alarm to ring, for eg: if you want alarm to ring at 6am, you type 0600
After doing that, go to sleep, peacefully! πŸ™‚
At 6am, banshee player will be played.

The python script that I wrote is

import os
import time
timer=raw_input("Alarm should ring at: ")
def run():
    if currenttime_hour==hour and currenttime_minute==minute:
        os.system('banshee --play &')
        os.system('banshee --play')
def main():
if __name__== '__main__':

It took me a lot of time for testing this code because Banshee player does not play in a go. You have to give ‘banshee –play’ again for it to play. Realizing this part took almost an hour. 😦
Nevertheless, we got to know something about banshee player! πŸ˜€
Will put up the code at Github as I get time.
So, adios people, going to sleep now, have to get up at 6, remember? πŸ˜‰


Posted by on April 8, 2012 in Python


Tags: ,

2 responses to “WakeUp!

  1. jayrambhia

    April 9, 2012 at 4:41 am

    So, did you wake up or not ?


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: