from pathlib import Path
from typing import Tuple
from typing import List


def get_syncxxxxset_folders(mpath: Path) -> Tuple[List[str], List[str]]:
    """
    Return the names of the SYNCXXXXSET folders and the parent
    folder names, which should be "red_cam" and "blue_cam".
    """
    sync_d, cam_d = [], []
    exclude_dirs = ["gcps", "homogr_mat", "kml", "metadata", "rets", "rgb"]
    for d in sorted(mpath.glob("**/SYNC*SET")):
        if d.is_file():
            continue
        parent_d = d.parts[-2]
        if parent_d in exclude_dirs:
            continue
        cam_d.append(parent_d)
        sync_d.append(d.name)

    return list(set(sync_d)), list(set(cam_d))