From 72659975a2c800e2a8fc840f575b90e5fbd0e9ff Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Thu, 9 Feb 2012 12:05:57 -0800 Subject: [PATCH] bitrate for AAC files falls back to estimation Apparently, info.bitrate can be zero for AAC files when the information is not available in the header. MediaFile now falls back to estimation when this is true. --- beets/mediafile.py | 2 +- docs/changelog.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/beets/mediafile.py b/beets/mediafile.py index 8f733ccbd..0ff1239ec 100644 --- a/beets/mediafile.py +++ b/beets/mediafile.py @@ -985,7 +985,7 @@ class MediaFile(object): imprecision is possible because the file header is incorporated in the file size. """ - if hasattr(self.mgfile.info, 'bitrate'): + if hasattr(self.mgfile.info, 'bitrate') and self.mgfile.info.bitrate: # Many formats provide it explicitly. return self.mgfile.info.bitrate else: diff --git a/docs/changelog.rst b/docs/changelog.rst index f821ea13a..9cd3cdba5 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -36,6 +36,8 @@ Changelog "OR" (upper case). * Fix an error in the ``rewrite`` and ``inline`` plugins when the corresponding config sections did not exist. +* Fix bitrate estimation for AAC files whose headers are missing the relevant + data. 1.0b12 (January 16, 2012) -------------------------