You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

34 regels
940 B

  1. #!/usr/bin/env python3
  2. # 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
  3. import sys
  4. path = sys.argv[1]
  5. components = path.split("/")
  6. out = []
  7. first_youtube = components.index("YouTube")
  8. for n, c in enumerate(components):
  9. if n == first_youtube + 1:
  10. if c.startswith("UC") and len(c) == 24:
  11. out.append("UC")
  12. out.append(c[:4])
  13. elif c.startswith("FL") and len(c) == 24:
  14. out.append("FL")
  15. elif c.startswith("LL") and len(c) == 24:
  16. out.append("LL")
  17. elif c.startswith("EL") and len(c) in (13, 24) and c != "ELSAhollywood":
  18. out.append("EL")
  19. elif c.startswith("PL") and len(c) in (18, 34):
  20. out.append("PL")
  21. elif c.startswith("OL") and len(c) == 41:
  22. out.append("OL")
  23. elif c.startswith("__"):
  24. out.append("__")
  25. else:
  26. out.append("user")
  27. out.append(c[0])
  28. out.append(c)
  29. print("/".join(out))