def next(self, haves, wantfunc, sdownload, complete_first=False, helper_con=False, slowpieces=[], willrequest=True, connection=None): def newwantfunc(piece): #print >>sys.stderr,"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, "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
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