Load score, performance MIDIs, or match files currently works by providing local paths.
I suggest also supporting loading files directly from URLs such as raw content from GitHub.
This could be easily done with no additional dependencies by using urllib. This is the two functions that we will need to validate the source of a input path and load the data:
from urllib.parse import urlparse
import urllib.request
def load_data_from_url(url: str):
with urllib.request.urlopen(url) as response:
data = response.read().decode()
return data
def is_url(input):
try:
result = urlparse(input)
return all([result.scheme, result.netloc])
except ValueError:
return False
This method could be useful for managing the Partitura test files, as well as scraping scores from repositories and online sources.
Load score, performance MIDIs, or match files currently works by providing local paths. I suggest also supporting loading files directly from URLs such as raw content from GitHub. This could be easily done with no additional dependencies by using
urllib
. This is the two functions that we will need to validate the source of a input path and load the data:This method could be useful for managing the Partitura test files, as well as scraping scores from repositories and online sources.