-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to skip tracks #260
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -253,6 +253,12 @@ def add_arguments(self): | |
"if the patched cdparanoia package is " | ||
"installed and the drive " | ||
"supports this feature. ") | ||
self.parser.add_argument('--exclude-tracks', | ||
action="store", dest="excluded_tracks", | ||
default="", | ||
help="Comma separated list of tracks to " | ||
"exclude. This will propably mess up " | ||
"your logs") | ||
self.parser.add_argument('-O', '--output-directory', | ||
action="store", dest="output_directory", | ||
default=os.path.relpath(os.getcwd()), | ||
|
@@ -455,7 +461,16 @@ def _ripIfNotRipped(number): | |
self.ittoc.getTrackLength(number), number) | ||
|
||
self.program.saveRipResult() | ||
|
||
try: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it'd be preferable to just check whether the option is the empty string or not if you were going to do it this way. See further comments. |
||
excluded_tracks = self.options.excluded_tracks.split(",") | ||
except UnboundLocalError: | ||
excluded_tracks = [] | ||
excluded_tracks_integer = [] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should keep the array of excluded tracks in |
||
for i in excluded_tracks: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be better to parse the track listing in the |
||
try: | ||
excluded_tracks_integer.append(int(i.replace(" ", ""))) | ||
except ValueError: | ||
pass | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of silently ignoring errors, we should abort at argument-handling time with a helpful yet short error message. |
||
# check for hidden track one audio | ||
htoa = self.program.getHTOA() | ||
if htoa: | ||
|
@@ -471,6 +486,9 @@ def _ripIfNotRipped(number): | |
# FIXME: make it work for now | ||
track.indexes[1].relative = 0 | ||
continue | ||
if i + 1 in excluded_tracks_integer: | ||
print("excluding track {}".format(i + 1)) | ||
continue | ||
_ripIfNotRipped(i + 1) | ||
|
||
logger.debug('writing cue file for %r', discName) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd be best to handle the logging situation as part of implementing this feature. We'd like to avoid having incompatible features butting heads.