[SCM] morituri/master: Merge pull request #21 from supermanvelo/master
js at users.alioth.debian.org
js at users.alioth.debian.org
Sun Oct 19 20:10:05 UTC 2014
return cdrdao version used
handle encoding properly when outputting diff
break into two lines to separate logger problems from morituri
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 462fb04a8bb722a0dd344b5ec2bde956d6281d07
X-Git-Newrev: 52335df43ae26686dbac52aead66eb40c38b34db
The following commit has been merged in the master branch:
commit eba184e54b7fcbb7d62c0796a71595af7a9a838c
Merge: 54f7bedae4185f797d05dbdc94d301b41adfc7f7 7e3d7f0ab77bb6d8d3a967f4ce31c6b4ba23c89f
Author: thomasvs <thomas at apestaart.org>
Date: Sat Jul 13 08:31:42 2013 -0700
Merge pull request #21 from supermanvelo/master
break up logger line; handle encoding for diff
diff --combined morituri/common/program.py
index eecf90d,bac1d69..1b7ea61
--- a/morituri/common/program.py
+++ b/morituri/common/program.py
@@@ -28,7 -28,7 +28,7 @@@ import o
import sys
import time
-from morituri.common import common, log, musicbrainzngs, cache
+from morituri.common import common, log, mbngs, cache
from morituri.program import cdrdao, cdparanoia
from morituri.image import image
@@@ -101,8 -101,9 +101,9 @@@ class Program(log.Loggable)
def getFastToc(self, runner, toc_pickle, device):
"""
Retrieve the normal TOC table from a toc pickle or the drive.
+ Also retrieves the cdrdao version
- @rtype: L{table.Table}
+ @rtype: tuple of L{table.Table}, str
"""
def function(r, t):
r.run(t)
@@@ -132,7 -133,7 +133,7 @@@
ptoc.persist(t.table)
toc = ptoc.object
assert toc.hasTOC()
- return toc
+ return (toc, version)
def getTable(self, runner, cddbdiscid, mbdiscid, device):
"""
@@@ -150,12 -151,8 +151,12 @@@
t = cdrdao.ReadTableTask(device=device)
runner.run(t)
ptable.persist(t.table)
+ self.debug('getTable: read table %r' % t.table)
else:
- self.debug('getTable: cddbdiscid %s in cache' % cddbdiscid)
+ self.debug('getTable: cddbdiscid %s, mbdiscid %s in cache' % (
+ cddbdiscid, mbdiscid))
+ ptable.object.unpickled()
+ self.debug('getTable: loaded table %r' % ptable.object)
itable = ptable.object
assert itable.hasTOC()
@@@ -305,11 -302,11 +306,11 @@@
for _ in range(0, 4):
try:
- metadatas = musicbrainzngs.musicbrainz(mbdiscid,
+ metadatas = mbngs.musicbrainz(mbdiscid,
record=self._record)
- except musicbrainzngs.NotFoundException, e:
+ except mbngs.NotFoundException, e:
break
- except musicbrainzngs.MusicBrainzException, e:
+ except mbngs.MusicBrainzException, e:
self._stdout.write("Warning: %r\n" % (e, ))
time.sleep(5)
continue
@@@ -355,8 -352,7 +356,8 @@@
metadatas[0].title.encode('utf-8'))
elif not metadatas:
self._stdout.write(
- 'Requested release id %s but none match' % release)
+ "Requested release id '%s', "
+ "but none of the found releases match\n" % release)
return
else:
# Select the release that most closely matches the duration.
@@@ -703,7 -699,8 +704,8 @@@
def writeLog(self, discName, logger):
logPath = '%s.log' % discName
handle = open(logPath, 'w')
- handle.write(logger.log(self.result).encode('utf-8'))
+ log = logger.log(self.result)
+ handle.write(log.encode('utf-8'))
handle.close()
self.logPath = logPath
diff --combined morituri/rip/cd.py
index cf03b46,e6e888a..444ee18
--- a/morituri/rip/cd.py
+++ b/morituri/rip/cd.py
@@@ -28,7 -28,7 +28,7 @@@ import gobjec
gobject.threads_init()
from morituri.common import logcommand, common, accurip, gstreamer
-from morituri.common import drive, program, cache
+from morituri.common import drive, program
from morituri.result import result
from morituri.program import cdrdao, cdparanoia
from morituri.rip import common as rcommon
@@@ -42,10 -42,6 +42,10 @@@ MAX_TRIES =
class _CD(logcommand.LogCommand):
+ """
+ @type program: L{program.Program}
+ """
+
def addOptions(self):
# FIXME: have a cache of these pickles somewhere
self.parser.add_option('-T', '--toc-pickle',
@@@ -68,10 -64,8 +68,8 @@@
self.program.loadDevice(self.device)
self.program.unmountDevice(self.device)
- version = None
-
# first, read the normal TOC, which is fast
- self.ittoc = self.program.getFastToc(self.runner,
+ self.ittoc, version = self.program.getFastToc(self.runner,
self.options.toc_pickle,
self.device)
@@@ -84,8 -78,7 +82,8 @@@
self.stdout.write("MusicBrainz lookup URL %s\n" %
self.ittoc.getMusicBrainzSubmitURL())
- self.program.metadata = self.program.getMusicBrainz(self.ittoc, self.mbdiscid,
+ self.program.metadata = self.program.getMusicBrainz(self.ittoc,
+ self.mbdiscid,
release=self.options.release_id)
if not self.program.metadata:
@@@ -95,8 -88,7 +93,8 @@@
if cddbmd:
self.stdout.write('FreeDB identifies disc as %s\n' % cddbmd)
- if not self.options.unknown:
+ # also used by rip cd info
+ if not getattr(self.options, 'unknown', False):
self.program.ejectDevice(self.device)
return -1
@@@ -109,39 -101,32 +107,39 @@@
assert self.itable.getCDDBDiscId() == self.ittoc.getCDDBDiscId(), \
"full table's id %s differs from toc id %s" % (
self.itable.getCDDBDiscId(), self.ittoc.getCDDBDiscId())
- assert self.itable.getMusicBrainzDiscId() == self.ittoc.getMusicBrainzDiscId(), \
+ assert self.itable.getMusicBrainzDiscId() == \
+ self.ittoc.getMusicBrainzDiscId(), \
"full table's mb id %s differs from toc id mb %s" % (
- self.itable.getMusicBrainzDiscId(), self.ittoc.getMusicBrainzDiscId())
- assert self.itable.getAccurateRipURL() == self.ittoc.getAccurateRipURL(), \
+ self.itable.getMusicBrainzDiscId(),
+ self.ittoc.getMusicBrainzDiscId())
+ assert self.itable.getAccurateRipURL() == \
+ self.ittoc.getAccurateRipURL(), \
"full table's AR URL %s differs from toc AR URL %s" % (
self.itable.getAccurateRipURL(), self.ittoc.getAccurateRipURL())
# result
- self.program.result.cdrdaoVersion = version
- self.program.result.cdparanoiaVersion = cdparanoia.getCdParanoiaVersion()
+ self.program.result.cdrdaoVersion = cdrdao.getCDRDAOVersion()
+ self.program.result.cdparanoiaVersion = \
+ cdparanoia.getCdParanoiaVersion()
info = drive.getDeviceInfo(self.parentCommand.options.device)
if info:
try:
- self.program.result.cdparanoiaDefeatsCache = self.getRootCommand(
- ).config.getDefeatsCache(*info)
+ self.program.result.cdparanoiaDefeatsCache = \
+ self.getRootCommand().config.getDefeatsCache(*info)
except KeyError, e:
self.debug('Got key error: %r' % (e, ))
- self.program.result.artist = self.program.metadata and self.program.metadata.artist \
+ self.program.result.artist = self.program.metadata \
+ and self.program.metadata.artist \
or 'Unknown Artist'
- self.program.result.title = self.program.metadata and self.program.metadata.title \
+ self.program.result.title = self.program.metadata \
+ and self.program.metadata.title \
or 'Unknown Title'
# cdio is optional for now
try:
import cdio
- _, self.program.result.vendor, self.program.result.model, self.program.result.release = \
+ _, self.program.result.vendor, self.program.result.model, \
+ self.program.result.release = \
cdio.Device(self.device).get_hwinfo()
except ImportError:
self.stdout.write(
@@@ -273,9 -258,8 +271,9 @@@ Log files will log the path to tracks r
### write disc files
disambiguate = False
while True:
- discName = self.program.getPath(self.program.outdir, self.options.disc_template,
- self.mbdiscid, 0, profile=profile, disambiguate=disambiguate)
+ discName = self.program.getPath(self.program.outdir,
+ self.options.disc_template, self.mbdiscid, 0,
+ profile=profile, disambiguate=disambiguate)
dirname = os.path.dirname(discName)
if os.path.exists(dirname):
self.stdout.write("Output directory %s already exists\n" %
@@@ -313,11 -297,8 +311,11 @@@
self.debug('ripIfNotRipped have trackresult, path %r' %
trackResult.filename)
- path = self.program.getPath(self.program.outdir, self.options.track_template,
- self.mbdiscid, number, profile=profile, disambiguate=disambiguate) + '.' + profile.extension
+ path = self.program.getPath(self.program.outdir,
+ self.options.track_template,
+ self.mbdiscid, number,
+ profile=profile, disambiguate=disambiguate) \
+ + '.' + profile.extension
self.debug('ripIfNotRipped: path %r' % path)
trackResult.number = number
@@@ -423,9 -404,8 +421,9 @@@
ripIfNotRipped(i + 1)
### write disc files
- discName = self.program.getPath(self.program.outdir, self.options.disc_template,
- self.mbdiscid, 0, profile=profile, disambiguate=disambiguate)
+ discName = self.program.getPath(self.program.outdir,
+ self.options.disc_template, self.mbdiscid, 0,
+ profile=profile, disambiguate=disambiguate)
dirname = os.path.dirname(discName)
if not os.path.exists(dirname):
os.makedirs(dirname)
@@@ -455,10 -435,8 +453,10 @@@
if not track.audio:
continue
- path = self.program.getPath(self.program.outdir, self.options.track_template,
- self.mbdiscid, i + 1, profile=profile, disambiguate=disambiguate) + '.' + profile.extension
+ path = self.program.getPath(self.program.outdir,
+ self.options.track_template, self.mbdiscid, i + 1,
+ profile=profile,
+ disambiguate=disambiguate) + '.' + profile.extension
writeFile(handle, path,
self.itable.getTrackLength(i + 1) / common.FRAMES_PER_SECOND)
@@@ -486,8 -464,7 +484,8 @@@
self.program.verifyImage(self.runner, responses)
- self.stdout.write("\n".join(self.program.getAccurateRipResults()) + "\n")
+ self.stdout.write("\n".join(
+ self.program.getAccurateRipResults()) + "\n")
self.program.saveRipResult()
--
morituri packaging
More information about the pkg-multimedia-commits
mailing list