fix populate.py and new musics

This commit is contained in:
GitBluub
2023-03-24 21:37:08 +09:00
committed by Clément Le Bihan
parent 7edc5b75ef
commit be0e41006a
39 changed files with 224 additions and 29693 deletions

View File

@@ -0,0 +1,21 @@
[Metadata]
Name=Bach: Minuet in G Major (BWV Anh. 114)
Artist=Johann Sebastian Bach
Genre=Classical
Album=
[Difficulties]
TwoHands=0
Rhythm=0
NoteCombo=0
Arpeggio=0
Distance=0
LeftHand=0
RightHand=0
LeadHandChange=0
ChordComplexity=0
ChordTiming=0
Length=0
PedalPoint=0
Precision=0

View File

@@ -0,0 +1,21 @@
[Metadata]
Name=Bach: Minuet in G Minor (BWV Anh. 115)
Artist=Christian Petzold
Genre=Classical
Album=
[Difficulties]
TwoHands=0
Rhythm=0
NoteCombo=0
Arpeggio=0
Distance=0
LeftHand=0
RightHand=0
LeadHandChange=0
ChordComplexity=0
ChordTiming=0
Length=0
PedalPoint=0
Precision=0

View File

@@ -0,0 +1,21 @@
[Metadata]
Name=Boogie-Woogie
Artist=Misc Traditional
Genre=Folk
Album=
[Difficulties]
TwoHands=0
Rhythm=0
NoteCombo=0
Arpeggio=0
Distance=0
LeftHand=0
RightHand=0
LeadHandChange=0
ChordComplexity=0
ChordTiming=0
Length=0
PedalPoint=0
Precision=0

Binary file not shown.

Binary file not shown.

View File

@@ -1,21 +1,21 @@
[Metadata]
Name=Symphony No 9 in D Minor
Artist=Beethoven
Name=Canon in D (easy)
Artist=Johann Pachelbel
Genre=Classical
Album=Symphony No 9
Album=
[Difficulties]
TwoHands=0
Rhythm=4
Rhythm=0
NoteCombo=0
Arpeggio=6
Arpeggio=0
Distance=0
LeftHand=2
RightHand=1
LeftHand=0
RightHand=0
LeadHandChange=0
ChordComplexity=0
ChordTiming=0
Length=1
Length=0
PedalPoint=0
Precision=10
Precision=0

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,21 @@
[Metadata]
Name=Carol of the Bells - George Winston
Artist=Mykola Leontovych
Genre=Classical
Album=
[Difficulties]
TwoHands=0
Rhythm=0
NoteCombo=0
Arpeggio=0
Distance=0
LeftHand=0
RightHand=0
LeadHandChange=0
ChordComplexity=0
ChordTiming=0
Length=0
PedalPoint=0
Precision=0

View File

@@ -0,0 +1,21 @@
[Metadata]
Name=Chopin - Funeral March
Artist=Frédéric Chopin
Genre=Classical
Album=
[Difficulties]
TwoHands=0
Rhythm=0
NoteCombo=0
Arpeggio=0
Distance=0
LeftHand=0
RightHand=0
LeadHandChange=0
ChordComplexity=0
ChordTiming=0
Length=0
PedalPoint=0
Precision=0

View File

@@ -3,8 +3,8 @@
Name=Chopin - Nocturne Op 9 No 2 (E Flat Major)
Artist=Frédéric Chopin
Genre=Classical
Album=e
Album=
[Difficulties]
TwoHands=0
Rhythm=0

View File

@@ -0,0 +1,21 @@
[Metadata]
Name=Maple Leaf Rag (Scott Joplin)
Artist=Scott Joplin
Genre=Jazz,Classical
Album=
[Difficulties]
TwoHands=0
Rhythm=0
NoteCombo=0
Arpeggio=0
Distance=0
LeftHand=0
RightHand=0
LeadHandChange=0
ChordComplexity=0
ChordTiming=0
Length=0
PedalPoint=0
Precision=0

View File

@@ -3,8 +3,8 @@
Name=Prelude I in C major, BWV 846 - Well Tempered Clavier [First Book]
Artist=Johann Sebastian Bach
Genre=Classical
Album=e
Album=
[Difficulties]
TwoHands=0
Rhythm=0

