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

def Hellanzb::Daemon::handleNZBDone (   nzb  ) 

Hand-off from the downloader -- make a dir for the NZB with its contents, then post
process it in a separate thread

Definition at line 293 of file Daemon.py.

00293                       :
    """ Hand-off from the downloader -- make a dir for the NZB with its contents, then post
    process it in a separate thread"""
    downloadTime = 0
    # Print download statistics when something was downloaded (have an
    # nzb.downloadStartTime). Otherwise we might have simply parsed the NZB and found the
    # archive was assembled (required no downloading)
    if nzb.downloadStartTime:
        downloadTime = time.time() - nzb.downloadStartTime
        speed = nzb.totalReadBytes / 1024.0 / downloadTime
        
        # NOTE: This is now the total time to transfer & fully decode the archive, as
        # opposed to how long to just transfer (which this used to be)
        info('Transferred %s in %s at %.1fKB/s (%s)' % \
             (prettySize(nzb.totalReadBytes), prettyElapsed(downloadTime), speed,
              nzb.archiveName))

    if not nzb.isParRecovery:
        nzb.downloadTime = downloadTime
    else:
        nzb.downloadTime += downloadTime
    
    # Make our new directory, minus the .nzb
    processingDir = Hellanzb.PROCESSING_DIR + nzb.archiveName
    
    # Grab the message id, we'll store it in the processingDir for later use
    msgId = getMsgId(nzb.nzbFileName)

    # Move our nzb contents to their new location for post processing
    hellaRename(processingDir)
        
    move(Hellanzb.WORKING_DIR, processingDir)
    nzb.destDir = processingDir
    nzb.archiveDir = processingDir
    
    move(nzb.nzbFileName, processingDir)
    nzb.nzbFileName = os.path.join(processingDir, nzb.nzbFileName)

    if msgId:
        touch(os.path.join(processingDir, '.msgid_' + msgId))
    
    os.mkdir(Hellanzb.WORKING_DIR)

    # The list of skipped pars is maintained in the state XML as only the subjects of the
    # nzbFiles. PostProcessor only knows to look at the NZB.skippedParSubjects list,
    # created here
    nzb.skippedParSubjects = nzb.getSkippedParSubjects()

    # Finally unarchive/process the directory in another thread, and continue
    # nzbing
    troll = PostProcessor.PostProcessor(nzb)

    # Give NZBLeecher some time (another reactor loop) to killHistory() & scrollEnd()
    # without any logging interference from PostProcessor
    reactor.callLater(0, troll.start)
    reactor.callLater(0, writeStateXML)
    reactor.callLater(0, scanQueueDir)

def postProcess(options, isQueueDaemon = False):


Generated by  Doxygen 1.6.0   Back to index