示例#1
0
def requeueSkippedPars(skippedParFiles):
    """ Requeue previously skipped par NZBFiles """
    for nzbFile in skippedParFiles:
        nzbFile.isSkippedPar = False
        nzbFile.nzb.skippedParFiles.remove(nzbFile)

        # Requeue only segments that were actually dequeued
        for nzbSegment in nzbFile.dequeuedSegments:
            nzbFile.todoNzbSegments.add(nzbSegment)
            Hellanzb.queue.put((nzbSegment.priority, nzbSegment))
            Hellanzb.queue.addQueuedBytes(nzbSegment.bytes)
            nzbFile.nzb.totalSkippedBytes -= nzbSegment.bytes

            # In case we have idle NZBLeechers, turn them back on
            if inMainThread():
                Hellanzb.queue.nudgeIdleNZBLeechers(nzbSegment)
            else:
                reactor.callFromThread(Hellanzb.queue.nudgeIdleNZBLeechers, nzbSegment)

        nzbFile.dequeuedSegments.clear()
示例#2
0
def requeueSkippedPars(skippedParFiles):
    """ Requeue previously skipped par NZBFiles """
    for nzbFile in skippedParFiles:
        nzbFile.isSkippedPar = False
        nzbFile.nzb.skippedParFiles.remove(nzbFile)

        # Requeue only segments that were actually dequeued
        for nzbSegment in nzbFile.dequeuedSegments:
            nzbFile.todoNzbSegments.add(nzbSegment)
            Hellanzb.queue.put((nzbSegment.priority, nzbSegment))
            Hellanzb.queue.addQueuedBytes(nzbSegment.bytes)
            nzbFile.nzb.totalSkippedBytes -= nzbSegment.bytes

            # In case we have idle NZBLeechers, turn them back on
            if inMainThread():
                Hellanzb.queue.nudgeIdleNZBLeechers(nzbSegment)
            else:
                reactor.callFromThread(Hellanzb.queue.nudgeIdleNZBLeechers,
                                       nzbSegment)

        nzbFile.dequeuedSegments.clear()
示例#3
0
        backedUp = False
        if os.path.exists(file):
            move(file, file + ".bak")
            backedUp = True

        outFile = open(file, "wb")
        _writeStateXML(outFile)
        try:
            outFile.close()
        except IOError, ioe:
            if ioe.errno == 28:
                error("Unable to write STATE_XML_FILE: No space left on device")
                if backedUp:
                    move(file + ".bak", file)

    if inMainThread():
        backupThenWrite()
    else:
        reactor.callFromThread(backupThenWrite)


Hellanzb.writeStateXML = writeStateXML


def parseNZB(nzb, notification="Downloading", quiet=False):
    """ Parse the NZB file into the Queue. Unless the NZB file is deemed already fully
    processed at the end of parseNZB, tell the factory to start downloading it """
    if not quiet:
        info(notification + ": " + nzb.archiveName)
        notify("Queue", "hellanzb " + notification + ":", nzb.archiveName, False)
示例#4
0
        if os.path.exists(file):
            move(file, file + '.bak')
            backedUp = True

        outFile = open(file, 'wb')
        _writeStateXML(outFile)
        try:
            outFile.close()
        except IOError, ioe:
            if ioe.errno == 28:
                error(
                    'Unable to write STATE_XML_FILE: No space left on device')
                if backedUp:
                    move(file + '.bak', file)

    if inMainThread():
        backupThenWrite()
    else:
        reactor.callFromThread(backupThenWrite)


Hellanzb.writeStateXML = writeStateXML


def parseNZB(nzb, notification='Downloading', quiet=False):
    """ Parse the NZB file into the Queue. Unless the NZB file is deemed already fully
    processed at the end of parseNZB, tell the factory to start downloading it """
    if not quiet:
        info(notification + ': ' + nzb.archiveName)
        notify('Queue', 'hellanzb ' + notification + ':', nzb.archiveName,
               False)