hlswriter.py 文件源码

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

项目:plugin.video.brplay 作者: olavopeixoto 项目源码 文件源码
def __find_bandwidth_index(self, playlist, average_download_speed, safe_ratio=1.0):
        if not playlist.is_variant:
            return 0

        bandwidth_options = []
        for index, playlist_item in enumerate(playlist.playlists):
            bandwidth_options.append({
                'index': index,
                'bandwidth': float(playlist.playlists[index].stream_info.bandwidth)
            })
        bandwidth_options = sorted(bandwidth_options, key=lambda k: int(k['bandwidth']), reverse=True)

        for bandwidth_option in bandwidth_options:
            if bandwidth_option['bandwidth'] * safe_ratio < average_download_speed:
                log("SELECTED BANDWIDTH: %s" % bandwidth_option['bandwidth'])
                return bandwidth_option['index']

        return 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号