download.py 文件源码

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

项目:FMoviesPlus.bundle 作者: coder-alpha 项目源码 文件源码
def DownloadThrottlerThread(self):
        while self.threadRun:
            time.sleep(self.updateTime)

            tot_down_size_KB = float(sum(self.DOWNLOAD_RATE_LIMIT_BUFFER)/1024.0)
            download_speed_limit_KBps = float(Prefs['download_speed_limit'])
            if tot_down_size_KB > 0 and download_speed_limit_KBps > 0:
                tot_down_speed_KBps = round(float(tot_down_size_KB/self.updateTime), 3)
                if Prefs['use_debug']:
                    Log('Download Throttler:---> Timestamp:%s | Total Down Speed: %s KB/s | Speed Limit: %s KB/s' % (time.time(), tot_down_speed_KBps, download_speed_limit_KBps))

                if tot_down_speed_KBps > download_speed_limit_KBps:
                    self.throttle = True
                    self.throttleStateSleepTime = round(tot_down_speed_KBps/download_speed_limit_KBps,3)
                    if Prefs['use_debug']:
                        Log("Download Throttler:---> Sleep for %s sec." % self.throttleStateSleepTime)
                    time.sleep(self.throttleStateSleepTime)

            self.reset()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号