Allow configuring whether to auto close the drive's tray
Fixes #488. Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
This commit is contained in:
@@ -47,6 +47,10 @@ Options
|
||||
| **-e** | **--eject** *never failure success always*
|
||||
| When to eject disc (default: success)
|
||||
|
||||
| **-c** | **--drive-auto-close**
|
||||
| Whether to auto close the drive's tray before reading a CD
|
||||
| (default: True)
|
||||
|
||||
| **-R** | **--record**
|
||||
| Record API requests for playback
|
||||
|
||||
|
||||
@@ -92,7 +92,8 @@ class _CD(BaseCommand):
|
||||
self.device = self.options.device
|
||||
logger.info('checking device %s', self.device)
|
||||
|
||||
utils.load_device(self.device)
|
||||
if self.options.drive_auto_close is True:
|
||||
utils.load_device(self.device)
|
||||
utils.unmount_device(self.device)
|
||||
|
||||
# first, read the normal TOC, which is fast
|
||||
|
||||
@@ -118,7 +118,11 @@ class Whipper(BaseCommand):
|
||||
default="success",
|
||||
choices=('never', 'failure',
|
||||
'success', 'always'),
|
||||
help="when to eject disc (default: success)")
|
||||
help="when to eject disc (default: success)"),
|
||||
self.parser.add_argument('-c', '--drive-auto-close', action="store",
|
||||
dest="drive_auto_close", default=True,
|
||||
help="whether to auto close the drive's "
|
||||
"tray before reading a CD (default: True)")
|
||||
|
||||
def handle_arguments(self):
|
||||
if self.options.help:
|
||||
|
||||
@@ -80,7 +80,8 @@ CD in the AccurateRip database."""
|
||||
# if necessary, load and unmount
|
||||
logger.info('checking device %s', device)
|
||||
|
||||
utils.load_device(device)
|
||||
if self.options.drive_auto_close is True:
|
||||
utils.load_device(device)
|
||||
utils.unmount_device(device)
|
||||
|
||||
# first get the Table Of Contents of the CD
|
||||
|
||||
Reference in New Issue
Block a user