def checkGmail(self): """ Description: Checks the unread count in gMail """ logger.info("Checking gMail") global UNREAD_COUNT global UNREAD_COUNT_NEW UNREAD_COUNT_NEW = utilities.getUnreadCount() if (UNREAD_COUNT < UNREAD_COUNT_NEW): logger.info("A new email has arrived...") logger.info("Speaking email notification") email_quips = [ "Yet another email", "Pardon the interruption sir. Another email has arrived for you to ignore." ] tempint = randint(1, len(email_quips)) masterSpeaker.speakString(email_quips[tempint - 1]) if (UNREAD_COUNT_NEW != 0): logger.info("Unread count: " + str(UNREAD_COUNT_NEW)) UNREAD_COUNT = UNREAD_COUNT_NEW
def checkGmail(self): """ Description: Checks the unread count in gMail """ global unread_Count global unread_Count_new unread_Count_new = utilities.getUnreadCount() if (unread_Count < unread_Count_new): logger.info("a new email has arrived") logger.info("Speaking email notification") emailQuips = [ "Yet another email", "Pardon the interruption sir. Another email has arrived for you to ignore." ] tempint = randint(1, len(emailQuips)) utilities.speakString(emailQuips[tempint - 1]) if (unread_Count_new != 0): logger.info("unread Count: " + str(unread_Count_new)) unread_Count = unread_Count_new
def checkGmail(self): """ Description: Checks the unread count in gMail """ logger.info("checking Gmail") global unread_Count global unread_Count_new try: unread_Count_new = utilities.getUnreadCount() logger.info("Gmail check successful") except Exception, e: logger.error("Gmail check failed") logger.error("Traceback "+str(e))
def checkGmail(self): """ Description: Checks the unread count in gMail """ logger.info("checking Gmail") global unread_Count unread_Count_new = utilities.getUnreadCount() if (unread_Count < unread_Count_new): logger.info("a new email has arrived") utilities.speakString("Pardon the interruption sir.") utilities.speakString("Another email has arrived for you to ignore.") if (unread_Count_new != 0): logger.info("unread Count: "+str(unread_Count_new)) unread_Count = unread_Count_new
#import my own utilities sys.path.append(os.path.join(os.path.join(os.getcwd(),os.path.dirname(__file__)),"../")) import utilities utilities.speakGreeting() if (strftime("%p",localtime()) == "AM"): utilities.speakString("your time to rest has come to an end") utilities.speakTime() utilities.speakDate() loc = utilities.getLocation() utilities.getWeather(loc[1],loc[2]) unread_count = utilities.getUnreadCount() if unread_count > 1: utilities.speakString("While you were sleeping "+str(unread_count)+" emails flooded your inbox") sys.exit(1) else: utilities.speakTime() random = [ "Unless we are burning the midnight oil, ", "If you are going to invent something new tomorrow, ", "If you intend on being charming tomorrow, "] tempint = randint(1,len(random)) greeting = random[tempint-1]