From a5d70dd3173ce73bf0be5d49f5d225ccc7380cd1 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Mon, 4 May 2009 23:10:39 +0000 Subject: [PATCH] * examples/readdisc.py: * morituri/image/table.py: * morituri/test/test_image_table.py: Fix up and deprecate stuff. --- ChangeLog | 7 +++++++ examples/readdisc.py | 5 ++--- morituri/image/table.py | 4 ++-- morituri/test/test_image_table.py | 28 +++++++++++++--------------- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index d5cde41..2b20081 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-05-05 Thomas Vander Stichele + + * examples/readdisc.py: + * morituri/image/table.py: + * morituri/test/test_image_table.py: + Fix up and deprecate stuff. + 2009-05-04 Thomas Vander Stichele * examples/movecue.py: diff --git a/examples/readdisc.py b/examples/readdisc.py index e14781b..8a7c679 100644 --- a/examples/readdisc.py +++ b/examples/readdisc.py @@ -123,15 +123,14 @@ def main(argv): function(runner, t) ptable.persist(t.toc) itable = ptable.object - import code; code.interact(local=locals()) lastTrackStart = 0 for i, track in enumerate(itable.tracks): - print 'Ripping track %d' % (i + 1) path = 'track%02d.wav' % (i + 1) # FIXME: optionally allow overriding reripping if not os.path.exists(path): + print 'Ripping track %d' % (i + 1) t = cdparanoia.ReadVerifyTrackTask(path, ittoc, ittoc.getTrackStart(i + 1), ittoc.getTrackEnd(i + 1), offset=int(options.offset)) @@ -150,7 +149,7 @@ def main(argv): # first copy over index 0 if there is any try: sector, _ = tocTrack.getIndex(0) - t.index(0, path=path, relative=sector - lastTrackStart) + ittrack.index(0, path=path, relative=sector - lastTrackStart) except KeyError: pass lastTrackStart, _ = tocTrack.getIndex(1) diff --git a/morituri/image/table.py b/morituri/image/table.py index d9b045b..7775d0e 100644 --- a/morituri/image/table.py +++ b/morituri/image/table.py @@ -31,7 +31,7 @@ import gst from morituri.common import task, checksum, common -class Track: +class DeleteMeTrack: """ I represent a track entry in a Table of Contents. @@ -59,7 +59,7 @@ class Track: self.end = end self.audio = audio -class Table: +class DeleteMeTable: """ I represent the Table of Contents of a CD. diff --git a/morituri/test/test_image_table.py b/morituri/test/test_image_table.py index 3b7cf72..13db8ba 100644 --- a/morituri/test/test_image_table.py +++ b/morituri/test/test_image_table.py @@ -18,21 +18,19 @@ class LadyhawkeTestCase(unittest.TestCase): # AccurateRip URL has been verified against EAC's, using wireshark def setUp(self): - self.table = table.Table([ - table.Track( 1, 0, 15536), - table.Track( 2, 15537, 31690), - table.Track( 3, 31691, 50865), - table.Track( 4, 50866, 66465), - table.Track( 5, 66466, 81201), - table.Track( 6, 81202, 99408), - table.Track( 7, 99409, 115919), - table.Track( 8, 115920, 133092), - table.Track( 9, 133093, 149846), - table.Track(10, 149847, 161559), - table.Track(11, 161560, 177681), - table.Track(12, 177682, 195705), - table.Track(13, 207106, 210384, audio=False), - ]) + self.table = table.IndexTable() + + for i in range(12): + self.table.tracks.append(table.ITTrack(i + 1, audio=True)) + self.table.tracks.append(table.ITTrack(13, audio=False)) + + offsets = [0, 15537, 31691, 50866, 66466, 81202, 99409, + 115920, 133093, 149847, 161560, 177682, 207106] + t = self.table.tracks + for i, offset in enumerate(offsets): + t[i].index(1, absolute=offset) + + self.table.leadout = 210385 def testCDDB(self): self.assertEquals(self.table.getCDDBDiscId(), "c60af50d")