示例#1
0
def handle_successful_upload():
    """Make all necessary steps after a successful upload.  This encompasses:

    1. Creation of an GitHub issue.
    2. Synchronisation of the ownCloud directory.
    3. Sending of a success email to the uploader.
    """
    issue_link = sync_with_github()
    send_success_email(issue_link)
    owncloud.sync()
示例#2
0
def handle_successful_upload():
    """Make all necessary steps after a successful upload.  This encompasses:

    1. Creation of an GitHub issue.
    2. Synchronisation of the ownCloud directory.
    3. Sending of a success email to the uploader.
    """
    issue_link = sync_with_github()
    send_success_email(issue_link)
    owncloud.sync()
示例#3
0
def write_result_and_exit(error, missing_data=[]):
    """Write ``result.json``, send mail to the uploader, and terminate this
    program.

    :param error: error message for the uploader; ``None`` if no error
      occurred.
    :param missing_data: files for which no EXIF lens data could be determined.

    :type error: str or NoneType
    :type missing_data: list of (str, str or NoneType, float or NoneType, float
      or NoneType)
    """
    result = (error, missing_data)
    json.dump(result, open(os.path.join(directory, "result.json"), "w"), ensure_ascii=True)
    if any(result):
        send_error_email()
    else:
        issue_link = sync_with_github()
        send_success_email(issue_link)
        owncloud.sync()
    sys.exit()
示例#4
0
            uploader_email,
            "Your calibration upload {} has been processed".format(
                upload_hash), body)
    if config["General"].get("archive_path"):
        destination = config["General"]["archive_path"]
        if label is not successful_label:
            destination = os.path.join(
                destination, "unusable_" + os.path.basename(upload_path))
        shutil.move(upload_path, destination)
    issue.edit(state="closed")


def close_github_issues():
    for label in (successful_label, unsuccessful_label,
                  unsuccessful_no_mail_label):
        for issue in lensfun.get_issues(
                state="all", labels=[calibration_request_label, label]):
            try:
                process_issue(issue, label)
            except (OriginatorFileNotReadable, OSError) as error:
                issue.create_comment(str(error))


db_was_updated = update_git_repository()
if db_was_updated:
    xml_files, timestamp = fetch_xml_files()
    generate_database_tarballs(xml_files, timestamp)
owncloud.sync()
close_github_issues()
owncloud.sync()
示例#5
0
        body = body.format("")
    send_email(uploader_email, "Your calibration upload {} has been processed".format(upload_hash), body)
    if config["General"].get("archive_path"):
        destination = config["General"]["archive_path"]
        if not successful:
            destination = os.path.join(destination, "unusable_" + os.path.basename(upload_path))
        shutil.move(upload_path, destination)
    issue.edit(state="closed")


def close_github_issues():
    for issue in lensfun.get_issues(state="", labels=[calibration_request_label, successful_label]):
        try:
            process_issue(issue, successful=True)
        except (OriginatorFileNotReadable, OSError) as error:
            issue.create_comment(str(error))
    for issue in lensfun.get_issues(state="", labels=[calibration_request_label, unsuccessful_label]):
        try:
            process_issue(issue, successful=False)
        except (OriginatorFileNotReadable, OSError) as error:
            issue.create_comment(str(error))


db_was_updated = update_git_repository()
if db_was_updated:
    xml_files, timestamp = fetch_xml_files()
    generate_database_tarballs(xml_files, timestamp)
owncloud.sync()
close_github_issues()
owncloud.sync()