From 8a1c0fabfc55654e5bc03bfbe67e7813dca8f300 Mon Sep 17 00:00:00 2001 From: JoeLametta Date: Wed, 23 Sep 2020 17:41:48 +0000 Subject: [PATCH] Allow configuring whether to auto close the drive's tray Fixes #488. Signed-off-by: JoeLametta --- man/whipper.rst | 4 ++++ whipper/command/cd.py | 3 ++- whipper/command/main.py | 6 +++++- whipper/command/offset.py | 3 ++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/man/whipper.rst b/man/whipper.rst index edf695ec..2dc78c3f 100644 --- a/man/whipper.rst +++ b/man/whipper.rst @@ -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 diff --git a/whipper/command/cd.py b/whipper/command/cd.py index 6b41bae2..4718d104 100644 --- a/whipper/command/cd.py +++ b/whipper/command/cd.py @@ -92,7 +92,8 @@ def do(self): 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 diff --git a/whipper/command/main.py b/whipper/command/main.py index 68cf8b5b..8e06939a 100644 --- a/whipper/command/main.py +++ b/whipper/command/main.py @@ -118,7 +118,11 @@ def add_arguments(self): 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: diff --git a/whipper/command/offset.py b/whipper/command/offset.py index bbca660b..f66d50bf 100644 --- a/whipper/command/offset.py +++ b/whipper/command/offset.py @@ -80,7 +80,8 @@ def do(self): # 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