Advertisement
KangarooOnIce

Untitled

Mar 31st, 2023
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. from random import choices, randint, choice
  2. from pathlib import Path
  3. from shutil import copy
  4. from ignore import ignore_list
  5. import os
  6. import sys
  7.  
  8. root = '/home/liam/Samples/'
  9. list_of_files = list(Path(root).rglob('*')) # List All Files In ~/Samples
  10. final_path = "/home/liam/Samples/SpeedComp/Liams_Speedcomp/" # Path To Destination Folder
  11. audio_file_list = []
  12.  
  13.  
  14. # Delete all files in destination folder when you run the program
  15. for f in os.listdir(final_path):
  16. os.remove(os.path.join(final_path, f))
  17.  
  18. # Main Loop
  19. while True:
  20. audio_file = choice(list_of_files)
  21. if len(audio_file_list) == 10: # Break loop if you have reached 10 Samples
  22. break
  23. else:
  24. if not any(str(audio_file).startswith(ignore_path) for ignore_path in ignore_list):
  25. audio_file_list.append(audio_file)
  26.  
  27. for x in audio_file_list:
  28. x = str(x)
  29. print(x[19:])
  30.  
  31.  
  32. for i in audio_file_list:
  33. copy(i, final_path)
  34.  
  35.  
  36. # Check length of audio file
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement