Skew

Untitled

Jan 30th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.79 KB | None | 0 0
  1. import glob
  2.  
  3. # Grab directory
  4.  
  5. print("Directory path:", end='')
  6. directory = input()
  7. print("Searching in "+directory)
  8.  
  9. # Scripts
  10.  
  11. total_scripts = 0
  12. total_lines = 0
  13. total_populated_lines = 0
  14. total_chars = 0
  15. total_words = 0
  16. total_classes = 0
  17. total_components = 0
  18. print("Processing....")
  19. for path in glob.iglob(directory + "/**/*.cs", recursive=True):
  20.     total_scripts += 1
  21.     with open(path, 'r', encoding="utf8") as f:
  22.         for line in f:
  23.             total_lines += 1
  24.             total_chars += len(line)
  25.             total_words += len(line.split())
  26.             if len(line) > 0: total_populated_lines += 1
  27.             if " class " in line: total_classes += 1
  28.             if " : MonoBehaviour" in line: total_components += 1
  29. print("Total files:",total_scripts)
  30. print("Total lines:",total_lines)
  31. print("Total populated lines:", total_populated_lines)
  32. print("Total chars:",total_chars)
  33. print("Total words:",total_words)
  34. print("Total classes:", total_classes)
  35. print("Total components:", total_components)
  36.  
  37. # Materials
  38.  
  39. paths = glob.glob(directory + "/**/*.mat", recursive=True)
  40. print("Total materials:",len(paths))
  41.  
  42. # Images
  43.  
  44. file_types = ('*.jpg', '*.jpeg', '*.png', '*.tif', '*.tiff', '*.webm')
  45. paths = []
  46. for t in file_types:
  47.     paths.extend(glob.glob(directory + "/**/" + t, recursive=True))
  48. print("Total images:",len(paths))
  49.  
  50. # Sounds
  51.  
  52. file_types = ('*.mp3', '*.ogg', '*.wav')
  53. paths = []
  54. for t in file_types:
  55.     paths.extend(glob.glob(directory + "/**/" + t, recursive=True))
  56. print("Total sounds:",len(paths))
  57.  
  58. # Models
  59.  
  60. file_types = ('*.fbx', '*.obj', '*.3ds', '*.blend')
  61. paths = []
  62. for t in file_types:
  63.     paths.extend(glob.glob(directory + "/**/" + t, recursive=True))
  64. print("Total models:",len(paths))
  65.  
  66. # Results
  67.  
  68. print("---")
  69. print("You will have to continuously type",round(total_words/65/60, 2),"straight hours on average")
Advertisement
Add Comment
Please, Sign In to add comment