#!/usr/bin/env python ### Check Gmail for new mail and say it ### # Copyright 2009 Ertug Karamatli # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # TODO: get it working! import time import libgmail from async_subprocess import Popen,PIPE,send_all p = Popen(['festival','--tts'],stdin=PIPE) send_all(p, str('123')+'\n') print 'Logging in' ga = libgmail.GmailAccount("ertugkaramatli@gmail.com", "") ga.login() print 'Login OK' def get_mail(): folder = ga.getUnreadMessages() for thread in folder: #print thread.id, len(thread), thread.subject for msg in thread: print " ", msg.id, msg.number, msg.subject print msg.source """ while 1: count = ga.getUnreadMsgCount() #get_mail() time.sleep(2) """