Code Monkey home page Code Monkey logo

memo-to-json's Introduction

Memo to JSON Converter

This script converts cosmos memo files to a more usable JSON format with sorted timestamps.

For documentation on the file format see src/memson.ts.

Usage

The ready to use index.js can be found in the dist directory.

Make sure you have the node runtime >=10 installed. No other dependecies are needed.

To parse a memo file to json simply navigate to the projects directory and execute following command:

node dist/index.js [path-to-memo-or-dir] <pretty> <folderize>

The path can either be a single file or a directory containing memo files. File names should be in the following format.

some_name_(bsc|adv|ext).(memo|txt)

Example file names:

awesome_song_adv.memo
another_cool_song.txt

Output file name is the input file name with a .json ending and the difficulty reference removed. So for an input of awesome_song_adv.memo and output file with the name awesome_song.json will be created.

If a json file with the correct name for the same song already exists, then the chart information for another difficulty will be appended.

E.g. awesome_song.json already exists and contains the adv chart. If awesome_song_ext.memo is parsed after that, then the ext chart data will be appended to awesome_song.json.

The option pretty is optional and takes either true or false as input. If set to true it will stringify the JSON in a more readable way but this takes up more file space.

With folderize set to true, the parser will output the file into a subfolder with the same name as the parsed memo.

Notes on memo format

This script is a bit hacky, so please make sure that you copy the memo like it is displayed at cosmos. Make sure that your file does not contain any leading or trailing whitespaces or newlines.

Example file:

Another Phase
TAG

EXTREME

Level: 9
BPM: 160
Notes: 693

1
口口口口 |----|
口口口口 |----|
口口口口 |----|
口口口口 |----|
...

There should be a blank line between the artist and the difficulty category. And also one between the category and the other metadata. The last blank line separates the metadata from the note data. There shouldn't be any blank lines after that.

In case anyone would ever need a more stable parser then let me know.

memo-to-json's People

Contributors

sirchronus avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.