Beispiel #1
0
def main():
    try:
        setup()
        process()
    except Exception as e:
        logging.error("Uncaught exception. Message: %s. How sad.", str(e))
        logging.error("Stack trace:\n%s", utils.print_stack_trace())
Beispiel #2
0
def process():
    global warnings
    while True:

        warnings.seek(0)
        warnings.truncate(0)

        logging.info("Started checking!")
        scanned = scan_incoming()
        if not is_something_new(scanned):
            logging.info("Apparently nothing is new.")
        else:
            copy_all(scanned)
        try:
            upload_all()
        except smugmug.SmugmugException as e:
            logging.error("Smugmug gave us an exception. Response: %s.",
                    e.response)
            logging.error("Stack trace:\n%s", utils.print_stack_trace())
        logging.info("We are done. :-)")

        warnings.seek(0)
        warnings_logged = warnings.read()
        if warnings_logged:
            logging.info("There were some warnings logged. Notifying.")
            notify_warnings(warnings_logged)

        if "--repeat" not in sys.argv:
            break
        reload(config)
        time.sleep(config.CHECK_INTERVAL)