[SCM] morituri/master: * morituri/rip/cd.py: Use configured read offset for drive if possible. Fixes #76.
js at users.alioth.debian.org
js at users.alioth.debian.org
Sun Oct 19 20:09:47 UTC 2014
The following commit has been merged in the master branch:
commit 5d26eae4b9c5e7178d248f7653e312006fc062d6
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date: Sun Dec 2 12:19:08 2012 +0000
* morituri/rip/cd.py:
Use configured read offset for drive if possible.
Fixes #76.
diff --git a/ChangeLog b/ChangeLog
index fda3ae2..df751f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2012-12-02 Thomas Vander Stichele <thomas at apestaart dot org>
+ * morituri/rip/cd.py:
+ Use configured read offset for drive if possible.
+ Fixes #76.
+
+2012-12-02 Thomas Vander Stichele <thomas at apestaart dot org>
+
* morituri/rip/main.py:
Add the config object to the root command.
* morituri/rip/offset.py:
diff --git a/morituri/rip/cd.py b/morituri/rip/cd.py
index b398be5..e2d2072 100644
--- a/morituri/rip/cd.py
+++ b/morituri/rip/cd.py
@@ -77,11 +77,9 @@ Log files will log the path to tracks relative to this directory.
"(default '%default', choose from '" +
"', '".join(loggers) + "')")
# FIXME: get from config
- default = 0
self.parser.add_option('-o', '--offset',
action="store", dest="offset",
- help="sample read offset (defaults to %d)" % default,
- default=default)
+ help="sample read offset (defaults to configured value, or 0)")
self.parser.add_option('-O', '--output-directory',
action="store", dest="output_directory",
help="output directory "
@@ -89,8 +87,7 @@ Log files will log the path to tracks relative to this directory.
# FIXME: have a cache of these pickles somewhere
self.parser.add_option('-T', '--toc-pickle',
action="store", dest="toc_pickle",
- help="pickle to use for reading and writing the TOC",
- default=default)
+ help="pickle to use for reading and writing the TOC")
# FIXME: get from config
self.parser.add_option('', '--track-template',
action="store", dest="track_template",
@@ -123,6 +120,23 @@ Log files will log the path to tracks relative to this directory.
options.track_template = options.track_template.decode('utf-8')
options.disc_template = options.disc_template.decode('utf-8')
+ if options.offset is None:
+ info = drive.getDeviceInfo(self.parentCommand.options.device)
+ if info:
+ try:
+ options.offset = self.getRootCommand(
+ ).config.getReadOffset(*info)
+ self.stdout.write("Using configured read offset %d\n" %
+ options.offset)
+ except KeyError:
+ pass
+
+ if options.offset is None:
+ options.offset = 0
+ self.stdout.write("Using fallback read offset %d\n" %
+ options.offset)
+
+
def do(self, args):
prog = program.Program(record=self.getRootCommand().record)
runner = task.SyncRunner()
--
morituri packaging
More information about the pkg-multimedia-commits
mailing list