#!/usr/bin/env python3 # Take a path as the only argument and print a path suitable for use with # The Eye's ceph cluster, which doesn't want e.g. 7 million channel folders # in one directory. import sys path = sys.argv[1] components = path.split("/") out = [] first_youtube = components.index("YouTube") for n, c in enumerate(components): if n == first_youtube + 1: if c.startswith("UC") and len(c) == 24: out.append("UC") out.append(c[:4]) elif c.startswith("FL") and len(c) == 24: out.append("FL") elif c.startswith("LL") and len(c) == 24: out.append("LL") elif c.startswith("EL") and len(c) in (13, 24) and c != "ELSAhollywood": out.append("EL") elif c.startswith("PL") and len(c) in (18, 34): out.append("PL") elif c.startswith("OL") and len(c) == 41: out.append("OL") elif c.startswith("__"): out.append("__") else: out.append("user") out.append(c[0]) out.append(c) print("/".join(out))