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.
 
 

36 lines
945 B

  1. #!/usr/bin/env python3
  2. # Take a path as the only argument and print a path suitable for use with
  3. # The Eye's ceph cluster, which doesn't want e.g. 7 million channel folders
  4. # in one directory.
  5. import sys
  6. path = sys.argv[1]
  7. components = path.split("/")
  8. out = []
  9. first_youtube = components.index("YouTube")
  10. for n, c in enumerate(components):
  11. if n == first_youtube + 1:
  12. if c.startswith("UC") and len(c) == 24:
  13. out.append("UC")
  14. out.append(c[:4])
  15. elif c.startswith("FL") and len(c) == 24:
  16. out.append("FL")
  17. elif c.startswith("LL") and len(c) == 24:
  18. out.append("LL")
  19. elif c.startswith("EL") and len(c) in (13, 24) and c != "ELSAhollywood":
  20. out.append("EL")
  21. elif c.startswith("PL") and len(c) in (18, 34):
  22. out.append("PL")
  23. elif c.startswith("OL") and len(c) == 41:
  24. out.append("OL")
  25. elif c.startswith("__"):
  26. out.append("__")
  27. else:
  28. out.append("user")
  29. out.append(c[0])
  30. out.append(c)
  31. print("/".join(out))