Пример #1
0
  def test_put(self):
    testdata = libdiscid.tests.common.PutSuccess

    disc = libdiscid.put(testdata.first, testdata.last, testdata.sectors,
                         testdata.offsets)
    self.assertIsNotNone(disc)
    self.assertIsNone(disc.device)

    self.assertEqual(disc.id, testdata.disc_id)
    self.assertEqual(disc.freedb_id, testdata.freedb_id)
    self.assertIsNotNone(disc.submission_url)
    self.assertEqual(disc.first_track, testdata.first)
    self.assertEqual(disc.last_track, testdata.last)
    self.assertEqual(disc.sectors, testdata.sectors)
    self.assertEqual(disc.pregap, testdata.offsets[0])
    self.assertEqual(disc.leadout_track, testdata.sectors)
    self.assertEqual(disc.toc, testdata.toc)

    self.assertEqual(len(disc.track_offsets), len(testdata.offsets))
    for read_offset, expected_offset in zip(disc.track_offsets,
                                            testdata.offsets):
      self.assertEqual(read_offset, expected_offset)

    # ISRCs are not available if one calls put
    if libdiscid.FEATURES_MAPPING[libdiscid.FEATURE_ISRC] in libdiscid.FEATURES:
      self.assertEqual(len(disc.track_isrcs), 15)
      for read_isrc in disc.track_isrcs:
        self.assertEqual(read_isrc, '')

    # MCN is not available if one calls put
    if libdiscid.FEATURES_MAPPING[libdiscid.FEATURE_MCN] in libdiscid.FEATURES:
      self.assertEqual(disc.mcn, '')
Пример #2
0
    def test_put(self):
        testdata = libdiscid.tests.common.PutSuccess

        disc = libdiscid.put(testdata.first, testdata.last, testdata.sectors,
                             testdata.offsets)
        self.assertIsNotNone(disc)
        self.assertIsNone(disc.device)

        self.assertEqual(disc.id, testdata.disc_id)
        self.assertEqual(disc.freedb_id, testdata.freedb_id)
        self.assertIsNotNone(disc.submission_url)
        self.assertEqual(disc.first_track, testdata.first)
        self.assertEqual(disc.last_track, testdata.last)
        self.assertEqual(disc.sectors, testdata.sectors)
        self.assertEqual(disc.pregap, testdata.offsets[0])
        self.assertEqual(disc.leadout_track, testdata.sectors)
        self.assertEqual(disc.toc, testdata.toc)

        self.assertEqual(len(disc.track_offsets), len(testdata.offsets))
        for read_offset, expected_offset in zip(disc.track_offsets,
                                                testdata.offsets):
            self.assertEqual(read_offset, expected_offset)

        # ISRCs are not available if one calls put
        if libdiscid.FEATURES_MAPPING[
                libdiscid.FEATURE_ISRC] in libdiscid.FEATURES:
            self.assertEqual(len(disc.track_isrcs), 15)
            for read_isrc in disc.track_isrcs:
                self.assertEqual(read_isrc, '')

        # MCN is not available if one calls put
        if libdiscid.FEATURES_MAPPING[
                libdiscid.FEATURE_MCN] in libdiscid.FEATURES:
            self.assertEqual(disc.mcn, '')
Пример #3
0
  def put(self, first, last, disc_sectors, track_offsets):
    try:
      self.disc = libdiscid.put(first, last, disc_sectors, track_offsets)
    except DiscError as disc_error:
      raise TOCError(str(disc_error))

    self.tracks = [
      Track(self.disc, num) for num in range(self.disc.first_track,
                                             self.disc.last_track + 1)]
    return True
Пример #4
0
  def put(self, first, last, disc_sectors, track_offsets):
    try:
      self.disc = libdiscid.put(first, last, disc_sectors, track_offsets)
    except DiscError as disc_error:
      raise TOCError(str(disc_error))

    self.tracks = [
      Track(self.disc, num) for num in range(self.disc.first_track,
                                             self.disc.last_track + 1)]
    return True