import pyjson5
import os

CUR_DIR = os.getcwd()

with open("./example-config.json") as input_f:
    with open("./config.json", "w") as output_f:
        lines = input_f.readlines()
        data = ''.join(lines)
        obj = pyjson5.loads(data)

        audio = obj["audio"]
        audio["stats_path"] = os.path.join(CUR_DIR, 'scale_stats.npy' )

        #output_path = obj['output_path']
        obj["output_path"] = os.path.join(CUR_DIR, 'models', 'LJSpeech')

        #phoneme_path = obj['phoneme_cache_path']
        obj["phoneme_cache_path"] = os.path.join(CUR_DIR, 'models', 'phoneme_cache')

        obj["datasets"][0]["path"] = os.path.join(CUR_DIR)

        output_f.write(pyjson5.dumps(obj))
