Skip to main content

A beet plugin for importing songs into Minecraft

Project description

pigstep

GitHub Actions PyPI PyPI - Python Version Code style: black

A beet plugin for importing songs into Minecraft.

Introduction

This beet plugin lets you include songs created with Open Note Block Studio in your project. It takes care of converting .nbs files to data packs.

Features

  • Keep .nbs files alongside the rest of your project
  • Embed note block studio songs into your output data pack
  • Automatically bundle extra notes when needed to support 6 octaves
  • Efficient function tree generation and chord deduplication
  • Flexible, can be used for making custom visualizers

Why not just export from Note Block Studio directly?

  • It's a bit more convenient to set up the plugin once and then have it automatically convert the latest version of the song
  • Less clutter, you can forget about having to navigate around the generated files
  • The plugin bundles the sound files required by your songs, no need to remember to activate the extra notes resource pack or to copy the sounds you need when you start using them

Installation

The package can be installed with pip.

$ pip install pigstep

Usage

The plugin generates scoreboard objectives that must be included in the output data pack. If you're not using it already, running the beet.contrib.scoreboard plugin at the end of the pipeline will create a function that adds all the generated objectives for you.

{
  "pipeline": ["pigstep", "beet.contrib.scoreboard"],
  "meta": {
    "pigstep": {
      "load": ["*.nbs"],
      "source": "ambient",
      "templates": {
        "play": "custom_play.mcfunction"
      }
    }
  }
}

You can require the plugin programmatically by using the pigstep plugin factory.

from beet import Context
from pigstep import pigstep

def my_plugin(ctx: Context):
    ctx.require(
        pigstep(
            load=["*.nbs"],
            source="ambient",
            templates={"play": "custom_play.mcfunction"},
        )
    )

All the configuration is optional. The plugin is a no-op if the load option is not specified or empty. The source option defaults to record. The templates option lets you override the templates used by the plugin.

Here are the functions generated for each song:

  • {namespace}:song/{song_name}/play - Play the song
  • {namespace}:song/{song_name}/pause - Pause the song, to resume run the play function again
  • {namespace}:song/{song_name}/stop - Stop the song, playing the song again will start from the beginning

Contributing

Contributions are welcome. Make sure to first open an issue discussing the problem or the new feature before creating a pull request. The project uses poetry.

$ poetry install

You can run the tests with poetry run pytest.

$ poetry run pytest

The project must type-check with pyright. If you're using VSCode the pylance extension should report diagnostics automatically. You can also install the type-checker locally with npm install and run it from the command-line.

$ npm run watch
$ npm run check

The code follows the black code style. Import statements are sorted with isort.

$ poetry run isort pigstep tests
$ poetry run black pigstep tests
$ poetry run black --check pigstep tests

License - MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pigstep-0.2.1.tar.gz (287.4 kB view details)

Uploaded Source

Built Distribution

pigstep-0.2.1-py3-none-any.whl (381.0 kB view details)

Uploaded Python 3

File details

Details for the file pigstep-0.2.1.tar.gz.

File metadata

  • Download URL: pigstep-0.2.1.tar.gz
  • Upload date:
  • Size: 287.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for pigstep-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b348c798f7a923bae1543fa18a75c6b6054218f2292fdb95ffee220e82537c3c
MD5 2e9306d940043ca86bb836c2a6c5d728
BLAKE2b-256 6488c29ff79e83c6d38b0ad2d5842af7494becd81237cfe584f0a5a1e2101acb

See more details on using hashes here.

File details

Details for the file pigstep-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pigstep-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 381.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for pigstep-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f3e58f05b748c3add1089992f1431a26be4179cd9b52ecb2043882edcf9906fd
MD5 e69d5846806a4378d84b19fd9bc3aea5
BLAKE2b-256 60e1a3859449b322daebe2c3e926d08353795e6f27ce4ce71b391bb1e31c20c3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page