Exemplo n.º 1
0
def run ():
    cdrom.init ()
    print ("Number of CDROM drives found: %d" % cdrom.num_drives ())
    for index in range (cdrom.num_drives ()):
        # Loop over all drives to get one with a CD inside
        cd = cdrom.CD (index)
        print ("CD system name: %s" % cd.name)
        status = "Empty"
        if cd.status == sdlconst.CD_ERROR:
            status = "Error"
        elif cd.status == sdlconst.CD_PAUSED:
            status = "Paused"
        elif cd.status == sdlconst.CD_PLAYING:
            status = "Playing"
        elif cd.status == sdlconst.CD_STOPPED:
            status = "Stopped"
        print ("CD status:      %s" % status)
        print ("CD tracks:      %d" % cd.num_tracks)
        if cd.status in (sdlconst.CD_TRAYEMPTY, sdlconst.CD_ERROR):
            continue
        print ("Getting track information for CD %s..." % cd.name)
        for track in cd.tracks:
            print ("----------------------------------")
            print ("CD track id:      %d" % track.id)
            print ("CD track length:  %d" % track.length)
            print ("CD track minutes: %d" % track.minutes)
            print ("CD track seconds: %d" % track.seconds)
            print ("CD track time:    %d:%d" % track.time)
            ttype = "Audio"
            if track.type == sdlconst.DATA_TRACK:
                ttype = "Data"
            print ("CD track type:    %s" % ttype)
    cdrom.quit ()
Exemplo n.º 2
0
    def test_pygame2_sdl_cdrom_get_name(self):
        #
        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.get_name:

        # get_name (index) -> str
        # 
        # Gets the name of the specified CD- or DVD-ROM drive.
        # 
        # Gets the system-dependent drive name (e.g. "/dev/cdrom" or "D:")
        # for the CD- or DVD-Rom specified by the passed *index*.
        cdrom.init ()
        self.assertRaises (ValueError, cdrom.get_name, -4)
        self.assertRaises (ValueError, cdrom.get_name, cdrom.num_drives ())
        
        for i in range (cdrom.num_drives ()):
            doprint ("Drive %d: %s" % (i, cdrom.get_name (i)))
        cdrom.quit ()
Exemplo n.º 3
0
    def test_pygame2_sdl_cdrom_num_drives(self):
        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.num_drives:

        # num_drives () -> int
        # 
        # Gets the number of accessible CD- and DVD-ROM drives for the system.
        cdrom.init ()
        doprint ("Found CD/DVD drives: %d" % cdrom.num_drives ())
        cdrom.quit ()