def run_test(options): # Read the TOC via cdrom device = cdrom.binary.Device(options.device) toc = cdrom.read_full_toc(device) # TODO: Also read CD-TEXT info via cdrom #try: # cd_text = cdrom.read_cd_text(device) #except cdrom.NoCdTextError: # cd_text_buf = None #except cdrom.CdTextNotSupportedError, ex: # warn(str(ex)) # cd_text_buf = None device.close() # Get track information via Icedax if options.icedaxDir: if not os.path.isdir(options.icedaxDir): os.makedirs(options.icedaxDir) cdrom.icedax.write_info_files(options.device, options.icedaxDir) icedax_tracks = cdrom.icedax.parse_info_dir(options.icedaxDir) else: icedax_tracks = cdrom.icedax.get_info(options.device) # Ensure that the CDDB calculation is the same check_equal(cddb.get_cddb_id(toc), icedax_tracks[0].getCddbId()) # Check each track check_equal(len(toc.tracks), len(icedax_tracks)) for n in range(len(toc.tracks)): toc_track = toc.tracks[n] icedax_track = icedax_tracks[n] test_track(toc_track, icedax_track)
def testIdKarmacode(self): full_toc = cdrom.FullTOC(test_data.FULL_TOC_KARMACODE) cddb_id = cddb.get_cddb_id(full_toc) self.assertEqual(cddb_id, 0xab0d510e)
def testIdDuskAndSummer(self): full_toc = cdrom.FullTOC(test_data.FULL_TOC_DUSK_AND_SUMMER) cddb_id = cddb.get_cddb_id(full_toc) self.assertEqual(cddb_id, 0xa809870a)
def testIdGlassworks(self): full_toc = cdrom.FullTOC(test_data.FULL_TOC_GLASSWORKS) cddb_id = cddb.get_cddb_id(full_toc) self.assertEqual(cddb_id, 0xa40ec50b)