* morituri/common/encode.py:
* morituri/common/program.py: * morituri/image/image.py: * morituri/program/cdparanoia.py: * morituri/rip/cd.py: * morituri/rip/image.py: * morituri/rip/offset.py: Move all gst-using imports inside functions and classes to avoid 'import gst' eating our options. Fixes #12.
This commit is contained in:
13
ChangeLog
13
ChangeLog
@@ -1,3 +1,16 @@
|
||||
2010-04-04 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* morituri/common/encode.py:
|
||||
* morituri/common/program.py:
|
||||
* morituri/image/image.py:
|
||||
* morituri/program/cdparanoia.py:
|
||||
* morituri/rip/cd.py:
|
||||
* morituri/rip/image.py:
|
||||
* morituri/rip/offset.py:
|
||||
Move all gst-using imports inside functions and classes
|
||||
to avoid 'import gst' eating our options.
|
||||
Fixes #12.
|
||||
|
||||
2010-03-15 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* bin/Makefile.am:
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
|
||||
import math
|
||||
|
||||
import gst
|
||||
|
||||
from morituri.common import common, task
|
||||
|
||||
from morituri.common import log
|
||||
@@ -50,6 +48,10 @@ class FlacProfile(Profile):
|
||||
|
||||
# FIXME: we should do something better than just printing ERRORS
|
||||
def test(self):
|
||||
|
||||
# here to avoid import gst eating our options
|
||||
import gst
|
||||
|
||||
plugin = gst.registry_get_default().find_plugin('flac')
|
||||
if not plugin:
|
||||
print 'ERROR: cannot find flac plugin'
|
||||
@@ -145,6 +147,10 @@ class EncodeTask(task.Task):
|
||||
|
||||
def start(self, runner):
|
||||
task.Task.start(self, runner)
|
||||
|
||||
# here to avoid import gst eating our options
|
||||
import gst
|
||||
|
||||
self._pipeline = gst.parse_launch('''
|
||||
filesrc location="%s" !
|
||||
decodebin name=decoder !
|
||||
@@ -235,6 +241,9 @@ class EncodeTask(task.Task):
|
||||
self._peakdB = p
|
||||
|
||||
def stop(self):
|
||||
# here to avoid import gst eating our options
|
||||
import gst
|
||||
|
||||
self.debug('stopping')
|
||||
self.debug('setting state to NULL')
|
||||
self._pipeline.set_state(gst.STATE_NULL)
|
||||
|
||||
@@ -26,13 +26,11 @@ Common functionality and class for all programs using morituri.
|
||||
|
||||
import os
|
||||
|
||||
from morituri.common import common, log, checksum
|
||||
from morituri.common import common, log
|
||||
from morituri.result import result
|
||||
from morituri.program import cdrdao, cdparanoia
|
||||
from morituri.image import image
|
||||
|
||||
import gst
|
||||
|
||||
class MusicBrainzException(Exception):
|
||||
def __init__(self, exc):
|
||||
self.args = (exc, )
|
||||
@@ -299,6 +297,9 @@ class Program(log.Loggable):
|
||||
# htoa defaults to disc's artist
|
||||
title = 'Hidden Track One Audio'
|
||||
|
||||
# here to avoid import gst eating our options
|
||||
import gst
|
||||
|
||||
ret = gst.TagList()
|
||||
|
||||
# gst-python 0.10.15.1 does not handle unicode -> utf8 string conversion
|
||||
@@ -356,6 +357,9 @@ class Program(log.Loggable):
|
||||
return (start, stop)
|
||||
|
||||
def verifyTrack(self, runner, trackResult):
|
||||
# here to avoid import gst eating our options
|
||||
from morituri.common import checksum
|
||||
|
||||
t = checksum.CRC32Task(trackResult.filename)
|
||||
|
||||
runner.run(t)
|
||||
|
||||
@@ -26,9 +26,7 @@ Wrap on-disk CD images based on the .cue file.
|
||||
|
||||
import os
|
||||
|
||||
import gst
|
||||
|
||||
from morituri.common import task, checksum, log, common, encode
|
||||
from morituri.common import task, log, common
|
||||
from morituri.image import cue, table
|
||||
|
||||
class Image(object, log.Loggable):
|
||||
@@ -120,6 +118,10 @@ class AccurateRipChecksumTask(task.MultiSeparateTask):
|
||||
self.debug('track %d has length %d' % (trackIndex + 1, length))
|
||||
|
||||
path = image.getRealPath(index.path)
|
||||
|
||||
# here to avoid import gst eating our options
|
||||
from morituri.common import checksum
|
||||
|
||||
checksumTask = checksum.AccurateRipChecksumTask(path,
|
||||
trackNumber=trackIndex + 1, trackCount=len(cue.table.tracks),
|
||||
frameStart=index.relative * common.SAMPLES_PER_FRAME,
|
||||
@@ -149,6 +151,9 @@ class AudioLengthTask(task.Task):
|
||||
self._path = path
|
||||
|
||||
def start(self, runner):
|
||||
# here to avoid import gst eating our options
|
||||
import gst
|
||||
|
||||
task.Task.start(self, runner)
|
||||
self._pipeline = gst.parse_launch('''
|
||||
filesrc location="%s" !
|
||||
@@ -235,6 +240,9 @@ class ImageEncodeTask(task.MultiSeparateTask):
|
||||
self.lengths = {}
|
||||
|
||||
def add(index):
|
||||
# here to avoid import gst eating our options
|
||||
from morituri.common import encode
|
||||
|
||||
path = image.getRealPath(index.path)
|
||||
assert type(path) is unicode, "%r is not unicode" % path
|
||||
self.debug('schedule encode of %r', path)
|
||||
|
||||
@@ -27,7 +27,7 @@ import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
from morituri.common import task, log, common, checksum, encode
|
||||
from morituri.common import task, log, common
|
||||
from morituri.extern import asyncsub
|
||||
|
||||
class FileSizeError(Exception):
|
||||
@@ -371,6 +371,9 @@ class ReadVerifyTrackTask(task.MultiSeparateTask):
|
||||
os.close(fd)
|
||||
self._tmpwavpath = tmppath
|
||||
|
||||
# here to avoid import gst eating our options
|
||||
from morituri.common import checksum
|
||||
|
||||
self.tasks = []
|
||||
self.tasks.append(
|
||||
ReadTrackTask(tmppath, table, start, stop,
|
||||
@@ -387,6 +390,10 @@ class ReadVerifyTrackTask(task.MultiSeparateTask):
|
||||
tmpoutpath = unicode(tmpoutpath)
|
||||
os.close(fd)
|
||||
self._tmppath = tmpoutpath
|
||||
|
||||
# here to avoid import gst eating our options
|
||||
from morituri.common import encode
|
||||
|
||||
self.tasks.append(encode.EncodeTask(tmppath, tmpoutpath, profile,
|
||||
taglist=taglist))
|
||||
# make sure our encoding is accurate
|
||||
@@ -415,7 +422,6 @@ class ReadVerifyTrackTask(task.MultiSeparateTask):
|
||||
|
||||
try:
|
||||
shutil.move(self._tmppath, self.path)
|
||||
self.checksum = checksum
|
||||
except Exception, e:
|
||||
self._exception = e
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ import math
|
||||
import gobject
|
||||
gobject.threads_init()
|
||||
|
||||
from morituri.common import logcommand, task, checksum, common, accurip, log
|
||||
from morituri.common import drive, encode, program
|
||||
from morituri.common import logcommand, task, common, accurip, log
|
||||
from morituri.common import drive, program
|
||||
from morituri.result import result
|
||||
from morituri.image import image, cue, table
|
||||
from morituri.program import cdrdao, cdparanoia
|
||||
@@ -63,6 +63,10 @@ class Rip(logcommand.LogCommand):
|
||||
help="template for disc file naming (default %s)" % default,
|
||||
default=default)
|
||||
default = 'flac'
|
||||
|
||||
# here to avoid import gst eating our options
|
||||
from morituri.common import encode
|
||||
|
||||
self.parser.add_option('', '--profile',
|
||||
action="store", dest="profile",
|
||||
help="profile for encoding (default '%s', choices '%s')" % (
|
||||
@@ -145,6 +149,8 @@ See http://sourceforge.net/tracker/?func=detail&aid=604751&group_id=2171&atid=1
|
||||
|
||||
prog.outdir = (self.options.output_directory or os.getcwd())
|
||||
prog.outdir = prog.outdir.decode('utf-8')
|
||||
# here to avoid import gst eating our options
|
||||
from morituri.common import encode
|
||||
profile = encode.PROFILES[self.options.profile]()
|
||||
|
||||
# result
|
||||
|
||||
@@ -22,8 +22,7 @@
|
||||
|
||||
import os
|
||||
|
||||
from morituri.common import logcommand, task, checksum, accurip, program
|
||||
from morituri.common import encode
|
||||
from morituri.common import logcommand, task, accurip, program
|
||||
from morituri.image import image, cue
|
||||
from morituri.result import result
|
||||
from morituri.program import cdrdao, cdparanoia
|
||||
@@ -39,6 +38,10 @@ class Encode(logcommand.LogCommand):
|
||||
help="output directory (defaults to current directory)")
|
||||
|
||||
default = 'vorbis'
|
||||
|
||||
# here to avoid import gst eating our options
|
||||
from morituri.common import encode
|
||||
|
||||
self.parser.add_option('', '--profile',
|
||||
action="store", dest="profile",
|
||||
help="profile for encoding (default '%s', choices '%s')" % (
|
||||
@@ -50,6 +53,10 @@ class Encode(logcommand.LogCommand):
|
||||
prog = program.Program()
|
||||
prog.outdir = (self.options.output_directory or os.getcwd())
|
||||
prog.outdir = prog.outdir.decode('utf-8')
|
||||
|
||||
# here to avoid import gst eating our options
|
||||
from morituri.common import encode
|
||||
|
||||
profile = encode.ALL_PROFILES[self.options.profile]()
|
||||
|
||||
runner = task.SyncRunner()
|
||||
|
||||
@@ -26,7 +26,7 @@ import tempfile
|
||||
import gobject
|
||||
gobject.threads_init()
|
||||
|
||||
from morituri.common import logcommand, task, checksum, accurip, drive
|
||||
from morituri.common import logcommand, task, accurip, drive
|
||||
from morituri.image import image
|
||||
from morituri.program import cdrdao, cdparanoia
|
||||
|
||||
@@ -182,6 +182,9 @@ CD in the AccurateRip database."""
|
||||
track, offset)
|
||||
runner.run(t)
|
||||
|
||||
# here to avoid import gst eating our options
|
||||
from morituri.common import checksum
|
||||
|
||||
t = checksum.AccurateRipChecksumTask(path, trackNumber=track,
|
||||
trackCount=len(table.tracks))
|
||||
runner.run(t)
|
||||
|
||||
Reference in New Issue
Block a user