From b5c22da76d3a20b289f01b455f07ca351186f941 Mon Sep 17 00:00:00 2001 From: JoeLametta Date: Sun, 24 Jul 2016 22:53:26 +0200 Subject: [PATCH 1/2] Address issue #23 Moved to its own branch. It should work. In the future this commit could be improved providing a way to override pycdio hard dependency. --- morituri/rip/cd.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/morituri/rip/cd.py b/morituri/rip/cd.py index b75894c..a72f755 100644 --- a/morituri/rip/cd.py +++ b/morituri/rip/cd.py @@ -168,11 +168,9 @@ class _CD(logcommand.LogCommand): self.program.result.release = \ cdio.Device(self.device).get_hwinfo() except ImportError: - self.stdout.write( - 'WARNING: pycdio not installed, cannot identify drive\n') - self.program.result.vendor = 'Unknown' - self.program.result.model = 'Unknown' - self.program.result.release = 'Unknown' + raise ImportError("Pycdio module import failed.\n" + "This is a hard dependency: if not available " + "please install it") self.doCommand() @@ -273,11 +271,13 @@ Log files will log the path to tracks relative to this directory. pass if options.offset is None: - options.offset = 0 - self.stdout.write("""WARNING: using default offset %d. -Install pycdio and run 'rip offset find' to detect your drive's offset. -""" % - options.offset) + raise ValueError("Drive offset is unconfigured.\n" + "Please install pycdio and run 'rip offset " + "find' to detect your drive's offset or set it " + "manually in the configuration file. It can " + "also be specified at runtime using the " + "'--offset=value' argument") + if self.options.output_directory is None: self.options.output_directory = os.getcwd() else: From 742879ac94f5eccd8502c7bdeefb3f3ff044be3d Mon Sep 17 00:00:00 2001 From: JoeLametta Date: Mon, 25 Jul 2016 09:56:00 +0200 Subject: [PATCH 2/2] Allow overriding pycdio dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Keep in mind overriding isn’t the suggested behavior. --- README.md | 4 ++-- morituri/rip/cd.py | 19 +++++++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6a56835..bd2d578 100755 --- a/README.md +++ b/README.md @@ -52,10 +52,10 @@ REQUIREMENTS - GStreamer and its python bindings, for encoding - gstreamer0.10-base-plugins >= 0.10.22 for appsink - gstreamer0.10-good-plugins for wav encoding (it depends on the Linux distro used) -- python musicbrainz2, for metadata lookup +- python musicbrainzngs, for metadata lookup - python-setuptools, for plugin support - python-cddb, for showing but not using disc info if not in MusicBrainz -- pycdio, for drive identification (optional) +- pycdio, for drive identification (it can be overridden placing a blank file named `PYCDIO_IGNORE` into whipper's config path) - Required for drive offset and caching behavior to be stored in the config file Additionally, if you're building from a git checkout: diff --git a/morituri/rip/cd.py b/morituri/rip/cd.py index a72f755..0906a35 100644 --- a/morituri/rip/cd.py +++ b/morituri/rip/cd.py @@ -30,7 +30,7 @@ import gobject gobject.threads_init() from morituri.common import logcommand, common, accurip, gstreamer -from morituri.common import drive, program, task +from morituri.common import drive, program, task, directory from morituri.result import result from morituri.program import cdrdao, cdparanoia from morituri.rip import common as rcommon @@ -168,9 +168,20 @@ class _CD(logcommand.LogCommand): self.program.result.release = \ cdio.Device(self.device).get_hwinfo() except ImportError: - raise ImportError("Pycdio module import failed.\n" - "This is a hard dependency: if not available " - "please install it") + d = directory.Directory() + path = os.path.dirname(d.getConfig()) + fullPath = os.path.join(path, 'PYCDIO_IGNORE') + if os.path.isfile(fullPath): + self.stdout.write( + 'WARNING: pycdio not installed, cannot identify drive ' + '(hard dependency overridden)\n') + self.program.result.vendor = 'Unknown' + self.program.result.model = 'Unknown' + self.program.result.release = 'Unknown' + else: + raise ImportError("Pycdio module import failed.\n" + "This is a hard dependency: if not " + "available please install it") self.doCommand()