Skip to content

Instantly share code, notes, and snippets.

@esehara
Created November 1, 2011 13:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esehara/1330542 to your computer and use it in GitHub Desktop.
Save esehara/1330542 to your computer and use it in GitHub Desktop.
Gmail -> Eject CD
import imaplib
import pygame
def cd_eject():
pygame.cdrom.init()
cd = pygame.cdrom.CD(0)
cd.init()
cd.eject()
def mail_check(user,passw):
mail = imaplib.IMAP4_SSL("imap.gmail.com")
mail.login(user,passw)
mail.select("Inbox")
status,maillist = mail.search(None,"(UNSEEN)")
if status == "OK":
if maillist[0] is not '': cd_eject()
mail.logout()
if __name__ == "__main__":
mail_check("FIXME : hoge@gmail.com","FIXME : PASS")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment