tag.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:eyeD3 作者: nicfit 项目源码 文件源码
def _getBpm(self):
        from decimal import Decimal, ROUND_HALF_UP, InvalidOperation

        bpm = None
        if frames.BPM_FID in self.frame_set:
            bpm_str = self.frame_set[frames.BPM_FID][0].text or u"0"
            try:
                # Round floats since the spec says this is an integer. Python3
                # changed how 'round' works, hence the using of decimal
                bpm = int(Decimal(bpm_str).quantize(1, ROUND_HALF_UP))
            except (InvalidOperation, ValueError) as ex:
                log.warning(ex)
        return bpm
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号