diff --git a/CHANGELOG.md b/CHANGELOG.md index 32da17d..214128c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# Unreleased +## Fixed +- Loaders and Dumpers would recieve options with unwanted default values when + their corresponding flags were not passed to the commandline, resulting + in weird bugs, not anymore ! #17 + # v1.2.2 ## Changed - Slashes in filenames are now ignored diff --git a/jubeatools/cli/cli.py b/jubeatools/cli/cli.py index 05105a0..7300e51 100644 --- a/jubeatools/cli/cli.py +++ b/jubeatools/cli/cli.py @@ -50,8 +50,8 @@ def convert( dst: str, input_format: Optional[Format], output_format: Format, - loader_options: Dict[str, Any], - dumper_options: Dict[str, Any], + loader_options: Optional[Dict[str, Any]] = None, + dumper_options: Optional[Dict[str, Any]] = None, ) -> None: """Convert SRC to DST using the format specified by -f""" if input_format is None: @@ -68,7 +68,9 @@ def convert( except KeyError: raise ValueError(f"Unsupported output format : {input_format}") + loader_options = loader_options or {} song = loader(Path(src), **loader_options) + dumper_options = dumper_options or {} files = dumper(song, Path(dst), **dumper_options) for path, contents in files.items(): with path.open("wb") as f: diff --git a/jubeatools/cli/helpers.py b/jubeatools/cli/helpers.py index 19cba95..e57c540 100644 --- a/jubeatools/cli/helpers.py +++ b/jubeatools/cli/helpers.py @@ -3,17 +3,6 @@ from typing import Any, Callable, Union import click -def add_to_dict( - key: str, -) -> Callable[[click.Context, Union[click.Option, click.Parameter], Any], None]: - def add_to_key( - ctx: click.Context, param: Union[click.Option, click.Parameter], value: Any - ) -> None: - ctx.params.setdefault(key, {})[param.name] = value - - return add_to_key - - def loader_option(*args: Any, **kwargs: Any) -> Callable: return click.option( *args, callback=add_to_dict("loader_options"), expose_value=False, **kwargs @@ -24,3 +13,28 @@ def dumper_option(*args: Any, **kwargs: Any) -> Callable: return click.option( *args, callback=add_to_dict("dumper_options"), expose_value=False, **kwargs ) + + +def add_to_dict( + key: str, +) -> Callable[[click.Context, Union[click.Option, click.Parameter], Any], None]: + def add_to_key( + ctx: click.Context, param: Union[click.Option, click.Parameter], value: Any + ) -> None: + # Avoid shadowing load/dump functions kwargs default values with the + # default values chosen by click + assert param.name is not None + if not parameter_is_a_click_default(ctx, param.name): + ctx.params.setdefault(key, {})[param.name] = value + + return add_to_key + + +def parameter_is_a_click_default( + ctx: click.Context, + name: str, +) -> bool: + return ctx.get_parameter_source(name) in ( + click.core.ParameterSource.DEFAULT, + click.core.ParameterSource.DEFAULT_MAP, + ) diff --git a/jubeatools/cli/tests/__init__.py b/jubeatools/cli/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/jubeatools/cli/tests/data/Life Without You.eve b/jubeatools/cli/tests/data/Life Without You.eve new file mode 100644 index 0000000..e48d424 --- /dev/null +++ b/jubeatools/cli/tests/data/Life Without You.eve @@ -0,0 +1,1213 @@ + 0,MEASURE , 0 + 0,HAKU , 0 + 0,TEMPO , 400000 + 120,HAKU , 0 + 240,HAKU , 0 + 360,HAKU , 0 + 480,MEASURE , 0 + 480,HAKU , 0 + 480,PLAY , 0 + 480,PLAY , 3 + 480,PLAY , 8 + 480,PLAY , 11 + 600,HAKU , 0 + 720,HAKU , 0 + 720,PLAY , 10 + 780,PLAY , 6 + 780,PLAY , 9 + 840,HAKU , 0 + 900,PLAY , 15 + 960,MEASURE , 0 + 960,HAKU , 0 + 1020,PLAY , 4 + 1080,HAKU , 0 + 1080,PLAY , 5 + 1080,PLAY , 10 + 1176,PLAY , 12 + 1200,HAKU , 0 + 1260,PLAY , 15 + 1320,HAKU , 0 + 1356,PLAY , 4 + 1440,MEASURE , 0 + 1440,HAKU , 0 + 1440,PLAY , 3 + 1476,PLAY , 5 + 1500,PLAY , 10 + 1536,PLAY , 12 + 1560,HAKU , 0 + 1656,PLAY , 11 + 1680,HAKU , 0 + 1740,PLAY , 6 + 1740,PLAY , 9 + 1800,HAKU , 0 + 1800,PLAY , 14 + 1836,PLAY , 5 + 1860,PLAY , 10 + 1896,PLAY , 1 + 1920,MEASURE , 0 + 1920,HAKU , 0 + 1920,PLAY , 2 + 2040,HAKU , 0 + 2136,PLAY , 12 + 2160,HAKU , 0 + 2220,PLAY , 5 + 2220,PLAY , 10 + 2280,HAKU , 0 + 2340,PLAY , 13 + 2376,PLAY , 6 + 2400,MEASURE , 0 + 2400,HAKU , 0 + 2400,PLAY , 1 + 2460,PLAY , 7 + 2496,PLAY , 9 + 2520,HAKU , 0 + 2520,PLAY , 14 + 2556,PLAY , 5 + 2580,PLAY , 10 + 2616,PLAY , 12 + 2640,HAKU , 0 + 2760,HAKU , 0 + 2820,PLAY , 13 + 2856,PLAY , 6 + 2880,MEASURE , 0 + 2880,HAKU , 0 + 2880,PLAY , 1 + 2940,PLAY , 7 + 2976,PLAY , 9 + 3000,HAKU , 0 + 3000,PLAY , 14 + 3036,PLAY , 5 + 3060,PLAY , 10 + 3096,PLAY , 4 + 3120,HAKU , 0 + 3240,HAKU , 0 + 3300,PLAY , 11 + 3300,PLAY , 15 + 3360,MEASURE , 0 + 3360,HAKU , 0 + 3420,PLAY , 12 + 3420,PLAY , 13 + 3480,HAKU , 0 + 3480,PLAY , 7 + 3516,PLAY , 5 + 3540,PLAY , 10 + 3600,HAKU , 0 + 3600,PLAY , 0 + 3696,PLAY , 3 + 3696,PLAY , 6 + 3720,HAKU , 0 + 3780,PLAY , 8 + 3780,PLAY , 14 + 3840,MEASURE , 0 + 3840,HAKU , 0 + 3960,HAKU , 0 + 3960,PLAY , 7 + 4080,HAKU , 0 + 4080,PLAY , 4 + 4116,PLAY , 10 + 4140,PLAY , 5 + 4176,PLAY , 6 + 4200,HAKU , 0 + 4200,PLAY , 1 + 4320,MEASURE , 0 + 4320,HAKU , 0 + 4320,PLAY , 3 + 4320,PLAY , 8 + 4320,PLAY , 13 + 4440,HAKU , 0 + 4440,PLAY , 0 + 4440,PLAY , 11 + 4440,PLAY , 14 + 4560,HAKU , 0 + 4560,PLAY , 2 + 4560,PLAY , 4 + 4560,PLAY , 9 + 4680,HAKU , 0 + 4680,PLAY , 10 + 4680,PLAY , 13 + 4740,PLAY , 1 + 4740,PLAY , 6 + 4800,MEASURE , 0 + 4800,HAKU , 0 + 4800,PLAY , 3 + 4800,PLAY , 8 + 4800,PLAY , 12 + 4920,HAKU , 0 + 4920,PLAY , 0 + 4920,PLAY , 11 + 4920,PLAY , 15 + 5040,HAKU , 0 + 5040,PLAY , 4 + 5040,PLAY , 7 + 5040,PLAY , 10 + 5160,HAKU , 0 + 5160,PLAY , 9 + 5160,PLAY , 14 + 5220,PLAY , 2 + 5220,PLAY , 5 + 5280,MEASURE , 0 + 5280,HAKU , 0 + 5280,PLAY , 0 + 5280,PLAY , 1 + 5280,PLAY , 3 + 5400,HAKU , 0 + 5400,PLAY , 12 + 5400,PLAY , 13 + 5400,PLAY , 15 + 5520,HAKU , 0 + 5520,PLAY , 4 + 5520,PLAY , 6 + 5520,PLAY , 9 + 5640,HAKU , 0 + 5640,PLAY , 5 + 5640,PLAY , 7 + 5640,PLAY , 10 + 5736,PLAY , 1 + 5736,PLAY , 8 + 5760,MEASURE , 0 + 5760,HAKU , 0 + 5820,PLAY , 3 + 5880,HAKU , 0 + 5880,PLAY , 4 + 5916,PLAY , 6 + 5940,PLAY , 9 + 6000,HAKU , 0 + 6000,PLAY , 11 + 6060,PLAY , 0 + 6060,PLAY , 2 + 6060,PLAY , 5 + 6060,PLAY , 7 + 6120,HAKU , 0 + 6156,PLAY , 12 + 6156,PLAY , 15 + 6240,MEASURE , 0 + 6240,HAKU , 0 + 6240,PLAY , 1 + 6240,PLAY , 3 + 6240,PLAY , 4 + 6240,PLAY , 6 + 6360,HAKU , 0 + 6360,PLAY , 13 + 6360,PLAY , 14 + 6480,HAKU , 0 + 6480,PLAY , 0 + 6480,PLAY , 2 + 6540,PLAY , 5 + 6600,HAKU , 0 + 6600,PLAY , 1 + 6600,PLAY , 3 + 6660,PLAY , 6 + 6720,MEASURE , 0 + 6720,HAKU , 0 + 6720,PLAY , 9 + 6720,PLAY , 11 + 6840,HAKU , 0 + 6840,PLAY , 7 + 6870,PLAY , 2 + 6960,HAKU , 0 + 6960,PLAY , 0 + 6960,PLAY , 4 + 7020,PLAY , 6 + 7080,HAKU , 0 + 7080,PLAY , 8 + 7080,PLAY , 12 + 7140,PLAY , 14 + 7200,MEASURE , 0 + 7200,HAKU , 0 + 7200,PLAY , 1 + 7200,PLAY , 5 + 7320,HAKU , 0 + 7320,PLAY , 10 + 7320,PLAY , 13 + 7440,HAKU , 0 + 7440,PLAY , 11 + 7440,PLAY , 15 + 7500,PLAY , 9 + 7560,HAKU , 0 + 7560,PLAY , 3 + 7560,PLAY , 7 + 7620,PLAY , 1 + 7680,MEASURE , 0 + 7680,HAKU , 0 + 7680,PLAY , 0 + 7680,PLAY , 2 + 7800,HAKU , 0 + 7800,PLAY , 13 + 7800,PLAY , 15 + 7920,HAKU , 0 + 7920,PLAY , 5 + 7920,PLAY , 7 + 7920,PLAY , 8 + 7920,PLAY , 10 + 8040,HAKU , 0 + 8040,PLAY , 14 + 8100,PLAY , 1 + 8160,MEASURE , 0 + 8160,HAKU , 0 + 8280,HAKU , 0 + 8280,PLAY , 0 + 8280,PLAY , 3 + 8280,PLAY , 8 + 8280,PLAY , 11 + 8400,HAKU , 0 + 8400,PLAY , 2 + 8400,PLAY , 4 + 8400,PLAY , 9 + 8520,HAKU , 0 + 8520,PLAY , 10 + 8520,PLAY , 13 + 8580,PLAY , 1 + 8580,PLAY , 6 + 8640,MEASURE , 0 + 8640,HAKU , 0 + 8640,PLAY , 3 + 8640,PLAY , 8 + 8640,PLAY , 12 + 8760,HAKU , 0 + 8760,PLAY , 0 + 8760,PLAY , 11 + 8760,PLAY , 15 + 8880,HAKU , 0 + 8880,PLAY , 4 + 8880,PLAY , 7 + 8880,PLAY , 10 + 9000,HAKU , 0 + 9000,PLAY , 9 + 9000,PLAY , 14 + 9060,PLAY , 2 + 9060,PLAY , 5 + 9120,MEASURE , 0 + 9120,HAKU , 0 + 9120,PLAY , 0 + 9120,PLAY , 1 + 9120,PLAY , 3 + 9240,HAKU , 0 + 9240,PLAY , 12 + 9240,PLAY , 13 + 9240,PLAY , 15 + 9360,HAKU , 0 + 9360,PLAY , 4 + 9360,PLAY , 6 + 9360,PLAY , 9 + 9480,HAKU , 0 + 9480,PLAY , 5 + 9480,PLAY , 7 + 9480,PLAY , 10 + 9576,PLAY , 1 + 9576,PLAY , 8 + 9600,MEASURE , 0 + 9600,HAKU , 0 + 9660,PLAY , 3 + 9720,HAKU , 0 + 9720,PLAY , 4 + 9756,PLAY , 6 + 9780,PLAY , 9 + 9840,HAKU , 0 + 9840,PLAY , 11 + 9900,PLAY , 0 + 9900,PLAY , 2 + 9900,PLAY , 5 + 9900,PLAY , 7 + 9960,HAKU , 0 + 9996,PLAY , 12 + 9996,PLAY , 15 + 10080,MEASURE , 0 + 10080,HAKU , 0 + 10080,PLAY , 3 + 10080,PLAY , 6 + 10200,HAKU , 0 + 10200,PLAY , 4 + 10200,PLAY , 8 + 10200,PLAY , 13 + 10200,PLAY , 14 + 10320,HAKU , 0 + 10320,PLAY , 0 + 10320,PLAY , 2 + 10380,PLAY , 5 + 10440,HAKU , 0 + 10440,PLAY , 1 + 10440,PLAY , 3 + 10500,PLAY , 6 + 10560,MEASURE , 0 + 10560,HAKU , 0 + 10560,PLAY , 9 + 10560,PLAY , 11 + 10680,HAKU , 0 + 10680,PLAY , 7 + 10710,PLAY , 2 + 10800,HAKU , 0 + 10800,PLAY , 0 + 10800,PLAY , 4 + 10860,PLAY , 6 + 10920,HAKU , 0 + 10920,PLAY , 8 + 10920,PLAY , 12 + 10980,PLAY , 14 + 11040,MEASURE , 0 + 11040,HAKU , 0 + 11040,PLAY , 1 + 11040,PLAY , 5 + 11160,HAKU , 0 + 11160,PLAY , 10 + 11160,PLAY , 13 + 11280,HAKU , 0 + 11280,PLAY , 11 + 11280,PLAY , 15 + 11340,PLAY , 9 + 11400,HAKU , 0 + 11400,PLAY , 3 + 11400,PLAY , 7 + 11460,PLAY , 1 + 11520,MEASURE , 0 + 11520,HAKU , 0 + 11520,PLAY , 0 + 11520,PLAY , 2 + 11640,HAKU , 0 + 11640,PLAY , 13 + 11640,PLAY , 15 + 11760,HAKU , 0 + 11760,PLAY , 5 + 11760,PLAY , 7 + 11760,PLAY , 8 + 11760,PLAY , 10 + 11880,HAKU , 0 + 11880,PLAY , 14 + 11940,PLAY , 1 + 12000,MEASURE , 0 + 12000,HAKU , 0 + 12000,PLAY , 3 + 12000,PLAY , 11 + 12090,PLAY , 9 + 12120,HAKU , 0 + 12120,PLAY , 4 + 12120,PLAY , 12 + 12240,HAKU , 0 + 12240,PLAY , 7 + 12240,PLAY , 15 + 12300,PLAY , 5 + 12360,HAKU , 0 + 12360,PLAY , 13 + 12420,PLAY , 2 + 12480,MEASURE , 0 + 12480,HAKU , 0 + 12480,PLAY , 0 + 12480,PLAY , 8 + 12570,PLAY , 10 + 12600,HAKU , 0 + 12600,PLAY , 7 + 12600,PLAY , 15 + 12720,HAKU , 0 + 12720,PLAY , 4 + 12720,PLAY , 12 + 12780,PLAY , 6 + 12840,HAKU , 0 + 12840,PLAY , 14 + 12900,PLAY , 1 + 12960,MEASURE , 0 + 12960,HAKU , 0 + 12960,PLAY , 3 + 12960,PLAY , 11 + 13050,PLAY , 9 + 13080,HAKU , 0 + 13080,PLAY , 4 + 13080,PLAY , 12 + 13200,HAKU , 0 + 13200,PLAY , 7 + 13200,PLAY , 15 + 13260,PLAY , 5 + 13320,HAKU , 0 + 13320,PLAY , 13 + 13380,PLAY , 2 + 13440,MEASURE , 0 + 13440,HAKU , 0 + 13440,PLAY , 0 + 13440,PLAY , 8 + 13530,PLAY , 10 + 13560,HAKU , 0 + 13560,PLAY , 7 + 13560,PLAY , 15 + 13680,HAKU , 0 + 13680,PLAY , 1 + 13680,PLAY , 3 + 13770,PLAY , 9 + 13800,HAKU , 0 + 13800,PLAY , 4 + 13800,PLAY , 12 + 13920,MEASURE , 0 + 13920,HAKU , 0 + 13920,PLAY , 5 + 13920,PLAY , 15 + 14010,PLAY , 0 + 14010,PLAY , 10 + 14040,HAKU , 0 + 14160,HAKU , 0 + 14160,PLAY , 4 + 14160,PLAY , 12 + 14220,PLAY , 6 + 14280,HAKU , 0 + 14280,PLAY , 14 + 14340,PLAY , 1 + 14400,MEASURE , 0 + 14400,HAKU , 0 + 14400,PLAY , 3 + 14400,PLAY , 11 + 14490,PLAY , 9 + 14520,HAKU , 0 + 14520,PLAY , 4 + 14520,PLAY , 12 + 14640,HAKU , 0 + 14640,PLAY , 7 + 14640,PLAY , 15 + 14700,PLAY , 5 + 14760,HAKU , 0 + 14760,PLAY , 13 + 14820,PLAY , 2 + 14880,MEASURE , 0 + 14880,HAKU , 0 + 14880,PLAY , 0 + 14880,PLAY , 8 + 14970,PLAY , 10 + 15000,HAKU , 0 + 15000,PLAY , 7 + 15000,PLAY , 15 + 15120,HAKU , 0 + 15120,PLAY , 4 + 15120,PLAY , 12 + 15180,PLAY , 6 + 15240,HAKU , 0 + 15240,PLAY , 14 + 15300,PLAY , 1 + 15360,MEASURE , 0 + 15360,HAKU , 0 + 15360,PLAY , 3 + 15360,PLAY , 11 + 15450,PLAY , 9 + 15480,HAKU , 0 + 15480,PLAY , 4 + 15480,PLAY , 12 + 15600,HAKU , 0 + 15600,PLAY , 0 + 15600,PLAY , 2 + 15690,PLAY , 10 + 15720,HAKU , 0 + 15720,PLAY , 7 + 15720,PLAY , 15 + 15840,MEASURE , 0 + 15840,HAKU , 0 + 15840,PLAY , 1 + 15840,PLAY , 3 + 15840,PLAY , 12 + 15840,PLAY , 14 + 15960,HAKU , 0 + 15960,PLAY , 4 + 16020,PLAY , 2 + 16080,HAKU , 0 + 16080,PLAY , 9 + 16140,PLAY , 7 + 16200,HAKU , 0 + 16200,PLAY , 5 + 16260,PLAY , 14 + 16320,MEASURE , 0 + 16320,HAKU , 0 + 16320,PLAY , 0 + 16320,PLAY , 6 + 16416,PLAY , 2 + 16416,PLAY , 4 + 16440,HAKU , 0 + 16500,PLAY , 9 + 16500,PLAY , 15 + 16560,HAKU , 0 + 16620,PLAY , 12 + 16680,HAKU , 0 + 16680,PLAY , 7 + 16740,PLAY , 14 + 16800,MEASURE , 0 + 16800,HAKU , 0 + 16800,PLAY , 8 + 16860,PLAY , 0 + 16860,PLAY , 5 + 16920,HAKU , 0 + 16920,PLAY , 9 + 16980,PLAY , 1 + 16980,PLAY , 4 + 17040,HAKU , 0 + 17040,PLAY , 10 + 17100,PLAY , 2 + 17100,PLAY , 7 + 17160,HAKU , 0 + 17160,PLAY , 8 + 17160,PLAY , 13 + 17280,MEASURE , 0 + 17280,HAKU , 0 + 17280,PLAY , 11 + 17340,PLAY , 3 + 17340,PLAY , 6 + 17400,HAKU , 0 + 17400,PLAY , 10 + 17460,PLAY , 2 + 17460,PLAY , 7 + 17520,HAKU , 0 + 17520,PLAY , 9 + 17580,PLAY , 1 + 17580,PLAY , 4 + 17640,HAKU , 0 + 17640,PLAY , 13 + 17640,PLAY , 14 + 17760,MEASURE , 0 + 17760,HAKU , 0 + 17760,PLAY , 8 + 17820,PLAY , 6 + 17880,HAKU , 0 + 17880,PLAY , 0 + 17940,PLAY , 3 + 18000,HAKU , 0 + 18000,PLAY , 11 + 18120,HAKU , 0 + 18120,PLAY , 5 + 18180,PLAY , 13 + 18240,MEASURE , 0 + 18240,HAKU , 0 + 18240,PLAY , 2 + 18240,PLAY , 7 + 18300,PLAY , 1 + 18300,PLAY , 4 + 18360,HAKU , 0 + 18396,PLAY , 10 + 18420,PLAY , 9 + 18480,HAKU , 0 + 18480,PLAY , 3 + 18480,PLAY , 11 + 18600,HAKU , 0 + 18600,PLAY , 12 + 18600,PLAY , 14 + 18660,PLAY , 13 + 18720,MEASURE , 0 + 18720,HAKU , 0 + 18720,PLAY , 8 + 18780,PLAY , 0 + 18780,PLAY , 5 + 18840,HAKU , 0 + 18840,PLAY , 9 + 18900,PLAY , 1 + 18900,PLAY , 4 + 18960,HAKU , 0 + 18960,PLAY , 10 + 19020,PLAY , 2 + 19020,PLAY , 7 + 19080,HAKU , 0 + 19080,PLAY , 8 + 19080,PLAY , 13 + 19200,MEASURE , 0 + 19200,HAKU , 0 + 19200,PLAY , 11 + 19260,PLAY , 3 + 19260,PLAY , 6 + 19320,HAKU , 0 + 19320,PLAY , 10 + 19380,PLAY , 2 + 19380,PLAY , 7 + 19440,HAKU , 0 + 19440,PLAY , 9 + 19500,PLAY , 1 + 19500,PLAY , 4 + 19560,HAKU , 0 + 19560,PLAY , 13 + 19560,PLAY , 14 + 19680,MEASURE , 0 + 19680,HAKU , 0 + 19680,PLAY , 0 + 19680,PLAY , 3 + 19680,PLAY , 8 + 19680,PLAY , 11 + 19800,HAKU , 0 + 19800,PLAY , 7 + 19836,PLAY , 4 + 19860,PLAY , 5 + 19896,PLAY , 15 + 19920,HAKU , 0 + 19920,PLAY , 14 + 19956,PLAY , 12 + 19980,PLAY , 13 + 20016,PLAY , 6 + 20040,HAKU , 0 + 20076,PLAY , 8 + 20100,PLAY , 9 + 20136,PLAY , 11 + 20160,MEASURE , 0 + 20160,HAKU , 0 + 20160,PLAY , 10 + 20220,PLAY , 1 + 20256,PLAY , 3 + 20280,HAKU , 0 + 20280,PLAY , 2 + 20340,PLAY , 5 + 20376,PLAY , 7 + 20400,HAKU , 0 + 20400,PLAY , 6 + 20436,PLAY , 4 + 20496,PLAY , 12 + 20496,PLAY , 14 + 20520,HAKU , 0 + 20580,PLAY , 9 + 20616,PLAY , 2 + 20640,MEASURE , 0 + 20640,HAKU , 0 + 20676,PLAY , 0 + 20700,PLAY , 1 + 20736,PLAY , 7 + 20760,HAKU , 0 + 20760,PLAY , 6 + 20796,PLAY , 4 + 20820,PLAY , 5 + 20856,PLAY , 10 + 20880,HAKU , 0 + 20916,PLAY , 8 + 20940,PLAY , 9 + 20976,PLAY , 15 + 21000,HAKU , 0 + 21000,PLAY , 14 + 21036,PLAY , 12 + 21060,PLAY , 13 + 21120,MEASURE , 0 + 21120,HAKU , 0 + 21120,PLAY , 11 + 21156,PLAY , 1 + 21180,PLAY , 2 + 21216,PLAY , 5 + 21240,HAKU , 0 + 21240,PLAY , 6 + 21276,PLAY , 9 + 21360,HAKU , 0 + 21360,PLAY , 7 + 21360,PLAY , 15 + 21456,PLAY , 0 + 21456,PLAY , 8 + 21480,HAKU , 0 + 21540,PLAY , 12 + 21540,PLAY , 14 + 21600,MEASURE , 0 + 21600,HAKU , 0 + 21600,PLAY , 11 + 21636,PLAY , 9 + 21660,PLAY , 10 + 21696,PLAY , 5 + 21720,HAKU , 0 + 21720,PLAY , 6 + 21756,PLAY , 1 + 21780,PLAY , 2 + 21840,HAKU , 0 + 21840,PLAY , 8 + 21876,PLAY , 14 + 21900,PLAY , 13 + 21936,PLAY , 4 + 21960,HAKU , 0 + 21996,PLAY , 12 + 22080,MEASURE , 0 + 22080,HAKU , 0 + 22080,PLAY , 3 + 22104,PLAY , 7 + 22116,PLAY , 11 + 22140,PLAY , 15 + 22176,PLAY , 9 + 22200,HAKU , 0 + 22200,PLAY , 2 + 22224,PLAY , 6 + 22236,PLAY , 10 + 22260,PLAY , 14 + 22296,PLAY , 8 + 22320,HAKU , 0 + 22320,PLAY , 1 + 22380,PLAY , 13 + 22440,HAKU , 0 + 22440,PLAY , 0 + 22500,PLAY , 12 + 22560,MEASURE , 0 + 22560,HAKU , 0 + 22560,PLAY , 15 + 22680,HAKU , 0 + 22680,PLAY , 11 + 22716,PLAY , 9 + 22740,PLAY , 8 + 22800,HAKU , 0 + 22800,PLAY , 7 + 22920,HAKU , 0 + 22920,PLAY , 3 + 22956,PLAY , 1 + 22980,PLAY , 0 + 23016,PLAY , 2 + 23040,MEASURE , 0 + 23040,HAKU , 0 + 23040,PLAY , 6 + 23160,HAKU , 0 + 23160,PLAY , 13 + 23160,PLAY , 14 + 23280,HAKU , 0 + 23280,PLAY , 3 + 23280,PLAY , 5 + 23340,PLAY , 10 + 23340,PLAY , 12 + 23400,HAKU , 0 + 23400,PLAY , 0 + 23400,PLAY , 6 + 23460,PLAY , 9 + 23460,PLAY , 15 + 23520,MEASURE , 0 + 23520,HAKU , 0 + 23640,HAKU , 0 + 23760,HAKU , 0 + 23880,HAKU , 0 + 23880,PLAY , 0 + 23880,PLAY , 3 + 23880,PLAY , 8 + 23880,PLAY , 11 + 24000,MEASURE , 0 + 24000,HAKU , 0 + 24000,PLAY , 4 + 24000,PLAY , 6 + 24000,PLAY , 13 + 24000,PLAY , 15 + 24120,HAKU , 0 + 24120,PLAY , 5 + 24120,PLAY , 7 + 24120,PLAY , 12 + 24120,PLAY , 14 + 24240,HAKU , 0 + 24240,PLAY , 0 + 24240,PLAY , 2 + 24240,PLAY , 9 + 24240,PLAY , 11 + 24300,PLAY , 10 + 24360,HAKU , 0 + 24360,PLAY , 3 + 24420,PLAY , 15 + 24480,MEASURE , 0 + 24480,HAKU , 0 + 24480,PLAY , 5 + 24480,PLAY , 7 + 24480,PLAY , 12 + 24480,PLAY , 14 + 24600,HAKU , 0 + 24600,PLAY , 0 + 24600,PLAY , 2 + 24600,PLAY , 9 + 24600,PLAY , 11 + 24660,PLAY , 10 + 24720,HAKU , 0 + 24720,PLAY , 8 + 24720,PLAY , 13 + 24840,HAKU , 0 + 24840,PLAY , 1 + 24840,PLAY , 3 + 24900,PLAY , 4 + 24900,PLAY , 6 + 24960,MEASURE , 0 + 24960,HAKU , 0 + 24960,PLAY , 9 + 24960,PLAY , 11 + 25080,HAKU , 0 + 25080,PLAY , 0 + 25080,PLAY , 2 + 25080,PLAY , 8 + 25140,PLAY , 5 + 25200,HAKU , 0 + 25236,PLAY , 14 + 25260,PLAY , 13 + 25320,HAKU , 0 + 25320,PLAY , 4 + 25320,PLAY , 7 + 25380,PLAY , 10 + 25404,PLAY , 9 + 25440,MEASURE , 0 + 25440,HAKU , 0 + 25440,PLAY , 3 + 25440,PLAY , 6 + 25440,PLAY , 11 + 25500,PLAY , 15 + 25560,HAKU , 0 + 25560,PLAY , 12 + 25656,PLAY , 7 + 25680,HAKU , 0 + 25680,PLAY , 0 + 25680,PLAY , 5 + 25680,PLAY , 8 + 25800,HAKU , 0 + 25800,PLAY , 1 + 25800,PLAY , 2 + 25800,PLAY , 4 + 25920,MEASURE , 0 + 25920,HAKU , 0 + 25920,PLAY , 3 + 25920,PLAY , 6 + 25920,PLAY , 9 + 26040,HAKU , 0 + 26040,PLAY , 13 + 26040,PLAY , 14 + 26160,HAKU , 0 + 26160,PLAY , 4 + 26160,PLAY , 11 + 26220,PLAY , 7 + 26220,PLAY , 8 + 26280,HAKU , 0 + 26280,PLAY , 0 + 26280,PLAY , 15 + 26340,PLAY , 3 + 26340,PLAY , 12 + 26400,MEASURE , 0 + 26400,HAKU , 0 + 26400,PLAY , 1 + 26400,PLAY , 2 + 26400,PLAY , 13 + 26400,PLAY , 14 + 26520,HAKU , 0 + 26520,PLAY , 5 + 26520,PLAY , 10 + 26640,HAKU , 0 + 26640,PLAY , 7 + 26640,PLAY , 8 + 26700,PLAY , 4 + 26700,PLAY , 11 + 26760,HAKU , 0 + 26760,PLAY , 3 + 26760,PLAY , 12 + 26820,PLAY , 0 + 26820,PLAY , 15 + 26880,MEASURE , 0 + 26880,HAKU , 0 + 26880,PLAY , 1 + 26880,PLAY , 2 + 26880,PLAY , 13 + 26880,PLAY , 14 + 27000,HAKU , 0 + 27000,PLAY , 6 + 27000,PLAY , 9 + 27060,PLAY , 5 + 27060,PLAY , 10 + 27120,HAKU , 0 + 27120,PLAY , 7 + 27120,PLAY , 8 + 27180,PLAY , 4 + 27180,PLAY , 11 + 27240,HAKU , 0 + 27240,PLAY , 1 + 27240,PLAY , 14 + 27300,PLAY , 3 + 27300,PLAY , 12 + 27360,MEASURE , 0 + 27360,HAKU , 0 + 27360,PLAY , 0 + 27360,PLAY , 6 + 27360,PLAY , 9 + 27360,PLAY , 15 + 27480,HAKU , 0 + 27480,PLAY , 7 + 27480,PLAY , 10 + 27480,PLAY , 13 + 27600,HAKU , 0 + 27600,PLAY , 2 + 27600,PLAY , 5 + 27600,PLAY , 8 + 27720,HAKU , 0 + 27720,PLAY , 15 + 27780,PLAY , 0 + 27840,MEASURE , 0 + 27840,HAKU , 0 + 27960,HAKU , 0 + 27960,PLAY , 2 + 27960,PLAY , 4 + 27960,PLAY , 11 + 27960,PLAY , 13 + 28080,HAKU , 0 + 28080,PLAY , 1 + 28080,PLAY , 3 + 28080,PLAY , 8 + 28080,PLAY , 10 + 28140,PLAY , 9 + 28200,HAKU , 0 + 28200,PLAY , 0 + 28260,PLAY , 12 + 28320,MEASURE , 0 + 28320,HAKU , 0 + 28320,PLAY , 4 + 28320,PLAY , 6 + 28320,PLAY , 13 + 28320,PLAY , 15 + 28440,HAKU , 0 + 28440,PLAY , 1 + 28440,PLAY , 3 + 28440,PLAY , 8 + 28440,PLAY , 10 + 28500,PLAY , 9 + 28560,HAKU , 0 + 28560,PLAY , 11 + 28560,PLAY , 14 + 28680,HAKU , 0 + 28680,PLAY , 0 + 28680,PLAY , 2 + 28740,PLAY , 5 + 28740,PLAY , 7 + 28800,MEASURE , 0 + 28800,HAKU , 0 + 28800,PLAY , 8 + 28800,PLAY , 10 + 28920,HAKU , 0 + 28920,PLAY , 1 + 28920,PLAY , 3 + 28920,PLAY , 11 + 28980,PLAY , 6 + 29040,HAKU , 0 + 29076,PLAY , 13 + 29100,PLAY , 14 + 29160,HAKU , 0 + 29160,PLAY , 4 + 29160,PLAY , 7 + 29220,PLAY , 9 + 29244,PLAY , 10 + 29280,MEASURE , 0 + 29280,HAKU , 0 + 29280,PLAY , 0 + 29280,PLAY , 5 + 29280,PLAY , 8 + 29340,PLAY , 12 + 29400,HAKU , 0 + 29400,PLAY , 15 + 29496,PLAY , 4 + 29520,HAKU , 0 + 29520,PLAY , 3 + 29520,PLAY , 6 + 29520,PLAY , 11 + 29640,HAKU , 0 + 29640,PLAY , 1 + 29640,PLAY , 2 + 29640,PLAY , 7 + 29760,MEASURE , 0 + 29760,HAKU , 0 + 29760,PLAY , 0 + 29760,PLAY , 5 + 29760,PLAY , 10 + 29880,HAKU , 0 + 29880,PLAY , 13 + 29880,PLAY , 14 + 30000,HAKU , 0 + 30000,PLAY , 7 + 30000,PLAY , 8 + 30060,PLAY , 4 + 30060,PLAY , 11 + 30120,HAKU , 0 + 30120,PLAY , 3 + 30120,PLAY , 12 + 30180,PLAY , 0 + 30180,PLAY , 15 + 30240,MEASURE , 0 + 30240,HAKU , 0 + 30240,PLAY , 1 + 30240,PLAY , 2 + 30240,PLAY , 13 + 30240,PLAY , 14 + 30360,HAKU , 0 + 30360,PLAY , 6 + 30360,PLAY , 9 + 30480,HAKU , 0 + 30480,PLAY , 4 + 30480,PLAY , 11 + 30540,PLAY , 7 + 30540,PLAY , 8 + 30600,HAKU , 0 + 30600,PLAY , 0 + 30600,PLAY , 15 + 30660,PLAY , 3 + 30660,PLAY , 12 + 30720,MEASURE , 0 + 30720,HAKU , 0 + 30720,PLAY , 1 + 30720,PLAY , 2 + 30720,PLAY , 13 + 30720,PLAY , 14 + 30840,HAKU , 0 + 30840,PLAY , 5 + 30840,PLAY , 10 + 30900,PLAY , 6 + 30900,PLAY , 9 + 30960,HAKU , 0 + 30960,PLAY , 4 + 30960,PLAY , 11 + 31020,PLAY , 7 + 31020,PLAY , 8 + 31080,HAKU , 0 + 31080,PLAY , 2 + 31080,PLAY , 13 + 31140,PLAY , 0 + 31140,PLAY , 15 + 31200,MEASURE , 0 + 31200,HAKU , 0 + 31200,PLAY , 3 + 31200,PLAY , 5 + 31200,PLAY , 10 + 31200,PLAY , 12 + 31320,HAKU , 0 + 31320,PLAY , 4 + 31320,PLAY , 9 + 31320,PLAY , 14 + 31440,HAKU , 0 + 31440,PLAY , 1 + 31440,PLAY , 6 + 31440,PLAY , 11 + 31560,HAKU , 0 + 31560,PLAY , 2 + 31560,PLAY , 5 + 31560,PLAY , 7 + 31560,PLAY , 8 + 31560,PLAY , 10 + 31560,PLAY , 13 + 31680,MEASURE , 0 + 31680,HAKU , 0 + 31680,PLAY , 12 + 31680,PLAY , 15 + 31800,HAKU , 0 + 31800,PLAY , 0 + 31800,PLAY , 3 + 31860,PLAY , 4 + 31860,PLAY , 6 + 31860,PLAY , 9 + 31860,PLAY , 11 + 31920,HAKU , 0 + 31980,PLAY , 14 + 32010,PLAY , 13 + 32040,HAKU , 0 + 32040,PLAY , 12 + 32100,PLAY , 5 + 32100,PLAY , 7 + 32100,PLAY , 8 + 32100,PLAY , 10 + 32160,MEASURE , 0 + 32160,HAKU , 0 + 32220,PLAY , 4 + 32220,PLAY , 6 + 32220,PLAY , 9 + 32220,PLAY , 11 + 32280,HAKU , 0 + 32340,PLAY , 0 + 32340,PLAY , 2 + 32340,PLAY , 13 + 32340,PLAY , 15 + 32400,HAKU , 0 + 32460,PLAY , 1 + 32460,PLAY , 3 + 32460,PLAY , 12 + 32460,PLAY , 14 + 32520,HAKU , 0 + 32580,PLAY , 4 + 32580,PLAY , 5 + 32580,PLAY , 6 + 32580,PLAY , 7 + 32580,PLAY , 9 + 32580,PLAY , 10 + 32640,MEASURE , 0 + 32640,HAKU , 0 + 32760,HAKU , 0 + 32880,HAKU , 0 + 33000,HAKU , 0 + 33120,MEASURE , 0 + 33120,HAKU , 0 + 33120,PLAY , 10 + 33120,PLAY , 11 + 33120,PLAY , 14 + 33120,PLAY , 15 + 33240,HAKU , 0 + 33360,HAKU , 0 + 33480,HAKU , 0 + 33600,MEASURE , 0 + 33600,HAKU , 0 + 33720,HAKU , 0 + 33840,HAKU , 0 + 33960,HAKU , 0 + 34080,MEASURE , 0 + 34080,HAKU , 0 + 34200,HAKU , 0 + 34320,HAKU , 0 + 34440,HAKU , 0 + 34560,END , 0 + 34560,MEASURE , 0 + 34560,HAKU , 0 + 34680,HAKU , 0 + 34800,HAKU , 0 + 34920,HAKU , 0 + 35040,MEASURE , 0 + 35040,HAKU , 0 + 35160,HAKU , 0 + 35280,HAKU , 0 + 35400,HAKU , 0 + 35520,MEASURE , 0 + 35520,HAKU , 0 + 35640,HAKU , 0 + 35760,HAKU , 0 + 35880,HAKU , 0 + 36000,MEASURE , 0 + 36000,HAKU , 0 + 36120,HAKU , 0 + 36240,HAKU , 0 + 36360,HAKU , 0 + 36480,MEASURE , 0 + 36480,HAKU , 0 + 36600,HAKU , 0 + 36720,HAKU , 0 + 36840,HAKU , 0 + 36960,MEASURE , 0 + 36960,HAKU , 0 + 37080,HAKU , 0 + 37200,HAKU , 0 + 37320,HAKU , 0 + 37440,MEASURE , 0 + 37440,HAKU , 0 + 37560,HAKU , 0 + 37680,HAKU , 0 + 37800,HAKU , 0 + 37920,MEASURE , 0 + 37920,HAKU , 0 + 38040,HAKU , 0 + 38160,HAKU , 0 + 38280,HAKU , 0 + 38400,MEASURE , 0 + 38400,HAKU , 0 + 38520,HAKU , 0 + 38640,HAKU , 0 + 38760,HAKU , 0 + 38880,MEASURE , 0 + 38880,HAKU , 0 + 39000,HAKU , 0 + 39120,HAKU , 0 + 39240,HAKU , 0 + 39360,MEASURE , 0 + 39360,HAKU , 0 + 39480,HAKU , 0 + 39600,HAKU , 0 + 39720,HAKU , 0 + 39840,MEASURE , 0 + 39840,HAKU , 0 + 39960,HAKU , 0 + 40080,HAKU , 0 + 40200,HAKU , 0 + 40320,MEASURE , 0 + 40320,HAKU , 0 + 40440,HAKU , 0 + 40560,HAKU , 0 + 40680,HAKU , 0 + 40800,MEASURE , 0 + 40800,HAKU , 0 + 40920,HAKU , 0 + 41040,HAKU , 0 + 41160,HAKU , 0 + 41280,MEASURE , 0 + 41280,HAKU , 0 + 41400,HAKU , 0 + 41520,HAKU , 0 + 41640,HAKU , 0 + 41760,MEASURE , 0 + 41760,HAKU , 0 + 41880,HAKU , 0 + 42000,HAKU , 0 + 42120,HAKU , 0 + 42240,MEASURE , 0 + 42240,HAKU , 0 + 42360,HAKU , 0 + 42480,HAKU , 0 + 42600,HAKU , 0 diff --git a/jubeatools/cli/tests/data/__init__.py b/jubeatools/cli/tests/data/__init__.py new file mode 100644 index 0000000..de5849e --- /dev/null +++ b/jubeatools/cli/tests/data/__init__.py @@ -0,0 +1,2 @@ +"""This file is here so the test code can use importlib as a portable way to +open test data in this folder""" diff --git a/jubeatools/cli/tests/test_cli.py b/jubeatools/cli/tests/test_cli.py new file mode 100644 index 0000000..a11cbba --- /dev/null +++ b/jubeatools/cli/tests/test_cli.py @@ -0,0 +1,20 @@ +from importlib import resources + +from click.testing import CliRunner + +from ..cli import convert +from . import data + + +def test_that_ommiting_beat_snap_works() -> None: + """ + As pointed out by https://github.com/Stepland/jubeatools/issues/17 + """ + runner = CliRunner() + with runner.isolated_filesystem(), resources.path( + data, "Life Without You.eve" + ) as p: + result = runner.invoke( + convert, [str(p.resolve(strict=True)), "out.txt", "-f", "memo2"] + ) + assert result.exit_code == 0 diff --git a/jubeatools/testutils/strategies.py b/jubeatools/testutils/strategies.py index 2ca20e6..2c40d4c 100644 --- a/jubeatools/testutils/strategies.py +++ b/jubeatools/testutils/strategies.py @@ -69,7 +69,8 @@ def note_position(draw: st.DrawFn) -> NotePosition: @st.composite def tap_note( - draw: st.DrawFn, time_strat: st.SearchStrategy[BeatsTime] = beat_time(max_section=10) + draw: st.DrawFn, + time_strat: st.SearchStrategy[BeatsTime] = beat_time(max_section=10), ) -> TapNote: time = draw(time_strat) position = draw(note_position())