Exemplo n.º 1
0
def extract_music(args, conf):
    dat_manager = DatManager(conf.get('game', 'path'))
    exd_manager = ExdManager(dat_manager)
    output_path = path.join(conf.get('output', 'path'), 'music')

    tried = 0
    completed = 0

    for data in exd_manager.get_category('BGM').get_ln_data(0).values():
        print('----------')
        tried = tried + 1
        file_path = data[0].decode('utf-8')

        if file_path == '':
            continue

        output_file_path = path.join(output_path, file_path)

        if not path.exists(path.dirname(output_file_path)):
            makedirs(path.dirname(output_file_path))

        try:
            print('Song:', file_path)
            file_data = dat_manager.get_file(file_path)
        except:
            continue

        if hasattr(file_data, 'getvalue'):
            completed = completed + 1
            with open(output_file_path, 'wb') as file_handle:
                file_handle.write(file_data.getvalue())
        else:
            continue

    print('tried', tried, 'completed', completed)
Exemplo n.º 2
0
def extract_exh(args, conf):
    dat_manager = DatManager(conf.get('game', 'path'))
    exd_manager = ExdManager(dat_manager)

    output_path = path.join(conf.get('output', 'path'), 'exh')

    for category_name in exd_manager.get_categories():
        struct_def = exd_manager.get_category(category_name).get_struct_def()
        output_file_path = path.join(
            output_path,
            'exd/%s.exh' % category_name)

        if not path.exists(path.dirname(output_file_path)):
            makedirs(path.dirname(output_file_path))

        with open(output_file_path, 'w') as file_handle:
            for line in struct_def:
                file_handle.write(line)
                file_handle.write('\n')
Exemplo n.º 3
0
def extract_exd(args, conf):
    dat_manager = DatManager(conf.get('game', 'path'))
    exd_manager = ExdManager(dat_manager)

    output_path = path.join(conf.get('output', 'path'), 'exd')

    for category_name in exd_manager.get_categories():
        data = exd_manager.get_category(category_name).get_csv()
        for language, csv in data.items():
            output_file_path = path.join(
                output_path,
                'exd/%s_%s.exd' % (category_name, get_language_name(language)))

            if not path.exists(path.dirname(output_file_path)):
                makedirs(path.dirname(output_file_path))

            with open(output_file_path, 'w') as file_handle:
                for line in csv:
                    file_handle.write(line)
                    file_handle.write('\n')