def main(): face.init() count = face.get_count() if count == 0: raw_input('There is no cdrom drive.') elif count == 1: cmd(face.CD(0)) else: num = which_CD(count) if num != -1: cmd(face.CD(num)) face.quit()
import sys, os, pygame, time import pygame.cdrom as cdrom while 1: cdrom.init() cd = cdrom.CD(0) cd.init() cd.eject() cd.quit() cdrom.quit() time.sleep(5)
import time from pygame import cdrom cdrom.init() cd = cdrom.CD(1) cd.init() i = 0 while 1: i += 1 print "[%d]Checking..." % i if not cd.get_empty(): print "[%d]CDROM ejecting..." % i cd.eject() print "[%d]Sleeping..." % i time.sleep(10)