Skip to content

Commit

Permalink
Push 0.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
donmai-me committed Nov 13, 2021
1 parent 2696419 commit b28321f
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 75 deletions.
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.14.0] - 2021-11-14
### Added
- New time tracking functions: measure_to_second, second_to_measure, and quantise.
- Time functions measure_to_second and second_to_measure has an optional parameter `include_metronome_ticks`, set to True by default, that takes into account the first few metronome ticks at the start.
- New script (sxt_change_bpm.py) that converts an MaiSxt chart written in one BPM to another.
- New script (sxt_to_ma2_with_bpms.py) that converts an MaiSxt chart to a MaiMa2 chart that copies the BPM skeleton of another MaiMa2 chart.

Expand All @@ -22,8 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- MaiMa2 resolution moved from being an attribute to a parameter in export method.
- Migrated changelog format to keep a changelog and remove entries from unreleased versions.
- MaiMa2 and MaiSxt notes no longer have a newline character at the end when converted to string.
- slide_distance and is_slide_cw moved from simai package to tool package.
- Time functions measure_to_second and second_to_measure now has an optional parameter `include_metronome_ticks`, which is set to True by default, that takes into account the first few metronome ticks at the start.
- slide_distance and is_slide_cw moved from simai package to tool package.

### Removed
- Old scripts in the scripts folder.
Expand All @@ -42,5 +42,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Ma2 to Sdt conversion and vice versa.
- Simai to Sdt conversion and vice versa.

[Unreleased]: https://github.com/donmai-me/MaiConverter/compare/0.13.0...HEAD
[Unreleased]: https://github.com/donmai-me/MaiConverter/compare/0.14.0...HEAD
[0.14.0]: https://github.com/donmai-me/MaiConverter/compare/0.13.0...0.14.0
[0.13.0]: https://github.com/donmai-me/MaiConverter/compare/0.12.0...0.13.0
2 changes: 1 addition & 1 deletion maiconverter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from importlib.metadata import version, PackageNotFoundError
from .maiconverter import main
from maiconverter.cli import main

try:
__version__ = version("maiconverter")
Expand Down
2 changes: 1 addition & 1 deletion maiconverter/__main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .maiconverter import main
from maiconverter.cli import main

main()
40 changes: 22 additions & 18 deletions maiconverter/maiconverter.py → maiconverter/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def crypto(args, output):
file for file in files if not re.search(r"\.tbl", file) is None
]
else:
# Only accept ".sxt" ".sct" ".szt" ".srt" files
# Only accept ".sdt" ".sct" ".szt" ".srt" files
files = [
file for file in files if not re.search(r"\.s.t", file) is None
]
Expand Down Expand Up @@ -122,7 +122,7 @@ def handle_ma2(file, name, output_path, args):

if args.command == "ma2tosdt":
output = ma2_to_sdt(ma2, convert_touch=args.convert_touch)
ext = ".sxt"
ext = ".sdt"
else:
output = ma2_to_simai(ma2)
ext = ".txt"
Expand Down Expand Up @@ -166,7 +166,7 @@ def handle_simai_chart(file, name, output_path, args):
simai.offset(args.delay)

if args.command == "simaitosdt":
ext = ".sxt"
ext = ".sdt"
converted = simai_to_sdt(simai, convert_touch=args.convert_touch)
else:
ext = ".ma2"
Expand All @@ -175,7 +175,10 @@ def handle_simai_chart(file, name, output_path, args):
with open(
os.path.join(output_path, name + ext), "w+", newline="\r\n", encoding="utf-8"
) as out:
out.write(converted.export(resolution=args.resolution))
if isinstance(converted, MaiSxt):
out.write(converted.export())
else:
out.write(converted.export(resolution=args.resolution))


def handle_simai_file(file, output_path, args):
Expand All @@ -187,7 +190,7 @@ def handle_simai_file(file, output_path, args):

try:
if args.command == "simaifiletosdt":
ext = ".sxt"
ext = ".sdt"
converted = simai_to_sdt(simai_chart, convert_touch=args.convert_touch)
else:
ext = ".ma2"
Expand Down Expand Up @@ -237,20 +240,21 @@ def handle_db(input_path, output_dir, command, key):
f.write(output)


def parse_arg():
COMMANDS = [
"encrypt",
"decrypt",
"ma2tosdt",
"ma2tosimai",
"sdttoma2",
"sdttosimai",
"simaifiletoma2",
"simaifiletosdt",
"simaitoma2",
"simaitosdt",
]
COMMANDS = [
"encrypt",
"decrypt",
"ma2tosdt",
"ma2tosimai",
"sdttoma2",
"sdttosimai",
"simaifiletoma2",
"simaifiletosdt",
"simaitoma2",
"simaitosdt",
]


def parse_arg():
parser = argparse.ArgumentParser(
description="Tool for converting MaiMai chart formats",
allow_abbrev=False,
Expand Down
7 changes: 7 additions & 0 deletions maiconverter/event/note.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import enum
import math
from functools import total_ordering
from typing import Dict

from .event import Event, EventType

Expand Down Expand Up @@ -36,6 +37,12 @@ class NoteType(enum.Enum):
end_slide = 128


NOTE_ORDERING: Dict[int, int] = {
5: 0,
4: 0,
}


class Note(Event):
def __init__(self, measure: float, position: int, note_type: NoteType) -> None:
if position < 0:
Expand Down
5 changes: 2 additions & 3 deletions maiconverter/maima2/ma2note.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import math
from typing import Tuple

from ..event import MaiNote, NoteType, Event, EventType
from maiconverter.event import MaiNote, NoteType, Event, EventType
from maiconverter.tool import slide_distance

# Dictionary for a note type's representation in ma2
# Does not cover slide notes, BPM, and meter events.
# Use slide_dict for slides instead.
from ..tool import slide_distance

note_dict = {
"TAP": 1,
"HLD": 2,
Expand Down
Loading

0 comments on commit b28321f

Please sign in to comment.