本文整理匯總了Python中Tribler.Core.BitTornado.BT1.PiecePicker.PiecePicker.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python PiecePicker.__init__方法的具體用法?Python PiecePicker.__init__怎麽用?Python PiecePicker.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Tribler.Core.BitTornado.BT1.PiecePicker.PiecePicker
的用法示例。
在下文中一共展示了PiecePicker.__init__方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from Tribler.Core.BitTornado.BT1.PiecePicker import PiecePicker [as 別名]
# 或者: from Tribler.Core.BitTornado.BT1.PiecePicker.PiecePicker import __init__ [as 別名]
def __init__(self, numpieces,
rarest_first_cutoff = 1, rarest_first_priority_cutoff = 3,
priority_step = 20, piecesize = 0):
PiecePicker.__init__( self, numpieces, rarest_first_cutoff, rarest_first_priority_cutoff,
priority_step)
# maximum existing piece number, to avoid scanning beyond it in next()
self.maxhave = 0
# some statistics
self.stats = {}
self.stats["high"] = 0
self.stats["mid"] = 0
self.stats["low"] = 0
# playback module
self.transporter = None
# self.outstanding_requests contains (piece-id, begin,
# length):timestamp pairs for each outstanding request.
self.outstanding_requests = {}
# The playing_delay and buffering_delay give three values
# (min, max, offeset) in seconds.
#
# The min tells how long before the cancel policy is allowed
# to kick in. We can not expect to receive a piece instantly,
# so we have to wait this time before having a download speed
# estimation.
#
# The max tells how long before we cancel the request. The
# request may also be canceled because the chunk will not be
# completed given the current download speed.
#
# The offset gives a grace period that is taken into account
# when choosing to cancel a request. For instance, when the
# peer download speed is too low to receive the chunk within 10
# seconds, a grace offset of 15 would ensure that the chunk is
# NOT canceled (useful while buffering)
self.playing_delay = (5, 20, -0.5)
self.buffering_delay = (7.5, 30, 10)
# Arno, 2010-04-20: STBSPEED: is_interesting is now a variable.
self.is_interesting = self.is_interesting_normal
示例2: __init__
# 需要導入模塊: from Tribler.Core.BitTornado.BT1.PiecePicker import PiecePicker [as 別名]
# 或者: from Tribler.Core.BitTornado.BT1.PiecePicker.PiecePicker import __init__ [as 別名]
def __init__(self, numpieces,
rarest_first_cutoff = 1, rarest_first_priority_cutoff = 3,
priority_step = 20, helper = None, rate_predictor = None, piecesize = 0):
PiecePicker.__init__( self, numpieces, rarest_first_cutoff, rarest_first_priority_cutoff,
priority_step, helper, rate_predictor )
self.videostatus = None
# maximum existing piece number, to avoid scanning beyond it in next()
self.maxhave = 0
# some statistics
self.stats = {}
self.stats["high"] = 0
self.stats["mid"] = 0
self.stats["low"] = 0
# playback module
self.transporter = None
# video speed in bytes/s
self.outstanding = {}
# Piece timeout policy parameters
"""
minprebufspeed = 10.0 # KB/s
self.PIECETIME = piecesize/(minprebufspeed*1024.0)
self.MAXDLTIME=2.0*self.PIECETIME
self.MAXDLTIME_NONPREBUF=4.0*self.PIECETIME
"""
# Works for 32KB pieces, like vuze.com
self.PIECETIME = 10.0
self.MAXDLTIME = 20.0
self.MAXDLTIME_NONPREBUF=30.0
"""