mirror of
https://github.com/beetbox/beets.git
synced 2026-01-17 05:34:23 +01:00
parent
d3f0742276
commit
0c164a93e0
1 changed files with 13 additions and 8 deletions
|
|
@ -1340,15 +1340,20 @@ class MediaFile(object):
|
|||
raise FileTypeError(path)
|
||||
elif (type(self.mgfile).__name__ == 'M4A' or
|
||||
type(self.mgfile).__name__ == 'MP4'):
|
||||
# This hack differentiates AAC and ALAC until we find a more
|
||||
# deterministic approach. Mutagen only sets the bitrate
|
||||
# for AAC files. See:
|
||||
# https://github.com/sampsyo/beets/pull/295
|
||||
if hasattr(self.mgfile.info, 'bitrate') and \
|
||||
self.mgfile.info.bitrate > 0:
|
||||
self.type = 'aac'
|
||||
if hasattr(self.mgfile.info, 'codec'):
|
||||
if self.mgfile.codec and self.mgfile.codec.startswith('alac'):
|
||||
self.type = 'alac'
|
||||
else:
|
||||
self.type = 'aac'
|
||||
else:
|
||||
self.type = 'alac'
|
||||
# This hack differentiates AAC and ALAC on versions of
|
||||
# Mutagen < 1.26. Once Mutagen > 1.26 is out and
|
||||
# required by beets, we can remove this.
|
||||
if hasattr(self.mgfile.info, 'bitrate') and \
|
||||
self.mgfile.info.bitrate > 0:
|
||||
self.type = 'aac'
|
||||
else:
|
||||
self.type = 'alac'
|
||||
elif (type(self.mgfile).__name__ == 'ID3' or
|
||||
type(self.mgfile).__name__ == 'MP3'):
|
||||
self.type = 'mp3'
|
||||
|
|
|
|||
Loading…
Reference in a new issue