Advertisement
hampii

script monker viewer file to pio file

Sep 26th, 2019
2,087
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. # to use you gotta convert the .rng files to .txt files first, you can do this by opening command prompt, picking the folder with the ranges you wanna convert by putting in "cd filepath"
  2. # pressing enter and then "ren *.rng *.txt". Once the files are all .txt you gotta put them in the same folder as the script, change path file and openraisers position and thats it (I hope)
  3. # Step by step tutorial in video format: https://youtu.be/zsxkj1RBktw if you run into other problems add me on discord 'hampii#6954'
  4. import glob
  5. import os
  6.  
  7. f = glob.glob("*.txt")
  8.  
  9. for x in range(len(f)):
  10. file_name = f[0]
  11. periods = file_name.count(".")
  12. #change for your filepath obv
  13. next_path = "C:\\Users\\Rene\\PycharmProjects\\draft\\pioranges\\"
  14. sizes = file_name.split(".")
  15. postions = ["LJ", "HJ", "CO", "BU", "SB", "BB"]
  16. #change who's first in
  17. first_pos = "BU"
  18. abc = postions.index(first_pos)
  19. open_raiser = postions[abc:]
  20. for i in range(len(sizes)-1):
  21. if sizes[0] == "0":
  22. next_path += open_raiser[0] + "f" + "\\"
  23. open_raiser.pop(0)
  24. sizes.pop(0)
  25. elif sizes[0] == "1":
  26. next_path += open_raiser[0] + "c" + "\\"
  27. sizes.pop(0)
  28. open_raiser.append(open_raiser[0])
  29. open_raiser.pop(0)
  30. elif sizes[0] == "3":
  31. next_path += open_raiser[0] + "j" + "\\"
  32. open_raiser.pop(0)
  33. sizes.pop(0)
  34. elif sizes[0] == "5":
  35. next_path += open_raiser[0] + "min" + "\\"
  36. open_raiser.append(open_raiser[0])
  37. open_raiser.pop(0)
  38. sizes.pop(0)
  39. else:
  40. next_path += open_raiser[0] + "r" + sizes[0][2:] + "\\"
  41. open_raiser.append(open_raiser[0])
  42. open_raiser.pop(0)
  43. sizes.pop(0)
  44. if not os.path.exists(next_path):
  45. os.makedirs(next_path)
  46. lines = [line.rstrip('\n') for line in open(file_name)]
  47. string = ""
  48. while len(lines) > 0:
  49. hand = lines.pop(0) + ":"
  50. value = lines.pop(0).split(";", maxsplit=1)[0] + ","
  51. string += hand + value
  52. next_path += file_name
  53. print(next_path)
  54. new_file = open(next_path, "w+")
  55. new_file.write(string)
  56. new_file.close()
  57. f.pop(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement