Пример #1
0
def main():
    """
    We need to check to make sure the script can run in the provided
    environment and that certain status checks have occurred. All of the
    calls here will exit with an exit code if the check fails.
    """
    try:
        # If the script state was set to Disabled, we don't need to run.
        if SCRIPT_STATE == 'Disabled':
            nzb.exit(nzb.PROCESS_SUCCESS)

        # Check the version NZBGet we're running on.
        nzb.check_nzb_version(13.0)

        nzb.log_info('CURRENT EVENT: %s' % nzb.get_nzb_event())

        # Wire up your event handlers before the call.
        # User the form nzb.set_handler(<event>, <function>)
        nzb.set_handler('FILE_DOWNLOADED', on_file_downloaded)
        nzb.set_handler('NZB_ADDED', on_nzb_added)
        nzb.set_handler('NZB_DOWNLOADED', on_nzb_downloaded)
        nzb.set_handler('POST_PROCESSING', on_post_processing)
        nzb.set_handler('QUEUEING', on_queueing)
        nzb.set_handler('SCANNING', on_scanning)
        nzb.set_handler('SCHEDULED', on_scheduled)

        # Do not change this line, it checks the current event
        # and executes any event handlers.
        nzb.execute()
    except Exception as e:
        traceback.print_exc()
        nzb.exit(nzb.PROCESS_ERROR, e)

    nzb.exit(nzb.PROCESS_SUCCESS)
Пример #2
0
def main():
    """
    We need to check to make sure the script can run in the provided
    environment and that certain status checks have occurred. All of the
    calls here will exit with an exit code if the check fails.
    """
    try:
        # If the script state was set to Disabled, we don't need to run.
        if SCRIPT_STATE == 'Disabled':
            nzb.exit(nzb.PROCESS_SUCCESS)

        # Check the version NZBGet we're running on.
        nzb.check_nzb_version(13.0)

        nzb.log_info('CURRENT EVENT: %s' % nzb.get_nzb_event())

        # Wire up your event handlers before the call.
        # User the form nzb.set_handler(<event>, <function>)
        nzb.set_handler('FILE_DOWNLOADED', on_file_downloaded)
        nzb.set_handler('NZB_ADDED', on_nzb_added)
        nzb.set_handler('NZB_DOWNLOADED', on_nzb_downloaded)
        nzb.set_handler('POST_PROCESSING', on_post_processing)
        nzb.set_handler('QUEUEING', on_queueing)
        nzb.set_handler('SCANNING', on_scanning)
        nzb.set_handler('SCHEDULED', on_scheduled)

        # Do not change this line, it checks the current event
        # and executes any event handlers.
        nzb.execute()
    except Exception as e:
        traceback.print_exc()
        nzb.exit(nzb.PROCESS_ERROR, e)

    nzb.exit(nzb.PROCESS_SUCCESS)
Пример #3
0
def main():
    """
    We need to check to make sure the script can run in the provided
    environment and that certain status checks have occurred. All of the
    calls here will exit with an exit code if the check fails.
    """
    try:
        # If the script state was set to Disabled, we don't need to run.
        if SCRIPT_STATE == "Disabled":
            nzb.exit(nzb.PROCESS_SUCCESS)

        # Check version of NZBGet to make sure we can run.
        nzb.check_nzb_version(13.0)

        # Wire up your event handlers before the call.
        # Use the form nzb.set_handler(<event>, <function>)
        nzb.set_handler("POST_PROCESSING", on_post_processing)
        nzb.set_handler("SCHEDULED", on_scheduled)

        # Do not change this line, it checks the current event
        # and executes any event handlers.
        nzb.execute()
    except Exception as e:
        traceback.print_exc()
        nzb.exit(nzb.PROCESS_ERROR, e)
