示例#1
0
def initNZBLeecher():
    """ Init """
    # Note what version of twisted/python/os being used
    twistedVersionMsg = "Using: Twisted-%s" % twistedVersion
    if twistedVersion >= "2.0.0":
        from twisted.web import __version__ as twistedWebVersion

        twistedVersionMsg += ", TwistedWeb-%s" % twistedWebVersion
    debug(twistedVersionMsg)
    pythonVersion = "python: %s" % sys.version
    [debug(line) for line in pythonVersion.splitlines()]
    if isWindows():
        debug("platform: %s" % sys.platform)
    else:
        uname = os.uname()
        debug("os: %s-%s (%s)" % (uname[0], uname[2], uname[4]))

    # Create the one and only download queue
    if initFillServers():
        Hellanzb.queue = FillServerQueue()
    else:
        Hellanzb.queue = NZBSegmentQueue()

    # The NZBLeecherFactories
    Hellanzb.nsfs = []
    Hellanzb.totalSpeed = 0
    Hellanzb.totalArchivesDownloaded = 0
    Hellanzb.totalFilesDownloaded = 0
    Hellanzb.totalSegmentsDownloaded = 0
    Hellanzb.totalBytesDownloaded = 0

    # this class handles updating statistics via the SCROLL level (the UI)
    Hellanzb.scroller = NZBLeecherTicker()

    Hellanzb.ht = HellaThrottler(Hellanzb.MAX_RATE * 1024)
    Hellanzb.getCurrentRate = NZBLeecherFactory.getCurrentRate

    # loop to scan the queue dir during download
    Hellanzb.downloadScannerID = None

    ACODE = Hellanzb.ACODE
    Hellanzb.NZBLF_COLORS = [
        ACODE.F_DBLUE,
        ACODE.F_DMAGENTA,
        ACODE.F_LRED,
        ACODE.F_DGREEN,
        ACODE.F_YELLOW,
        ACODE.F_DCYAN,
        ACODE.F_BWHITE,
    ]
示例#2
0
def initNZBLeecher():
    """ Init """
    # Note what version of twisted/python/os being used
    twistedVersionMsg = 'Using: Twisted-%s' % twistedVersion
    if twistedVersion >= '2.0.0':
        from twisted.web import __version__ as twistedWebVersion
        twistedVersionMsg += ', TwistedWeb-%s' % twistedWebVersion
    debug(twistedVersionMsg)
    pythonVersion = 'python: %s' % sys.version
    [debug(line) for line in pythonVersion.splitlines()]
    if isWindows():
        debug('platform: %s' % sys.platform)
    else:
        uname = os.uname()
        debug('os: %s-%s (%s)' % (uname[0], uname[2], uname[4]))

    # Create the one and only download queue
    if initFillServers():
        Hellanzb.queue = FillServerQueue()
    else:
        Hellanzb.queue = NZBSegmentQueue()

    # The NZBLeecherFactories
    Hellanzb.nsfs = []
    Hellanzb.totalSpeed = 0
    Hellanzb.totalArchivesDownloaded = 0
    Hellanzb.totalFilesDownloaded = 0
    Hellanzb.totalSegmentsDownloaded = 0
    Hellanzb.totalBytesDownloaded = 0

    # this class handles updating statistics via the SCROLL level (the UI)
    Hellanzb.scroller = NZBLeecherTicker()

    Hellanzb.ht = HellaThrottler(Hellanzb.MAX_RATE * 1024)
    Hellanzb.getCurrentRate = NZBLeecherFactory.getCurrentRate

    # loop to scan the queue dir during download
    Hellanzb.downloadScannerID = None

    ACODE = Hellanzb.ACODE
    Hellanzb.NZBLF_COLORS = [
        ACODE.F_DBLUE, ACODE.F_DMAGENTA, ACODE.F_LRED, ACODE.F_DGREEN,
        ACODE.F_YELLOW, ACODE.F_DCYAN, ACODE.F_BWHITE
    ]
示例#3
0
        shutdownAndExit(1)

    reactor.callLater(0, info, "hellanzb - Now monitoring queue...")
    reactor.callLater(0, notify, "Queue", "hellanzb", "Now monitoring queue..", False)
    # Twisted does not guarantee callLater(0, first); callLater(0, second) will run in
    # that order: http://twistedmatrix.com/trac/ticket/1396
    # This is especially problematic on some platforms (cygwin):
    # http://hellanzb.com/trac/hellanzb/ticket/196
    def recoverStateAndBegin():
        recoverStateFromDisk()
        resumePostProcessors()
        scanQueueDir(True)

    reactor.callLater(0, recoverStateAndBegin)

    if not isWindows() and Hellanzb.DAEMONIZE:
        daemonize()

    if not isWindows() and hasattr(Hellanzb, "UMASK"):
        # umask here, as daemonize() might have just reset the value
        os.umask(Hellanzb.UMASK)

    if hasattr(Hellanzb, "HELLAHELLA_CONFIG"):
        initHellaHella(Hellanzb.HELLAHELLA_CONFIG)

    from Hellanzb.NZBLeecher import initNZBLeecher, startNZBLeecher

    initNZBLeecher()
    startNZBLeecher()

示例#4
0
        from Hellanzb.Core import shutdownAndExit
        shutdownAndExit(1)

    reactor.callLater(0, info, 'hellanzb - Now monitoring queue...')
    reactor.callLater(0, notify, 'Queue', 'hellanzb', 'Now monitoring queue..', False)
    # Twisted does not guarantee callLater(0, first); callLater(0, second) will run in
    # that order: http://twistedmatrix.com/trac/ticket/1396
    # This is especially problematic on some platforms (cygwin):
    # http://hellanzb.com/trac/hellanzb/ticket/196
    def recoverStateAndBegin():
        recoverStateFromDisk()
        resumePostProcessors()
        scanQueueDir(True)
    reactor.callLater(0, recoverStateAndBegin)

    if not isWindows() and Hellanzb.DAEMONIZE:
        daemonize()

    if not isWindows() and hasattr(Hellanzb, 'UMASK'):
        # umask here, as daemonize() might have just reset the value
        os.umask(Hellanzb.UMASK)

    if hasattr(Hellanzb, 'HELLAHELLA_CONFIG'):
        initHellaHella(Hellanzb.HELLAHELLA_CONFIG)
    
    from Hellanzb.NZBLeecher import initNZBLeecher, startNZBLeecher
    initNZBLeecher()
    startNZBLeecher()

def initHellaHella(configFile, verbose=False):
    """ Initialize hellahella, the web UI """