Advertisement
Guest User

Simple shuffling script for sounds/voicelines (Python)

a guest
Feb 4th, 2019
5,479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. #Simple shuffling script for sounds/voicelines (be careful with this & always make backups!)
  2. #Jam2go
  3.  
  4. import os, subprocess
  5. from os import rename
  6. import subprocess
  7. import random
  8. import glob
  9. from shutil import copyfile
  10.  
  11. names = []
  12.  
  13. #Enter the folder where all the sounds/voicelines are in this line, could also use to shuffle other filetypes, just change .wav to whatever
  14. filesA = glob.glob("C:\Program Files (x86)\Steam\steamapps\common\Skyrim\Data\sound" + '/**/*.wav', recursive=True)
  15. filesB = filesA.copy()
  16.  
  17. match = True
  18.  
  19. while(match):
  20. match = False
  21. random.shuffle(filesB)
  22. x = 0
  23. for file in filesA:
  24. if filesB[x] == file:
  25. #print(str(x)[65:] +": " + filesB[x][65:] + " = " + file)
  26. match = True
  27. x += 1
  28.  
  29. temp = "C:\Program Files (x86)\Steam\steamapps\common\Skyrim\Data\sound\\temp.wav"
  30.  
  31. x = 0
  32. for file in filesA:
  33. #print (file[67:] + " <-> " + filesB[x][67:])
  34. copyfile(file, temp)
  35. copyfile(filesB[x], file)
  36. copyfile(temp, filesB[x])
  37. x += 1
  38.  
  39. os.remove(temp)
  40.  
  41. print("Done!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement