def testNoChange(self): taglist = gst.TagList() taglist[gst.TAG_DESCRIPTION] = 'audiotest wave' taglist[gst.TAG_AUDIO_CODEC] = 'FLAC' t = encode.SafeRetagTask(self._path, taglist) self.runner.run(t)
def do(self, args): prog = program.Program() runner = task.SyncRunner() for arg in args: print 'Retagging image %r' % arg arg = arg.decode('utf-8') cueImage = image.Image(arg) cueImage.setup(runner) mbdiscid = cueImage.table.getMusicBrainzDiscId() prog.metadata = prog.getMusicBrainz(cueImage.table, mbdiscid) if not prog.metadata: print 'Not in MusicBrainz database, skipping' continue # FIXME: this feels like we're poking at internals. prog.cuePath = arg prog.result = result.RipResult() for track in cueImage.table.tracks: path = track.indexes[1].path taglist = prog.getTagList(track.number) self.debug('possibly retagging %r with taglist %r', path, taglist) t = encode.SafeRetagTask(path, taglist) runner.run(t) path = os.path.basename(path) if t.changed: print 'Retagged %s' % path else: print '%s already tagged correctly' % path print
def testChange(self): taglist = gst.TagList() taglist[gst.TAG_DESCRIPTION] = 'audiotest retagged' taglist[gst.TAG_AUDIO_CODEC] = 'FLAC' taglist[gst.TAG_ARTIST] = 'Artist' t = encode.SafeRetagTask(self._path, taglist) self.runner.run(t)
def do(self, args): # here to avoid import gst eating our options from morituri.common import encode prog = program.Program(self.getRootCommand().config, stdout=self.stdout) runner = task.SyncRunner() for arg in args: self.stdout.write('Retagging image %r\n' % arg) arg = arg.decode('utf-8') cueImage = image.Image(arg) cueImage.setup(runner) mbdiscid = cueImage.table.getMusicBrainzDiscId() self.stdout.write('MusicBrainz disc id is %s\n' % mbdiscid) self.stdout.write("MusicBrainz lookup URL %s\n" % cueImage.table.getMusicBrainzSubmitURL()) prog.metadata = prog.getMusicBrainz( cueImage.table, mbdiscid, release=self.options.release_id, country=self.options.country, prompt=self.options.prompt) if not prog.metadata: print 'Not in MusicBrainz database, skipping' continue prog.metadata.discid = mbdiscid # FIXME: this feels like we're poking at internals. prog.cuePath = arg prog.result = result.RipResult() for track in cueImage.table.tracks: path = cueImage.getRealPath(track.indexes[1].path) taglist = prog.getTagList(track.number) self.debug( 'possibly retagging %r from cue path %r with taglist %r', path, arg, taglist) t = encode.SafeRetagTask(path, taglist) runner.run(t) path = os.path.basename(path) if t.changed: print 'Retagged %s' % path else: print '%s already tagged correctly' % path print
def do(self, args): prog = program.Program(self.getRootCommand.config(), stdout=self.stdout) runner = task.SyncRunner() for arg in args: self.stdout.write('Renaming image %r\n' % arg) arg = arg.decode('utf-8') cueImage = image.Image(arg) cueImage.setup(runner) mbdiscid = cueImage.table.getMusicBrainzDiscId() operator = renamer.Operator(statePath, mbdiscid) self.stdout.write('MusicBrainz disc id is %s\n' % mbdiscid) prog.metadata = prog.getMusicBrainz( cueImage.table, mbdiscid, release=self.options.release_id) if not prog.metadata: print 'Not in MusicBrainz database, skipping' continue # FIXME: this feels like we're poking at internals. prog.cuePath = arg prog.result = result.RipResult() for track in cueImage.table.tracks: path = cueImage.getRealPath(track.indexes[1].path) taglist = prog.getTagList(track.number) self.debug( 'possibly retagging %r from cue path %r with taglist %r', path, arg, taglist) t = encode.SafeRetagTask(path, taglist) runner.run(t) path = os.path.basename(path) if t.changed: print 'Retagged %s' % path else: print '%s already tagged correctly' % path print