Skip to main content

[mus]escore [d]own[l]oader, ported from TypeScript

Project description

musdl

logo

Code style: black PyPI - Downloads PyPI - License PyPI PyPI - Python Version Lines of code

NOTE

The author of musdl does NOT condone piracy in any way, and is not responsible for anything that happens as a result of piracy arising from the use of musdl.

musdl (musscore downloader) is a downloader for Musescore, written in Python.

The easiest way to download the score is through the CLI:

musdl (musescore url)

To convert to another format, use -f/--format:

# export as midi
musdl -f mid (musescore url)

For a complete list of formats, run musdl --help. If you want to export in any format besides mscz, you need to install musescore first.

It can also be imported and used as a module:

from musdl import Score, OnlineScore

my_score = OnlineScore("musescore_url")

# Read the score's metadata,
name = my_score["workTitle"]
# or save the whole score...
my_score.export("mscz", "my_score.mscz")

# ...and then load it again.
my_score = Score.from_file("my_score.mscz")

How it works

I just copied over the IPNS-specific constants and used them to download the score file from Xmader's dataset.

Other approaches were considered:

  • Create a native Python interpreter just to decode the musescore js (like Js2py). (Will problably break with every API change.)
  • Use a headless JS browser with Selenium. (Resource-heavy, not really cross-platform.)
  • Run a JS engine like PyMiniRacer/PyQt5. (Better speed, but needs C extensions.)

So I decided to roll with the IPNS dataset.

takedown request, et tu

Take a look at this issue in the same repo.

Requirements

  • requests - Downloader.
  • beautifulsoup4 - Powerful HTML parser.

Hacking

All my python projects now use flit to build and publish. So you need to python3 -m pip install flit first.

flit build

Install

(python3 -m) pip install musdl

Optionally, to export the score in other formats (midi, mp3, etc.) install musescore. musdl relies on its command-line tool mscore to export scores:

# Linux
sudo (package manager/snap) install musescore
# Windows
scoop bucket add extras  # add the extras bucket if you haven't
scoop install musescore

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

musdl-3.1.3.tar.gz (178.9 kB view details)

Uploaded Source

Built Distribution

musdl-3.1.3-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file musdl-3.1.3.tar.gz.

File metadata

  • Download URL: musdl-3.1.3.tar.gz
  • Upload date:
  • Size: 178.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.25.1

File hashes

Hashes for musdl-3.1.3.tar.gz
Algorithm Hash digest
SHA256 459def90e574ec43db1959e02145bf78abf531d440f532b90e53d54d0fc9584f
MD5 b221cb6308700470787889a8973c0542
BLAKE2b-256 3a1722e40f1483a4b6d151ed17ead1276315e476d6c80c164ff0249bedc06027

See more details on using hashes here.

File details

Details for the file musdl-3.1.3-py3-none-any.whl.

File metadata

  • Download URL: musdl-3.1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.25.1

File hashes

Hashes for musdl-3.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3b2b3a4fd766d0740195f4b8355c31f07662a591a15be2c774cbe1ca55c7a99f
MD5 460e3431018c5f151d1577845114589d
BLAKE2b-256 d55768cb6ae7674854d36c8c76fef33f9d5250fe978d26db7f0f40ee16f5324b

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