read-only metadata (length & bitrate) support for ogg and ape

This commit is contained in:
Adrian Sampson 2010-06-26 11:01:48 -07:00
parent cd9cfbe6fc
commit 4be6edab7b
2 changed files with 13 additions and 1 deletions

View file

@ -589,7 +589,9 @@ class MediaFile(object):
@property
def bitrate(self):
if self.type == 'flac':
if self.type in ('flac', 'ape'):
# Simulate bitrate for lossless formats.
#fixme: The utility of this guess is questionable.
return self.mgfile.info.sample_rate * \
self.mgfile.info.bits_per_sample
else:

View file

@ -207,6 +207,16 @@ read_only_correct_dicts = {
'length': 1.0,
'bitrate': 64000,
},
'full.ogg': {
'length': 1.0,
'bitrate': 48000,
},
'full.ape': {
'length': 1.0,
'bitrate': 705600,
},
}