View File

@@ -3,8 +3,8 @@
Name=Rachmaninoff - Rhapsody on a theme of Paganini, Variation 18, Solo Piano
Artist=Sergei Rachmaninoff
Genre=Classical
Album=e
Album=
[Difficulties]
TwoHands=0
Rhythm=0

View File

@@ -0,0 +1,21 @@
[Metadata]
Name=Radetzky March - Strauss - For piano
Artist=Johann Strauss Sr.
Genre=Classical
Album=
[Difficulties]
TwoHands=0
Rhythm=0
NoteCombo=0
Arpeggio=0
Distance=0
LeftHand=0
RightHand=0
LeadHandChange=0
ChordComplexity=0
ChordTiming=0
Length=0
PedalPoint=0
Precision=0

View File

@@ -0,0 +1,21 @@
[Metadata]
Name=Vivaldi - Violin Concerto in F minor, Op. 8, No. 4, RV. 297 "Winter" for Solo Piano
Artist=Antonio Vivaldi
Genre=Classical
Album=
[Difficulties]
TwoHands=0
Rhythm=0
NoteCombo=0
Arpeggio=0
Distance=0
LeftHand=0
RightHand=0
LeadHandChange=0
ChordComplexity=0
ChordTiming=0
Length=0
PedalPoint=0
Precision=0

View File

@@ -0,0 +1,21 @@
[Metadata]
Name=Vivaldi Four Seasons: "Winter", First movement - Violin Concerto in F minor, Op. 8, No. 4, RV. 297, I. Allegro non molto
Artist=Antonio Vivaldi
Genre=Classical
Album=
[Difficulties]
TwoHands=0
Rhythm=0
NoteCombo=0
Arpeggio=0
Distance=0
LeftHand=0
RightHand=0
LeadHandChange=0
ChordComplexity=0
ChordTiming=0
Length=0
PedalPoint=0
Precision=0

View File

@@ -3,8 +3,8 @@
Name=Vivaldi's Spring from the Four Seasons, Piano Transcription
Artist=Antonio Vivaldi
Genre=Classical
Album=e
Album=
[Difficulties]
TwoHands=0
Rhythm=0

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<container>
<rootfiles>
<rootfile full-path="score.xml">
</rootfile>
</rootfiles>
</container>

View File

@@ -4,11 +4,13 @@ import sys
import os
import requests
import glob
from configparser import ConfigParser
from configparser import ConfigParser
url = os.environ.get("API_URL")
def getOrCreateAlbum(name, artistId):
if not name:
return
res = requests.post(f"{url}/album", json={
"name": name,
"artist": artistId,
@@ -17,13 +19,17 @@ def getOrCreateAlbum(name, artistId):
print(out)
return out["id"]
def getOrCreateGenre(name):
res = requests.post(f"{url}/genre", json={
"name": name,
})
out = res.json()
print(out)
return out["id"]
def getOrCreateGenre(names):
ids = []
for name in names.split(","):
res = requests.post(f"{url}/genre", json={
"name": name,
})
out = res.json()
print(out)
ids += [out["id"]]
#TODO handle multiple genres
return ids[0]
def getOrCreateArtist(name):
res = requests.post(f"{url}/artist", json={
@@ -37,14 +43,14 @@ def populateFile(path, midi, mxl):
config = ConfigParser()
config.read(path)
metadata = config["Metadata"];
dificulties = dict(config["Difficulties"])
difficulties = dict(config["Difficulties"])
artistId = getOrCreateArtist(metadata["Artist"])
print(f"Populating {metadata['Name']}")
res = requests.post(f"{url}/song", json={
"name": metadata["Name"],
"midiPath": f"/musics/{midi}",
"musicXmlPath": f"/musics/{mxl}",
"difficulties": dificulties,
"difficulties": difficulties,
"artist": artistId,
"album": getOrCreateAlbum(metadata["Album"], artistId),
"genre": getOrCreateGenre(metadata["Genre"]),
@@ -61,6 +67,6 @@ def main():
print(f"File found: {file}")
path = os.path.splitext(file)[0]
populateFile(file, path + ".midi", path + ".mxl")
if __name__ == "__main__":
exit(main())