From 9c70b260a684b3c81e50780ee31a2fda2c100033 Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 27 Jan 2012 17:31:10 -0500 Subject: [PATCH] Added support for channels, changed samplerate so it doesn't return if doesn't exist. Made bitdepth only return if exists, looks like only mp4, flac and ape support bitdepth. --- beets/mediafile.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/beets/mediafile.py b/beets/mediafile.py index 4fde82ae0..9be8f2485 100644 --- a/beets/mediafile.py +++ b/beets/mediafile.py @@ -950,9 +950,6 @@ class MediaFile(object): # Reasonably sure from checking mutagen source that all # formats will return this information return self.mgfile.info.sample_rate - else: - # Return and empty string, _if_ this ever happens - return '' @property def bitdepth(self): @@ -961,6 +958,13 @@ class MediaFile(object): # formats will return this information return self.mgfile.info.bits_per_sample + @property + def channels(self): + if hasattr(self.mgfile.info, 'channels'): + # Reasonably sure from checking mutagen source that all + # formats will return this information + return self.mgfile.info.channels + @property def bitrate(self): if hasattr(self.mgfile.info, 'bitrate'):