本文整理汇总了Python中BaseLib.Core.BitTornado.BT1.PiecePicker.PiecePicker.next方法的典型用法代码示例。如果您正苦于以下问题:Python PiecePicker.next方法的具体用法?Python PiecePicker.next怎么用?Python PiecePicker.next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseLib.Core.BitTornado.BT1.PiecePicker.PiecePicker
的用法示例。
在下文中一共展示了PiecePicker.next方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: next
# 需要导入模块: from BaseLib.Core.BitTornado.BT1.PiecePicker import PiecePicker [as 别名]
# 或者: from BaseLib.Core.BitTornado.BT1.PiecePicker.PiecePicker import next [as 别名]
def next(self, haves, wantfunc, sdownload, complete_first = False, helper_con = False, slowpieces=[], willrequest=True,connection=None,proxyhave=None):
def newwantfunc( piece ):
#print >>sys.stderr,time.asctime(),'-', "S",self.streaming_piece_filter( piece ),"!sP",not (piece in slowpieces),"w",wantfunc( piece )
return not (piece in slowpieces) and wantfunc( piece )
# fallback: original piece picker
p = PiecePicker.next(self, haves, newwantfunc, sdownload, complete_first, helper_con, slowpieces=slowpieces, willrequest=willrequest,connection=connection)
if DEBUGPP and self.videostatus.prebuffering:
print >>sys.stderr,time.asctime(),'-', "PiecePickerStreaming: original PP.next returns",p
if p is None and not self.videostatus.live_streaming:
# When the file we selected from a multi-file torrent is complete,
# we won't request anymore pieces, so the normal way of detecting
# we're done is not working and we won't tell the video player
# we're playable. Do it here instead.
self.transporter.notify_playable()
return p