Standarize I/O for read/writeFumen functions
This commit is contained in:
parent
1ea10e0635
commit
73b1fed5a7
@ -39,7 +39,7 @@ def main(argv=None):
|
||||
|
||||
# Write fumen data to files
|
||||
for fumenData, outputName in zip(parsedSongsFumen.values(), outputFilenames):
|
||||
writeFumen(open(outputName, "wb"), fumenData)
|
||||
writeFumen(outputName, fumenData)
|
||||
|
||||
if return_vars:
|
||||
return parsedSongsTJA, parsedSongsFumen, outputFilenames
|
||||
|
@ -286,10 +286,7 @@ def readFumen(fumenFile, exclude_empty_measures=False):
|
||||
For more information on any of the terms used in this function (e.g. scoreInit, scoreDiff),
|
||||
please refer to KatieFrog's excellent guide: https://gist.github.com/KatieFrogs/e000f406bbc70a12f3c34a07303eec8b
|
||||
"""
|
||||
if type(fumenFile) is str:
|
||||
file = open(fumenFile, "rb")
|
||||
else:
|
||||
file = fumenFile
|
||||
file = open(fumenFile, "rb")
|
||||
size = os.fstat(file.fileno()).st_size
|
||||
|
||||
# Fetch the header bytes
|
||||
|
@ -2,11 +2,12 @@ from tja2fumen.utils import writeStruct, putBool
|
||||
from tja2fumen.constants import branchNames, typeNotes
|
||||
|
||||
|
||||
def writeFumen(file, song):
|
||||
def writeFumen(path_out, song):
|
||||
# Fetch the byte order (little/big endian)
|
||||
order = song['order']
|
||||
|
||||
# Write the header
|
||||
file = open(path_out, "wb")
|
||||
file.write(song['headerPadding']) # Write header padding bytes
|
||||
file.write(song['headerMetadata']) # Write header metadata bytes
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user