* morituri/common/encode.py:
Add a test() method to the profile so we can warn about bad flacenc versions. Encode track number and count, and release date, if possible. * morituri/rip/cd.py: Fix another off-by-one error in the tag encoding.
This commit is contained in:
@@ -1,3 +1,12 @@
|
||||
2009-06-02 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* morituri/common/encode.py:
|
||||
Add a test() method to the profile so we can warn about bad
|
||||
flacenc versions.
|
||||
Encode track number and count, and release date, if possible.
|
||||
* morituri/rip/cd.py:
|
||||
Fix another off-by-one error in the tag encoding.
|
||||
|
||||
2009-06-01 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* morituri/program/cdparanoia.py:
|
||||
|
||||
@@ -37,11 +37,34 @@ class Profile(object):
|
||||
extension = None
|
||||
pipeline = None
|
||||
|
||||
def test(self):
|
||||
"""
|
||||
Test if this profile will work.
|
||||
Can check for elements, ...
|
||||
"""
|
||||
pass
|
||||
|
||||
class FlacProfile(Profile):
|
||||
name = 'flac'
|
||||
extension = 'flac'
|
||||
pipeline = 'flacenc name=muxer quality=8'
|
||||
|
||||
# FIXME: we should do something better than just printing ERRORS
|
||||
def test(self):
|
||||
plugin = gst.registry_get_default().find_plugin('flac')
|
||||
if not plugin:
|
||||
print 'ERROR: cannot find flac plugin'
|
||||
return False
|
||||
|
||||
versionTuple = tuple([int(x) for x in plugin.get_version().split('.')])
|
||||
if len(versionTuple) < 4:
|
||||
versionTuple = versionTuple + (0, )
|
||||
if versionTuple > (0, 10, 9, 0) and versionTuple <= (0, 10, 15, 0):
|
||||
print 'ERROR: flacenc between 0.10.9 and 0.10.15 has a bug'
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
class AlacProfile(Profile):
|
||||
name = 'alac'
|
||||
extension = 'alac'
|
||||
@@ -92,6 +115,8 @@ class EncodeTask(task.Task):
|
||||
self._peakdB = None
|
||||
self._profile = profile
|
||||
|
||||
self._profile.test()
|
||||
|
||||
def start(self, runner):
|
||||
task.Task.start(self, runner)
|
||||
self._pipeline = gst.parse_launch('''
|
||||
|
||||
@@ -39,10 +39,15 @@ class TrackMetadata(object):
|
||||
title = None
|
||||
|
||||
class DiscMetadata(object):
|
||||
"""
|
||||
@param release: earliest release date, in YYYY-MM-DD
|
||||
@type release: unicode
|
||||
"""
|
||||
artist = None
|
||||
title = None
|
||||
various = False
|
||||
tracks = None
|
||||
release = None
|
||||
|
||||
def __init__(self):
|
||||
self.tracks = []
|
||||
@@ -107,6 +112,7 @@ def musicbrainz(discid):
|
||||
metadata.various = not isSingleArtist
|
||||
metadata.title = release.title
|
||||
metadata.artist = release.artist.getUniqueName()
|
||||
metadata.release = release.getEarliestReleaseDate()
|
||||
|
||||
print "%s - %s" % (release.artist.getUniqueName(), release.title)
|
||||
|
||||
@@ -206,9 +212,21 @@ def getTagList(metadata, i):
|
||||
ret[gst.TAG_ARTIST] = artist.encode('utf-8')
|
||||
ret[gst.TAG_TITLE] = title.encode('utf-8')
|
||||
ret[gst.TAG_ALBUM] = disc.encode('utf-8')
|
||||
ret[gst.TAG_TRACK_NUMBER] = i
|
||||
ret[gst.TAG_TRACK_COUNT] = len(metadata.tracks)
|
||||
|
||||
|
||||
# gst-python 0.10.15.1 does not handle tags that are UINT
|
||||
# see gst-python commit 26fa6dd184a8d6d103eaddf5f12bd7e5144413fb
|
||||
# FIXME: no way to compare against 'master' version after 0.10.15
|
||||
if gst.pygst_version >= (0, 10, 15):
|
||||
ret[gst.TAG_TRACK_NUMBER] = i
|
||||
if metadata:
|
||||
if gst.pygst_version >= (0, 10, 15):
|
||||
ret[gst.TAG_TRACK_COUNT] = len(metadata.tracks)
|
||||
# hack to get a GstDate which we cannot instantiate directly in
|
||||
# 0.10.15.1
|
||||
s = gst.structure_from_string('hi,date=(GstDate)%s' %
|
||||
str(metadata.release))
|
||||
ret[gst.TAG_DATE] = s['date']
|
||||
|
||||
# FIXME: gst.TAG_ISRC
|
||||
|
||||
return ret
|
||||
@@ -301,7 +319,7 @@ class Rip(logcommand.LogCommand):
|
||||
itable.getAccurateRipURL(), ittoc.getAccurateRipURL())
|
||||
|
||||
outdir = self.options.output_directory or os.getcwd()
|
||||
profile = encode.PROFILES[self.options.profile]
|
||||
profile = encode.PROFILES[self.options.profile]()
|
||||
extension = profile.extension
|
||||
|
||||
# check for hidden track one audio
|
||||
@@ -368,7 +386,7 @@ class Rip(logcommand.LogCommand):
|
||||
offset=int(self.options.offset),
|
||||
device=self.parentCommand.options.device,
|
||||
profile=profile,
|
||||
taglist=getTagList(metadata, i))
|
||||
taglist=getTagList(metadata, i + 1))
|
||||
t.description = 'Reading Track %d' % (i + 1)
|
||||
function(runner, t)
|
||||
if t.checksum:
|
||||
|
||||
Reference in New Issue
Block a user