Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions whipper/command/cd.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ def add_arguments(self):
help="continue ripping further tracks "
"instead of giving up if a track "
"can't be ripped")
self.parser.add_argument('-u', '--keep-unverified',
action='store_true',
help="keep unverified (partial) results "
"instead of deleleting the data if a track "
"can't be verified")

def handle_arguments(self):
self.options.output_directory = os.path.expanduser(
Expand Down Expand Up @@ -481,7 +486,8 @@ def _ripIfNotRipped(number):
number,
len(self.itable.tracks),
extra),
coverArtPath=self.coverArtPath)
coverArtPath=self.coverArtPath,
keep=self.options.keep_unverified)
break
# FIXME: catching too general exception (Exception)
except Exception as e:
Expand All @@ -492,7 +498,15 @@ def _ripIfNotRipped(number):
tries -= 1
logger.critical('giving up on track %d after %d times',
number, tries)
if self.options.keep_going:
if self.options.keep_unverified and not number == 0:
logger.warning("track %d failed to rip. keeping unverified file.", number)
logger.debug("adding %s to skipped_tracks",
trackResult)
self.skipped_tracks.append(trackResult)
logger.debug("skipped_tracks = %s",
self.skipped_tracks)
trackResult.skipped = True
elif self.options.keep_going:
logger.warning("track %d failed to rip.", number)
logger.debug("adding %s to skipped_tracks",
trackResult)
Expand Down
5 changes: 3 additions & 2 deletions whipper/common/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ def verifyTrack(runner, trackResult):
return ret

def ripTrack(self, runner, trackResult, offset, device, taglist,
overread, what=None, coverArtPath=None):
overread, what=None, coverArtPath=None, keep=False):
"""
Rip and store a track of the disc.

Expand Down Expand Up @@ -605,7 +605,8 @@ def ripTrack(self, runner, trackResult, offset, device, taglist,
device=device,
taglist=taglist,
what=what,
coverArtPath=coverArtPath)
coverArtPath=coverArtPath,
keep=keep)

runner.run(t)

Expand Down
10 changes: 8 additions & 2 deletions whipper/program/cdparanoia.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,10 @@ class ReadVerifyTrackTask(task.MultiSeparateTask):
_tmpwavpath = None
_tmppath = None

_keep = False

def __init__(self, path, table, start, stop, overread, offset=0,
device=None, taglist=None, what="track", coverArtPath=None):
device=None, taglist=None, what="track", coverArtPath=None, keep=False):
"""
Init ReadVerifyTrackTask.

Expand Down Expand Up @@ -471,6 +473,8 @@ def __init__(self, path, table, start, stop, overread, offset=0,
os.close(fd)
self._tmpwavpath = tmppath

self._keep = keep

from whipper.common import checksum

self.tasks = []
Expand Down Expand Up @@ -547,9 +551,11 @@ def stop(self):
# delete the unencoded file
os.unlink(self._tmpwavpath)

if not self.exception:
if not self.exception or self._keep:
try:
logger.debug('moving to final path %r', self.path)
if self.exception:
logger.debug('keeping unverified result')
shutil.move(self._tmppath, self.path)
# FIXME: catching too general exception (Exception)
except Exception as e:
Expand Down