-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load Scores from URL #404
Merged
Merged
Load Scores from URL #404
Changes from 14 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
ea5bc08
first draft for importing romantext annotations.
manoskary 417c88c
some edits on Rntxt parser for import.
manoskary 4551bff
Merge branch 'dcml_annotation_parser' into rntxt
manoskary 8a87047
Rntxt parser first draft complete.
manoskary 5b5d358
minor changes on RN parser.
manoskary a71a692
some changes and first rntxt test draft.
manoskary 700474e
Minor Changes for Roman Numeral Checking.
manoskary 4e03cd1
Better loading for rntxt format.
manoskary cb14c20
Test case for rntxt import.
manoskary 3929f98
Merge remote-tracking branch 'origin/develop' into rntxt
manoskary ac8d050
Merge remote-tracking branch 'origin/develop' into rntxt
manoskary 578e41d
Update for load from url.
manoskary d209908
New version for RNTXT import.
manoskary 19cf164
Removed rntxt refs.
manoskary e1787fc
set to dlt temp file after url loading
manoskary 59c148c
delete on close fix.
manoskary e41185f
yet another fix for delete on close.
manoskary 108a4a6
fixed temp file delete in url load
manoskary File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import unittest | ||
from partitura import load_score | ||
import numpy as np | ||
|
||
|
||
class TestImport(unittest.TestCase): | ||
def test_load_kern(self): | ||
score = load_score("https://raw.githubusercontent.com/CPJKU/partitura/refs/heads/main/partitura/assets/score_example.krn") | ||
note_array = score.note_array() | ||
self.assertTrue(np.all(note_array["pitch"] == [69, 72, 76])) | ||
|
||
def test_load_mei(self): | ||
score = load_score("https://raw.githubusercontent.com/CPJKU/partitura/refs/heads/main/partitura/assets/score_example.mei") | ||
note_array = score.note_array() | ||
self.assertTrue(np.all(note_array["pitch"] == [69, 72, 76])) | ||
|
||
def test_load_midi(self): | ||
score = load_score("https://raw.githubusercontent.com/CPJKU/partitura/refs/heads/main/partitura/assets/score_example.mid") | ||
note_array = score.note_array() | ||
self.assertTrue(np.all(note_array["pitch"] == [69, 72, 76])) | ||
|
||
def test_load_musicxml(self): | ||
score = load_score("https://raw.githubusercontent.com/CPJKU/partitura/refs/heads/main/partitura/assets/score_example.musicxml") | ||
note_array = score.note_array() | ||
self.assertTrue(np.all(note_array["pitch"] == [69, 72, 76])) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't it be the case that this file is never deleted, and keep accumulating on the computer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree. Probably, I need to find a better solution and debug. The load score file needs access to the file to check the extension but maybe when
delete=True
the file is not deleted immediately when loaded. I will push a change soon.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out that for python version 3.8 the temporary file options are not the same as for newer versions of python therefore I had to add more edits to ensure the deletion of tmp files immediately after the end of the function.