main.py
: Remove fumen
-parsing code and make TJA mandatory
Fumen code was just for debugging purposes, and not necessary for TJA conversion.
This commit is contained in:
parent
5d50dcfa41
commit
90f3d7902f
@ -97,7 +97,7 @@ def preprocessTJAMeasures(tja):
|
||||
return measuresCorrected
|
||||
|
||||
|
||||
def convertTJAToFumen(fumen, tja):
|
||||
def convertTJAToFumen(tja):
|
||||
# Hardcode currentBranch due to current lack of support for branching songs
|
||||
currentBranch = 'normal' # TODO: Program in branch support
|
||||
tja['measures'] = preprocessTJAMeasures(tja)
|
||||
|
@ -1,34 +1,16 @@
|
||||
import argparse
|
||||
import os
|
||||
|
||||
from tja2fumen.parsers import readFumen, parseTJA
|
||||
from tja2fumen.parsers import parseTJA
|
||||
from tja2fumen.writers import writeFumen
|
||||
from tja2fumen.converters import convertTJAToFumen
|
||||
from tja2fumen.utils import checkMismatchedBytes
|
||||
from tja2fumen.constants import COURSE_IDS
|
||||
|
||||
tja2fumen_version = "v0.1"
|
||||
|
||||
|
||||
def main(fnameFumen=None, fnameTJA=None, validate=False):
|
||||
if fnameFumen:
|
||||
# Parse fumen
|
||||
inputFile = open(fnameFumen, "rb")
|
||||
parsedSongFumen = readFumen(inputFile)
|
||||
|
||||
# Steps to validate the `writeFumen` function to make sure it reproduces correct output
|
||||
if validate:
|
||||
outputName = inputFile.name.split('.')[0] + "_rebuilt.bin"
|
||||
outputFile = open(outputName, "wb")
|
||||
writeFumen(outputFile, parsedSongFumen)
|
||||
# Read output file back in to validate that the rewritten song is a perfect match
|
||||
print(False if checkMismatchedBytes(inputFile.name, outputFile.name) else True)
|
||||
else:
|
||||
parsedSongFumen = None
|
||||
|
||||
def main(fnameTJA):
|
||||
convertedTJAs = {}
|
||||
if fnameTJA:
|
||||
# Parse tja
|
||||
try:
|
||||
inputFile = open(fnameTJA, "r", encoding="utf-8-sig")
|
||||
parsedSongsTJA = parseTJA(inputFile)
|
||||
@ -37,10 +19,10 @@ def main(fnameFumen=None, fnameTJA=None, validate=False):
|
||||
parsedSongsTJA = parseTJA(inputFile)
|
||||
|
||||
for course, song in parsedSongsTJA.items():
|
||||
convertedTJA = convertTJAToFumen(parsedSongFumen, song)
|
||||
convertedTJA = convertTJAToFumen(song)
|
||||
convertedTJAs[course] = convertedTJA
|
||||
|
||||
return parsedSongFumen, convertedTJAs
|
||||
return convertedTJAs
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
Reference in New Issue
Block a user