From 220d34276b539364ccc810933c082dfde3ec317b Mon Sep 17 00:00:00 2001 From: Ivan Kozik Date: Thu, 11 Apr 2024 22:59:21 +0000 Subject: [PATCH] Add path-to-eye-path --- path-to-eye-path | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 path-to-eye-path diff --git a/path-to-eye-path b/path-to-eye-path new file mode 100755 index 0000000..d8c76fc --- /dev/null +++ b/path-to-eye-path @@ -0,0 +1,33 @@ +#!/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))