예제 #1
0
파일: pfs_meta.py 프로젝트: hectormz/pycine
def copy(all_metadata, wb, tone, source, destinations):
    source_header = read_header(source)
    ensure_minimal_software_version(source_header, source, 709)

    for d in destinations:
        dest_header = read_header(d)
        ensure_minimal_software_version(dest_header, d, 709)

        if wb or all_metadata:
            click.echo(f"Temp: {source_header['setup'].fWBTemp}")
            click.echo(f"CC: {source_header['setup'].fWBCc}")
            dest_header["setup"].fWBTemp = source_header["setup"].fWBTemp
            dest_header["setup"].fWBCc = source_header["setup"].fWBCc
            dest_header["setup"].cmCalib = source_header["setup"].cmCalib
            dest_header["setup"].WBGain = source_header["setup"].WBGain

        if tone or all_metadata:
            tone_label = source_header["setup"].ToneLabel.decode("ascii")
            tone_points = list(source_header["setup"].fTone
                               )[:source_header["setup"].TonePoints * 2]
            click.echo(
                f"Tone points: {tone_label} {' '.join([str(p) for p in tone_points])}"
            )
            dest_header["setup"].ToneLabel = source_header["setup"].ToneLabel
            dest_header["setup"].TonePoints = source_header["setup"].TonePoints
            dest_header["setup"].fTone = source_header["setup"].fTone

        click.secho(f"Writing metadata to {d}.", fg="green")
        write_header(d, dest_header)
예제 #2
0
def set_(destinations, temp, cc, record_fps, playback_fps, timecode_fps, tone,
         first_frame_number):
    for d in destinations:
        dest_header = read_header(d)
        ensure_minimal_software_version(dest_header, d, 709)

        if temp:
            click.secho(
                "WARNING: This does not yet change the calibration matrix.",
                fg="red")
            dest_header["setup"].fWBTemp = temp

        if cc:
            click.secho(
                "WARNING: This does not yet change the calibration matrix.",
                fg="red")
            dest_header["setup"].fWBCc = cc

        if tone:
            tone_label, tone_points, tone = parse_tone(tone)

            dest_header["setup"].ToneLabel = bytes(tone_label, "ascii")
            dest_header["setup"].TonePoints = tone_points
            dest_header["setup"].fTone = tone

        if record_fps:
            dest_header["setup"].FrameRate = record_fps

        if playback_fps:
            dest_header["setup"].fPbRate = _parse_fps(playback_fps)

        if timecode_fps:
            dest_header["setup"].fTcRate = _parse_fps(timecode_fps)

        if first_frame_number is not None:
            dest_header["cinefileheader"].FirstImageNo = first_frame_number

        if any([
                temp, cc, record_fps, playback_fps, timecode_fps, tone,
                first_frame_number is not None
        ]):
            click.secho(f"Writing metadata to {d}.", fg="green")
            write_header(d, dest_header)