Пример #4
0
def main():
    """
    We need to check to make sure the script can run in the provided
    environment and that certain status checks have occurred. All of the
    calls here will exit with an exit code if the check fails.
    """
    try:
        # If the script state was set to Disabled, we don't need to run.
        if SCRIPT_STATE == 'Disabled':
            nzb.exit(nzb.PROCESS_SUCCESS)

        # Determine if we have features enabled.
        DiscImageEnabled = REJECT_DISC_IMAGES != 'Disabled'
        FakeCheckEnabled = REJECT_FAKES != 'Disabled'
        PasswordCheckEnabled = REJECT_PASSWORD != 'Disabled'
        if not (DiscImageEnabled and FakeCheckEnabled and PasswordCheckEnabled):
            nzb.log_info('No features enabled. Skipping script execution.')
            nzb.exit(nzb.PROCESS_SUCCESS)

        # Check version of NZBGet to make sure we can run.
        nzb.check_nzb_version(13.0)

        # Wire up your event handlers before the call.
        # Use the form nzb.set_handler(<event>, <function>)
        nzb.set_handler('FILE_DOWNLOADED', on_file_downloaded)
        nzb.set_handler('NZB_ADDED', on_nzb_added)
        nzb.set_handler('NZB_DOWNLOADED', on_nzb_downloaded)

        # Do not change this line, it checks the current event
        # and executes any event handlers.
        nzb.execute()
    except Exception as e:
        traceback.print_exc()
        nzb.exit(nzb.PROCESS_ERROR, e)
        clean_up()
Пример #5
0
def main():
    """
    We need to check to make sure the script can run in the provided
    environment and that certain status checks have occurred. All of the
    calls here will exit with an exit code if the check fails.
    """
    try:
        # If the script state was set to Disabled, we don't need to run.
        if SCRIPT_STATE == 'Disabled':
            nzb.exit(nzb.PROCESS_SUCCESS)

        # Check version of NZBGet to make sure we can run.
        nzb.check_nzb_version(13.0)

        # Wire up your event handlers before the call.
        # Use the form nzb.set_handler(<event>, <function>)
        nzb.set_handler('POST_PROCESSING', on_post_processing)
        nzb.set_handler('SCHEDULED', on_scheduled)

        # Do not change this line, it checks the current event
        # and executes any event handlers.
        nzb.execute()
    except Exception as e:
        traceback.print_exc()
        nzb.exit(nzb.PROCESS_ERROR, e)
Пример #6
0
def main():
    """
    We need to check to make sure the script can run in the provided
    environment and that certain status checks have occurred. All of the
    calls here will exit with an exit code if the check fails.
    """
    try:
        # If the script state was set to Disabled, we don't need to run.
        if SCRIPT_STATE == 'Disabled':
            nzb.exit(nzb.PROCESS_SUCCESS)

        # Determine if we have features enabled.
        DiscImageEnabled = REJECT_DISC_IMAGES != 'Disabled'
        FakeCheckEnabled = REJECT_FAKES != 'Disabled'
        PasswordCheckEnabled = REJECT_PASSWORD != 'Disabled'
        if not (DiscImageEnabled and FakeCheckEnabled
                and PasswordCheckEnabled):
            nzb.log_info('No features enabled. Skipping script execution.')
            nzb.exit(nzb.PROCESS_SUCCESS)

        # Check version of NZBGet to make sure we can run.
        nzb.check_nzb_version(13.0)

        # Wire up your event handlers before the call.
        # Use the form nzb.set_handler(<event>, <function>)
        nzb.set_handler('FILE_DOWNLOADED', on_file_downloaded)
        nzb.set_handler('NZB_ADDED', on_nzb_added)
        nzb.set_handler('NZB_DOWNLOADED', on_nzb_downloaded)

        # Do not change this line, it checks the current event
        # and executes any event handlers.
        nzb.execute()
    except Exception as e:
        traceback.print_exc()
        nzb.exit(nzb.PROCESS_ERROR, e)
        clean_up()