[mus]escore [d]own[l]oader, ported from TypeScript
Project description
musdl
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file musdl-3.1.2.tar.gz
.
File metadata
- Download URL: musdl-3.1.2.tar.gz
- Upload date:
- Size: 178.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.25.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6ddc14c3526e2def7bacde6eb9f8e2d9057d910efbe2d2a4fdb95e54a26a12b |
|
MD5 | 495068a62f77a499b4174fe0c4a5ef27 |
|
BLAKE2b-256 | 889f5e256f656527e18223f9f586dc4cdabfb118cf03d69e72f86d9b525fdb10 |
File details
Details for the file musdl-3.1.2-py3-none-any.whl
.
File metadata
- Download URL: musdl-3.1.2-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.25.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8141e0971689e43a8acc5e6e6524a52405700c90b049a75fa5fa28ba35f1c1e1 |
|
MD5 | 1afd3accff413176f4544d05990f6026 |
|
BLAKE2b-256 | bb05df302c295cec8e1105b312cb9c6913a8a7f991248b8085e5da4cd7e8c69e |