diff --git a/ChangeLog b/ChangeLog index b4a3c8a..77bebe0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-09-07 Thomas Vander Stichele + + * morituri/common/program.py: + Fix getting AccurateRip results for albums with a HTOA. + * morituri/test/Makefile.am: + * morituri/test/test_common_program.py: + * morituri/test/silentalarm.result.pickle (added): + Add testcase for it, Bloc Party's Silent Alarm. + 2009-09-07 Thomas Vander Stichele * morituri.spec.in: diff --git a/morituri/common/program.py b/morituri/common/program.py index bcfc679..28391a2 100644 --- a/morituri/common/program.py +++ b/morituri/common/program.py @@ -466,7 +466,6 @@ class Program(log.Loggable): # loop over tracks for i, trackResult in enumerate(self.result.tracks): - status = 'rip NOT accurate' if trackResult.accurip: @@ -484,8 +483,14 @@ class Program(log.Loggable): trackResult.ARDBMaxConfidence) ar = ", DB [%08x]" % trackResult.ARDBCRC - res.append("Track %2d: %s %s [%08x]%s" % ( - i + 1, status, c, trackResult.ARCRC, ar)) + # htoa tracks (i == 0) do not have an ARCRC + if trackResult.ARCRC is None: + assert trackResult.number is 0, \ + 'no trackResult.ARCRC on non-HTOA track' + res.append("Track 0: unknown (not tracked)") + else: + res.append("Track %2d: %s %s [%08x]%s" % ( + trackResult.number, status, c, trackResult.ARCRC, ar)) return res diff --git a/morituri/test/Makefile.am b/morituri/test/Makefile.am index 470217c..5cec124 100644 --- a/morituri/test/Makefile.am +++ b/morituri/test/Makefile.am @@ -31,6 +31,7 @@ EXTRA_DIST = \ track-single.cue \ cdparanoia.progress \ cdrdao.readtoc.progress \ + silentalarm.result.pickle \ track.flac # re-generation of test files when needed diff --git a/morituri/test/silentalarm.result.pickle b/morituri/test/silentalarm.result.pickle new file mode 100644 index 0000000..5a0e6b1 --- /dev/null +++ b/morituri/test/silentalarm.result.pickle @@ -0,0 +1,408 @@ +(lp0 +(imorituri.result.result +TrackResult +p1 +(dp2 +S'testcrc' +p3 +L133637600L +sS'peak' +p4 +F0.651947021484375 +sS'copycrc' +p5 +L133637600L +sS'quality' +p6 +F1.0 +sS'number' +p7 +I0 +sS'filename' +p8 +V/home/thomas/Bloc Party - Silent Alarm/00. Bloc Party - Hidden Track One Audio.flac +p9 +sba(imorituri.result.result +TrackResult +p10 +(dp11 +S'ARCRC' +p12 +L1726732487L +sg3 +L1476997036L +sS'ARDBConfidence' +p13 +I66 +sg7 +I1 +sS'ARDBMaxConfidence' +p14 +I66 +sS'ARDBCRC' +p15 +I1726732487 +sg4 +F0.99993896484375 +sg6 +F1.0 +sS'accurip' +p16 +I01 +sg8 +V/home/thomas/Bloc Party - Silent Alarm/01. Bloc Party - Like Eating Glass.flac +p17 +sS'pregap' +p18 +I15220 +sg5 +L1476997036L +sba(imorituri.result.result +TrackResult +p19 +(dp20 +g12 +L3896378645L +sg3 +L2118180996L +sg13 +I65 +sg7 +I2 +sg14 +I65 +sg15 +L3896378645L +sg4 +F0.99908447265625 +sg6 +F1.0 +sg16 +I01 +sg8 +V/home/thomas/Bloc Party - Silent Alarm/02. Bloc Party - Helicopter.flac +p21 +sg18 +I0 +sg5 +L2118180996L +sba(imorituri.result.result +TrackResult +p22 +(dp23 +g12 +L1246554911L +sg3 +L2397618238L +sg13 +I66 +sg7 +I3 +sg14 +I66 +sg15 +I1246554911 +sg4 +F0.999969482421875 +sg6 +F1.0 +sg16 +I01 +sg8 +V/home/thomas/Bloc Party - Silent Alarm/03. Bloc Party - Positive Tension.flac +p24 +sg18 +I0 +sg5 +L2397618238L +sba(imorituri.result.result +TrackResult +p25 +(dp26 +g12 +L175751014L +sg3 +L1340624205L +sg13 +I65 +sg7 +I4 +sg14 +I65 +sg15 +I175751014 +sg4 +F0.9990234375 +sg6 +F1.0 +sg16 +I01 +sg8 +V/home/thomas/Bloc Party - Silent Alarm/04. Bloc Party - Banquet.flac +p27 +sg18 +I0 +sg5 +L1340624205L +sba(imorituri.result.result +TrackResult +p28 +(dp29 +g12 +L3375033750L +sg3 +L183201985L +sg13 +I66 +sg7 +I5 +sg14 +I66 +sg15 +L3375033750L +sg4 +F0.9990234375 +sg6 +F1.0 +sg16 +I01 +sg8 +V/home/thomas/Bloc Party - Silent Alarm/05. Bloc Party - Blue Light.flac +p30 +sg18 +I72 +sg5 +L183201985L +sba(imorituri.result.result +TrackResult +p31 +(dp32 +g12 +L3357757503L +sg3 +L221401921L +sg13 +I66 +sg7 +I6 +sg14 +I66 +sg15 +L3357757503L +sg4 +F0.9990234375 +sg6 +F1.0 +sg16 +I01 +sg8 +V/home/thomas/Bloc Party - Silent Alarm/06. Bloc Party - She's Hearing Voices.flac +p33 +sg18 +I41 +sg5 +L221401921L +sba(imorituri.result.result +TrackResult +p34 +(dp35 +g12 +L3964329421L +sg3 +L3133726276L +sg13 +I65 +sg7 +I7 +sg14 +I65 +sg15 +L3964329421L +sg4 +F0.999969482421875 +sg6 +F1.0 +sg16 +I01 +sg8 +V/home/thomas/Bloc Party - Silent Alarm/07. Bloc Party - This Modern Love.flac +p36 +sg18 +I17 +sg5 +L3133726276L +sba(imorituri.result.result +TrackResult +p37 +(dp38 +g12 +L1808393808L +sg3 +L2318646110L +sg13 +I66 +sg7 +I8 +sg14 +I66 +sg15 +I1808393808 +sg4 +F0.9990234375 +sg6 +F1.0 +sg16 +I01 +sg8 +V/home/thomas/Bloc Party - Silent Alarm/08. Bloc Party - The Pioneers.flac +p39 +sg18 +I4 +sg5 +L2318646110L +sba(imorituri.result.result +TrackResult +p40 +(dp41 +g12 +L4144642428L +sg3 +L3145161267L +sg13 +I66 +sg7 +I9 +sg14 +I66 +sg15 +L4144642428L +sg4 +F0.9990234375 +sg6 +F1.0 +sg16 +I01 +sg8 +V/home/thomas/Bloc Party - Silent Alarm/09. Bloc Party - Price of Gasoline.flac +p42 +sg18 +I11 +sg5 +L3145161267L +sba(imorituri.result.result +TrackResult +p43 +(dp44 +g12 +L4287362638L +sg3 +L3022257630L +sg13 +I65 +sg7 +I10 +sg14 +I65 +sg15 +L4287362638L +sg4 +F0.9990234375 +sg6 +F1.0 +sg16 +I01 +sg8 +V/home/thomas/Bloc Party - Silent Alarm/10. Bloc Party - So Here We Are.flac +p45 +sg18 +I0 +sg5 +L3022257630L +sba(imorituri.result.result +TrackResult +p46 +(dp47 +g12 +L4127263616L +sg3 +L2011827324L +sg13 +I65 +sg7 +I11 +sg14 +I65 +sg15 +L4127263616L +sg4 +F0.999481201171875 +sg6 +F1.0 +sg16 +I01 +sg8 +V/home/thomas/Bloc Party - Silent Alarm/11. Bloc Party - Luno.flac +p48 +sg18 +I43 +sg5 +L2011827324L +sba(imorituri.result.result +TrackResult +p49 +(dp50 +g12 +L2559991386L +sg3 +L933582879L +sg13 +I65 +sg7 +I12 +sg14 +I65 +sg15 +L2559991386L +sg4 +F0.999969482421875 +sg6 +F1.0 +sg16 +I01 +sg8 +V/home/thomas/Bloc Party - Silent Alarm/12. Bloc Party - Plans.flac +p51 +sg18 +I116 +sg5 +L933582879L +sba(imorituri.result.result +TrackResult +p52 +(dp53 +g12 +L2915053507L +sg3 +L1187281525L +sg13 +I66 +sg7 +I13 +sg14 +I66 +sg15 +L2915053507L +sg4 +F0.999969482421875 +sg6 +F1.0 +sg16 +I01 +sg8 +V/home/thomas/Bloc Party - Silent Alarm/13. Bloc Party - Compliments.flac +p54 +sg18 +I22 +sg5 +L1187281525L +sba. \ No newline at end of file diff --git a/morituri/test/test_common_program.py b/morituri/test/test_common_program.py index 9c4dde9..a9b37c5 100644 --- a/morituri/test/test_common_program.py +++ b/morituri/test/test_common_program.py @@ -2,6 +2,8 @@ # vi:si:et:sw=4:sts=4:ts=4 import os +import pickle + import unittest from morituri.result import result @@ -62,3 +64,18 @@ class TrackImageVerifyTestCase(unittest.TestCase): self.assertEquals(res[10 - 1], "Track 10: rip NOT accurate (max confidence 2) " "[16457a5a], DB [eb6e55b4]") + +class HTOATestCase(unittest.TestCase): + def setUp(self): + path = os.path.join(os.path.dirname(__file__), + 'silentalarm.result.pickle') + self._tracks = pickle.load(open(path, 'rb')) + + def testGetAccurateRipResults(self): + prog = program.Program() + prog.result = result.RipResult() + prog.result.tracks = self._tracks + + prog.getAccurateRipResults() + +