Skip to content

Commit f623604

Browse files
committed
Add config file option to set cdparanoia command
Resolves whipper-team#220 Partially addresses whipper-team#244 Provides workaround for whipper-team#234 Signed-off-by: Evan Harris <[email protected]>
1 parent 6ad681a commit f623604

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

whipper/command/main.py

+5
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,17 @@
1313
from whipper.common import common, directory, config
1414
from whipper.extern.task import task
1515
from whipper.program.utils import eject_device
16+
from whipper.program import cdparanoia
1617

1718
import logging
1819
logger = logging.getLogger(__name__)
1920

2021

2122
def main():
23+
cdparanoia_cmd = config.Config().get('main', 'cdparanoia')
24+
if cdparanoia_cmd:
25+
cdparanoia.setCdParanoiaCommand(cdparanoia_cmd)
26+
2227
server = config.Config().get_musicbrainz_server()
2328
https_enabled = server['scheme'] == 'https'
2429
try:

whipper/program/cdparanoia.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import logging
3636
logger = logging.getLogger(__name__)
3737

38+
cdparanoia = 'cd-paranoia'
3839

3940
class FileSizeError(Exception):
4041
"""The given path does not have the expected size."""
@@ -69,6 +70,12 @@ class ChecksumException(Exception):
6970

7071
_ERROR_RE = re.compile("^scsi_read error:")
7172

73+
74+
def setCdParanoiaCommand(cmd):
75+
global cdparanoia
76+
cdparanoia = cmd
77+
78+
7279
# from reading cdparanoia source code, it looks like offset is reported in
7380
# number of single-channel samples, ie. 2 bytes (word) per unit, and absolute
7481

@@ -271,10 +278,10 @@ def start(self, runner):
271278

272279
bufsize = 1024
273280
if self._overread:
274-
argv = ["cd-paranoia", "--stderr-progress",
281+
argv = [cdparanoia, "--stderr-progress",
275282
"--sample-offset=%d" % self._offset, "--force-overread", ]
276283
else:
277-
argv = ["cd-paranoia", "--stderr-progress",
284+
argv = [cdparanoia, "--stderr-progress",
278285
"--sample-offset=%d" % self._offset, ]
279286
if self._device:
280287
argv.extend(["--force-cdrom-device", self._device, ])
@@ -573,7 +580,7 @@ def stop(self):
573580

574581
def getCdParanoiaVersion():
575582
getter = common.VersionGetter('cd-paranoia',
576-
["cd-paranoia", "-V"],
583+
[cdparanoia, "-V"],
577584
_VERSION_RE,
578585
"%(version)s %(release)s")
579586

@@ -599,7 +606,7 @@ class AnalyzeTask(ctask.PopenTask):
599606
def __init__(self, device=None):
600607
# cdparanoia -A *always* writes cdparanoia.log
601608
self.cwd = tempfile.mkdtemp(suffix='.whipper.cache')
602-
self.command = ['cd-paranoia', '-A']
609+
self.command = [cdparanoia, '-A']
603610
if device:
604611
self.command += ['-d', device]
605612

0 commit comments

Comments
 (0)