Logo Search packages:      
Sourcecode: hellanzb version File versions  Download package

def Hellanzb::NZBLeecher::NZBSegmentQueue::NZBSegmentQueue::segmentDone (   self,
  nzbSegment,
  dequeue = False 
)

Simply decrement the queued byte count and register this nzbSegment as finished
downloading, unless the segment is part of a postponed download 

Definition at line 468 of file NZBSegmentQueue.py.

00468                                                       :
        """ Simply decrement the queued byte count and register this nzbSegment as finished
        downloading, unless the segment is part of a postponed download """
        # NOTE: old code locked here: but this block should only contend with itself (only
        # called from the ArticleDecoder) ArticleDecoder thread (only segmentDone() and
        # isAllSegmentsDecoded() touches todoNzbSegments, dequeuedSegments,
        # totalQueuedBytes?
        self.nzbsLock.acquire()
        if nzbSegment in nzbSegment.nzbFile.todoNzbSegments:
            nzbSegment.nzbFile.todoNzbSegments.remove(nzbSegment)
            if dequeue:
                nzbSegment.nzbFile.dequeuedSegments.add(nzbSegment)
                debug('segmentDone: dequeued: %s %i' % (nzbSegment.nzbFile.subject,
                                                        nzbSegment.number))
            elif nzbSegment in nzbSegment.nzbFile.dequeuedSegments:
                # NOTE: this should really never occur
                # need this elif?
                debug('*** segmentDone called on dequeued nzbSegment -- removing from '
                      'nzbFile.dequeuedSegments!')
                nzbSegment.nzbFile.dequeuedSegments.remove(nzbSegment)
            if nzbSegment.nzbFile.nzb in self.nzbs:
                self.totalQueuedBytes -= nzbSegment.bytes
        self.nzbsLock.release()
        
        if not dequeue:
            # NOTE: currently don't have to lock -- only the ArticleDecoder thread (via
            # ->handleDupeNZBSegment->isBeingDownloaded) reads onDiskSegments
            self.onDiskSegments[nzbSegment.getDestination()] = nzbSegment
            
            if nzbSegment.isFirstSegment():
                nzbSegment.nzbFile.nzb.firstSegmentsDownloaded += 1

    def isBeingDownloadedFile(self, segmentFilename):


Generated by  Doxygen 1.6.0   Back to index