Sfoglia il codice sorgente

Add path-to-eye-path

master
Ivan Kozik 1 mese fa
parent
commit
220d34276b
1 ha cambiato i file con 33 aggiunte e 0 eliminazioni
  1. +33
    -0
      path-to-eye-path

+ 33
- 0
path-to-eye-path Vedi File

@@ -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))

Caricamento…
Annulla
Salva