Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rip out all code that uses gstreamer #130

Merged
merged 5 commits into from
Apr 23, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 7 additions & 19 deletions morituri/command/cd.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
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
Expand Down Expand Up @@ -317,17 +318,6 @@ def handle_arguments(self):


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)
Expand All @@ -339,7 +329,7 @@ def doCommand(self):
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" %
Expand Down Expand Up @@ -382,8 +372,8 @@ def ripIfNotRipped(number):
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

Expand Down Expand Up @@ -429,7 +419,6 @@ def ripIfNotRipped(number):
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' % (
Expand Down Expand Up @@ -509,7 +498,7 @@ def ripIfNotRipped(number):
### 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)
Expand Down Expand Up @@ -541,8 +530,7 @@ def writeFile(handle, path, length):

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)

Expand Down
26 changes: 0 additions & 26 deletions morituri/command/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,31 +195,6 @@ def do(self):
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
Expand Down Expand Up @@ -325,7 +300,6 @@ class Debug(BaseCommand):
subcommands = {
'checksum': Checksum,
'encode': Encode,
'maxsample': MaxSample,
'tag': Tag,
'musicbrainzngs': MusicBrainzNGS,
'resultcache': ResultCache,
Expand Down
3 changes: 1 addition & 2 deletions morituri/command/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

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
Expand Down Expand Up @@ -59,8 +60,6 @@ def add_arguments(self):
)

def do(self):
# here to avoid import gst eating our options
from morituri.common import encode

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also remove this empty line?

prog = program.Program(config.Config(), stdout=sys.stdout)
runner = task.SyncRunner()
Expand Down
3 changes: 1 addition & 2 deletions morituri/command/offset.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
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

Expand Down Expand Up @@ -209,8 +210,6 @@ def _arcs(self, runner, table, track, offset):
track, offset)
runner.run(t)

# here to avoid import gst eating our options
from morituri.common import checksum

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also remove this empty line?

# TODO MW: Update this to also use the v2 checksum(s)
t = checksum.FastAccurateRipChecksumTask(path, trackNumber=track,
Expand Down
Loading