-
Notifications
You must be signed in to change notification settings - Fork 0
/
cuePy.py
executable file
·83 lines (63 loc) · 1.82 KB
/
cuePy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/python3
import re
import tkinter as tk
from tkinter import filedialog
def generateGUI():
# getFilePath()
# generateFileArray()
# getFileName()
# getCueFileName()
# getOutputPath()
# getCueFileFormat()
# getOutputPath()
# getCueFileFormat()
# generateCueFile()
pass
def getFilePath():
filePath = filedialog.askopenfilename()
print("File path > " + filePath)
return filePath
def generateFileArray():
filePath = getFilePath()
fileNameArray = filePath.split('/')
for file in fileNameArray:
match = re.search("\.bin$", file)
if match:
binFile = file
print("File name array > " + str(fileNameArray))
return binFile
def getFileName():
binFile = generateFileArray()
fileName = binFile.replace(".bin", "")
return fileName
def getCueFileName():
binFile = generateFileArray()
cueFileName = binFile.replace(".bin", ".cue")
return cueFileName
def getOutputPath():
writePath = filedialog.askdirectory()
return writePath
def getCueFileFormat():
binFile = generateFileArray()
writeFileTypeToCue = 'FILE "%s" BINARY\n' % (binFile)
writeTrackToCue = ' TRACK 01 MODE2/2352\n'
writeIndexToCue = ' INDEX 01 00:00:00'
writeToCue = writeFileTypeToCue + writeTrackToCue + writeIndexToCue
print(writeToCue)
# writePath = filedialog.askdirectory()
return writeToCue
def generateCueFile():
writePath = getOutputPath()
cueFileName = getCueFileName()
writeToCue = getCueFileFormat()
createCueFile = writePath + "/%s" % cueFileName
writeCueFile = open(createCueFile, "w")
writeCueFile.write(writeToCue)
writeCueFile.close()
def main():
print("Python cue file generator!")
root = tk.Tk()
root.withdraw()
generateGUI()
if __name__ == '__main__':
main()