1
0
mirror of synced 2024-12-11 22:46:00 +01:00

Start eve support

This commit is contained in:
Stepland 2021-05-06 15:12:12 +02:00
parent 3544a817bf
commit 3a4dce98b0
6 changed files with 53 additions and 51 deletions

View File

@ -1,46 +1,5 @@
""" """
Module containing all the load/dump code for all file formats Module containing all the load/dump code for all file formats
""" """
from typing import Dict
from .enum import Format from .enum import Format
from .jubeat_analyser import ( from .formats import DUMPERS, LOADERS
dump_memo,
dump_memo1,
dump_memo2,
dump_mono_column,
load_memo,
load_memo1,
load_memo2,
load_mono_column,
)
from .memon import (
dump_memon_0_1_0,
dump_memon_0_2_0,
dump_memon_legacy,
load_memon_0_1_0,
load_memon_0_2_0,
load_memon_legacy,
)
from .typing import Dumper, Loader
LOADERS: Dict[Format, Loader] = {
Format.MEMON_LEGACY: load_memon_legacy,
Format.MEMON_0_1_0: load_memon_0_1_0,
Format.MEMON_0_2_0: load_memon_0_2_0,
Format.MONO_COLUMN: load_mono_column,
Format.MEMO: load_memo,
Format.MEMO_1: load_memo1,
Format.MEMO_2: load_memo2,
}
DUMPERS: Dict[Format, Dumper] = {
Format.MEMON_LEGACY: dump_memon_legacy,
Format.MEMON_0_1_0: dump_memon_0_1_0,
Format.MEMON_0_2_0: dump_memon_0_2_0,
Format.MONO_COLUMN: dump_mono_column,
Format.MEMO: dump_memo,
Format.MEMO_1: dump_memo1,
Format.MEMO_2: dump_memo2,
}

View File

@ -2,6 +2,7 @@ from enum import Enum
class Format(str, Enum): class Format(str, Enum):
EVE = "eve"
MEMON_LEGACY = "memon:legacy" MEMON_LEGACY = "memon:legacy"
MEMON_0_1_0 = "memon:v0.1.0" MEMON_0_1_0 = "memon:v0.1.0"
MEMON_0_2_0 = "memon:v0.2.0" MEMON_0_2_0 = "memon:v0.2.0"
@ -9,11 +10,3 @@ class Format(str, Enum):
MEMO = "memo" MEMO = "memo"
MEMO_1 = "memo1" MEMO_1 = "memo1"
MEMO_2 = "memo2" MEMO_2 = "memo2"
JUBEAT_ANALYSER_FORMATS = {
Format.MONO_COLUMN,
Format.MEMO,
Format.MEMO_1,
Format.MEMO_2,
}

View File

View File

@ -0,0 +1,42 @@
from typing import Dict
from .enum import Format
from .jubeat_analyser import (
dump_memo,
dump_memo1,
dump_memo2,
dump_mono_column,
load_memo,
load_memo1,
load_memo2,
load_mono_column,
)
from .memon import (
dump_memon_0_1_0,
dump_memon_0_2_0,
dump_memon_legacy,
load_memon_0_1_0,
load_memon_0_2_0,
load_memon_legacy,
)
from .typing import Dumper, Loader
LOADERS: Dict[Format, Loader] = {
Format.MEMON_LEGACY: load_memon_legacy,
Format.MEMON_0_1_0: load_memon_0_1_0,
Format.MEMON_0_2_0: load_memon_0_2_0,
Format.MONO_COLUMN: load_mono_column,
Format.MEMO: load_memo,
Format.MEMO_1: load_memo1,
Format.MEMO_2: load_memo2,
}
DUMPERS: Dict[Format, Dumper] = {
Format.MEMON_LEGACY: dump_memon_legacy,
Format.MEMON_0_1_0: dump_memon_0_1_0,
Format.MEMON_0_2_0: dump_memon_0_2_0,
Format.MONO_COLUMN: dump_mono_column,
Format.MEMO: dump_memo,
Format.MEMO_1: dump_memo1,
Format.MEMO_2: dump_memo2,
}

View File

@ -4,7 +4,13 @@ from typing import Any, Callable, Dict, Protocol
from jubeatools.song import Song from jubeatools.song import Song
# Dumpers take a Song object and a Path hint and give back a dict that maps
#
class Dumper(Protocol): class Dumper(Protocol):
"""A Dumper is a callable that takes in a Song object, a Path hint and
potential options, then gives back a dict that maps file name suggestions
to the binary content of the file"""
def __call__(self, song: Song, path: Path, **kwargs: Any) -> Dict[Path, bytes]: def __call__(self, song: Song, path: Path, **kwargs: Any) -> Dict[Path, bytes]:
... ...

View File

@ -23,6 +23,8 @@ with open("jubeatools/version.py", mode="w") as f:
if args.commit: if args.commit:
subprocess.run(["git", "reset"]) subprocess.run(["git", "reset"])
subprocess.run(["git", "add", "pyproject.toml", "jubeatools/version.py"], check=True) subprocess.run(
["git", "add", "pyproject.toml", "jubeatools/version.py"], check=True
)
subprocess.run(["git", "commit", "-m", f"Bump version to {version}"]) subprocess.run(["git", "commit", "-m", f"Bump version to {version}"])
subprocess.run(["git", "tag", f"v{version}"]) subprocess.run(["git", "tag", f"v{version}"])