from cursor import loader
from cursor import data
from cursor import device
from cursor import path
from cursor import filter
from cursor import renderer


def save_wrapper(pc, projname, fname):
    folder = data.DataDirHandler().jpg(projname)
    jpeg_renderer = renderer.JpegRenderer(folder)

    jpeg_renderer.render(pc, scale=4.0, thickness=3)
    jpeg_renderer.save(fname)


if __name__ == "__main__":
    recs = data.DataDirHandler().recordings()
    loader = loader.Loader(directory=recs, limit_files=None)
    all_paths = loader.all_paths()

    sorter = filter.Sorter(param=filter.Sorter.SHANNON_DIRECTION_CHANGES, reverse=True)
    all_paths.sort(sorter)

    pc = path.PathCollection()

    counter = 0
    for p in all_paths[90:100]:
        p.layer = counter
        pc.add(p)

        counter += 1

    device.SimpleExportWrapper().ex(
        pc,
        device.PlotterType.DIY_PLOTTER,
        device.PaperSize.LANDSCAPE_A1,
        100,
        "genuary",
        f"4_code_golf_ALL_{pc.hash()}",
    )

{'avg_line_length': 24.261904761904763, 'max_line_length': 87, 'alphanum_fraction': 0.6830225711481845, 'licenses': ['MIT'], 'repository_name': 'brendanhowell/cursor', 'path': 'experiments/genuary/4_code_golf.py', 'size': 1019, 'lang': 'Python'}