Rip out all code that directly uses gstreamer
We can now rip CDs without gstreamer. This is not the most clean attempt, but I have tried to remove most of the code that depends on gstreamer. I hope there is not a lot of code left that depends on code that I have removed - I can at least rip a CD fully.
This commit is contained in:
@@ -31,8 +31,9 @@ import gobject
|
||||
gobject.threads_init()
|
||||
|
||||
from morituri.command.basecommand import BaseCommand
|
||||
from morituri.common import encode
|
||||
from morituri.common import (
|
||||
accurip, common, config, drive, gstreamer, program, task
|
||||
accurip, common, config, drive, program, task
|
||||
)
|
||||
from morituri.program import cdrdao, cdparanoia, utils
|
||||
from morituri.result import result
|
||||
@@ -317,17 +318,6 @@ Log files will log the path to tracks relative to this directory.
|
||||
|
||||
|
||||
def doCommand(self):
|
||||
# here to avoid import gst eating our options
|
||||
from morituri.common import encode
|
||||
profile = encode.PROFILES['flac']()
|
||||
self.program.result.profileName = profile.name
|
||||
self.program.result.profilePipeline = profile.pipeline
|
||||
elementFactory = profile.pipeline.split(' ')[0]
|
||||
self.program.result.gstreamerVersion = gstreamer.gstreamerVersion()
|
||||
self.program.result.gstPythonVersion = gstreamer.gstPythonVersion()
|
||||
self.program.result.encoderVersion = gstreamer.elementFactoryVersion(
|
||||
elementFactory)
|
||||
|
||||
self.program.setWorkingDirectory(self.options.working_directory)
|
||||
self.program.outdir = self.options.output_directory.decode('utf-8')
|
||||
self.program.result.offset = int(self.options.offset)
|
||||
@@ -339,7 +329,7 @@ Log files will log the path to tracks relative to this directory.
|
||||
while True:
|
||||
discName = self.program.getPath(self.program.outdir,
|
||||
self.options.disc_template, self.mbdiscid, 0,
|
||||
profile=profile, disambiguate=disambiguate)
|
||||
disambiguate=disambiguate)
|
||||
dirname = os.path.dirname(discName)
|
||||
if os.path.exists(dirname):
|
||||
sys.stdout.write("Output directory %s already exists\n" %
|
||||
@@ -382,8 +372,8 @@ Log files will log the path to tracks relative to this directory.
|
||||
path = self.program.getPath(self.program.outdir,
|
||||
self.options.track_template,
|
||||
self.mbdiscid, number,
|
||||
profile=profile, disambiguate=disambiguate) \
|
||||
+ '.' + profile.extension
|
||||
disambiguate=disambiguate) \
|
||||
+ '.' + 'flac'
|
||||
logger.debug('ripIfNotRipped: path %r' % path)
|
||||
trackResult.number = number
|
||||
|
||||
@@ -429,7 +419,6 @@ Log files will log the path to tracks relative to this directory.
|
||||
self.program.ripTrack(self.runner, trackResult,
|
||||
offset=int(self.options.offset),
|
||||
device=self.device,
|
||||
profile=profile,
|
||||
taglist=self.program.getTagList(number),
|
||||
overread=self.options.overread,
|
||||
what='track %d of %d%s' % (
|
||||
@@ -509,7 +498,7 @@ Log files will log the path to tracks relative to this directory.
|
||||
### write disc files
|
||||
discName = self.program.getPath(self.program.outdir,
|
||||
self.options.disc_template, self.mbdiscid, 0,
|
||||
profile=profile, disambiguate=disambiguate)
|
||||
disambiguate=disambiguate)
|
||||
dirname = os.path.dirname(discName)
|
||||
if not os.path.exists(dirname):
|
||||
os.makedirs(dirname)
|
||||
@@ -541,8 +530,7 @@ Log files will log the path to tracks relative to this directory.
|
||||
|
||||
path = self.program.getPath(self.program.outdir,
|
||||
self.options.track_template, self.mbdiscid, i + 1,
|
||||
profile=profile,
|
||||
disambiguate=disambiguate) + '.' + profile.extension
|
||||
disambiguate=disambiguate) + '.' + 'flac'
|
||||
writeFile(handle, path,
|
||||
self.itable.getTrackLength(i + 1) / common.FRAMES_PER_SECOND)
|
||||
|
||||
|
||||
@@ -195,31 +195,6 @@ class Encode(BaseCommand):
|
||||
sys.stdout.write('Encoded to %s\n' % toPath.encode('utf-8'))
|
||||
|
||||
|
||||
class MaxSample(BaseCommand):
|
||||
summary = "run a max sample task"
|
||||
description = summary
|
||||
|
||||
def add_arguments(self):
|
||||
self.parser.add_argument('files', nargs='+', action='store',
|
||||
help="audio files to sample")
|
||||
|
||||
def do(self):
|
||||
runner = task.SyncRunner()
|
||||
# here to avoid import gst eating our options
|
||||
from morituri.common import checksum
|
||||
|
||||
for arg in self.options.files:
|
||||
fromPath = unicode(arg.decode('utf-8'))
|
||||
|
||||
checksumtask = checksum.MaxSampleTask(fromPath)
|
||||
|
||||
runner.run(checksumtask)
|
||||
|
||||
sys.stdout.write('%s\n' % arg)
|
||||
sys.stdout.write('Biggest absolute sample: %04x\n' %
|
||||
checksumtask.checksum)
|
||||
|
||||
|
||||
class Tag(BaseCommand):
|
||||
summary = "run a tag reading task"
|
||||
description = summary
|
||||
@@ -325,7 +300,6 @@ class Debug(BaseCommand):
|
||||
subcommands = {
|
||||
'checksum': Checksum,
|
||||
'encode': Encode,
|
||||
'maxsample': MaxSample,
|
||||
'tag': Tag,
|
||||
'musicbrainzngs': MusicBrainzNGS,
|
||||
'resultcache': ResultCache,
|
||||
|
||||
@@ -25,6 +25,7 @@ import sys
|
||||
|
||||
from morituri.command.basecommand import BaseCommand
|
||||
from morituri.common import accurip, config, program
|
||||
from morituri.common import encode
|
||||
from morituri.extern.task import task
|
||||
from morituri.image import image
|
||||
from morituri.result import result
|
||||
@@ -59,8 +60,6 @@ Retags the image from the given .cue files with tags obtained from MusicBrainz.
|
||||
)
|
||||
|
||||
def do(self):
|
||||
# here to avoid import gst eating our options
|
||||
from morituri.common import encode
|
||||
|
||||
prog = program.Program(config.Config(), stdout=sys.stdout)
|
||||
runner = task.SyncRunner()
|
||||
|
||||
@@ -32,6 +32,7 @@ from morituri.command.basecommand import BaseCommand
|
||||
from morituri.common import accurip, common, config, drive, program
|
||||
from morituri.common import task as ctask
|
||||
from morituri.program import cdrdao, cdparanoia, utils
|
||||
from morituri.common import checksum
|
||||
|
||||
from morituri.extern.task import task
|
||||
|
||||
@@ -209,8 +210,6 @@ CD in the AccurateRip database."""
|
||||
track, offset)
|
||||
runner.run(t)
|
||||
|
||||
# here to avoid import gst eating our options
|
||||
from morituri.common import checksum
|
||||
|
||||
# TODO MW: Update this to also use the v2 checksum(s)
|
||||
t = checksum.FastAccurateRipChecksumTask(path, trackNumber=track,
|
||||
|
||||
Reference in New Issue
Block a user