From 108dc72f5f4cb513c53890df9f4373ca759f81f2 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Sat, 17 Nov 2012 19:35:57 +0000 Subject: [PATCH] convert prints to writes --- configure.ac | 2 +- morituri/rip/offset.py | 32 +++++++++++++++++++------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 36f9c93..a69eea7 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ dnl initialize autoconf dnl when going to/from release please remove/add the nano (fourth number) dnl releases only do Wall, trunk and prerelease does Werror too -AC_INIT(morituri, 0.1.2.2, +AC_INIT(morituri, 0.1.2.3, http://thomas.apestaart.org/morituri/trac/newticket, morituri) diff --git a/morituri/rip/offset.py b/morituri/rip/offset.py index 5106093..fbb10a2 100644 --- a/morituri/rip/offset.py +++ b/morituri/rip/offset.py @@ -93,7 +93,7 @@ CD in the AccurateRip database.""" device = self.options.device # if necessary, load and unmount - print 'Checking device', device + self.stdout.write('Checking device %s\n' % device) prog.loadDevice(device) prog.unmountDevice(device) @@ -122,7 +122,8 @@ CD in the AccurateRip database.""" responses = accurip.getAccurateRipResponses(data) except urllib2.HTTPError, e: if e.code == 404: - print 'Album not found in AccurateRip database.' + self.stdout.write( + 'Album not found in AccurateRip database.\n') return 1 else: raise @@ -145,12 +146,13 @@ CD in the AccurateRip database.""" return None, None for offset in self._offsets: - print 'Trying read offset %d ...' % offset + self.stdout.write('Trying read offset %d ...\n' % offset) try: archecksum = self._arcs(runner, table, 1, offset) except task.TaskException, e: if isinstance(e.exception, cdparanoia.FileSizeError): - print 'WARNING: cannot rip with offset %d...' % offset + self.stdout.write( + 'WARNING: cannot rip with offset %d...\n' % offset) continue self.debug('AR checksum calculated: %s' % archecksum) @@ -159,7 +161,9 @@ CD in the AccurateRip database.""" if c: count = 1 self.debug('MATCHED against response %d' % i) - print 'Offset of device is likely %d, confirming ...' % offset + self.stdout.write( + 'Offset of device is likely %d, confirming ...\n' % + offset) # now try and rip all other tracks as well for track in range(2, len(table.tracks) + 1): @@ -167,8 +171,9 @@ CD in the AccurateRip database.""" archecksum = self._arcs(runner, table, track, offset) except task.TaskException, e: if isinstance(e.exception, cdparanoia.FileSizeError): - print 'WARNING: cannot rip with offset %d...' % \ - offset + self.stdout.write( + 'WARNING: cannot rip with offset %d...\n' % + offset) continue c, i = match(archecksum, track, responses) @@ -178,15 +183,16 @@ CD in the AccurateRip database.""" count += 1 if count == len(table.tracks): - print - print 'Read offset of device is: %d.' % offset + self.stdout.write('\nRead offset of device is: %d.\n' % + offset) return 0 else: - print 'Only %d of %d tracks matched, continuing ...' % ( - count, len(table.tracks)) + self.stdout.write( + 'Only %d of %d tracks matched, continuing ...\n' % ( + count, len(table.tracks))) - print 'No matching offset found.' - print 'Consider trying again with a different disc.' + self.stdout.write('No matching offset found.\n') + self.stdout.write('Consider trying again with a different disc.\n') def _arcs(self, runner, table, track, offset): # rips the track with the given offset, return the arcs checksum