diff --git a/instruments/Bastl_Drum/patches/Looo.yml b/instruments/Bastl_Drum/patches/Looo.yml deleted file mode 100644 index 2de9b12..0000000 --- a/instruments/Bastl_Drum/patches/Looo.yml +++ /dev/null @@ -1,25 +0,0 @@ -cables: '' -date: '2022-06-26' -decay: '50' -description: test -drum: '50' -drum_mod: '82' -name: Looo -pitch: '50' -pitch_mod: '50' -slug: Looo -tempo: '50' -tempo_mod: '50' diff --git a/instruments/Bastl_Drum/patches/test.yml b/instruments/Bastl_Drum/patches/test.yml deleted file mode 100644 index af8458f..0000000 --- a/instruments/Bastl_Drum/patches/test.yml +++ /dev/null @@ -1,49 +0,0 @@ -date: "2022-06-28" -decay: "50" -description: toast -drum: "50" -drum_mod: "50" -name: test -pitch: "50" -pitch_mod: "50" -slug: test -tempo: "50" -tempo_mod: "50" -cables: '' diff --git a/static/css/global.css b/static/css/global.css index 69af073..14ce9eb 100644 --- a/static/css/global.css +++ b/static/css/global.css @@ -13,87 +13,89 @@ a { } a.stretched:after { - content: ''; - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; + content: ""; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; } header a:hover { - opacity: .5; + opacity: 0.5; } header { - width: 100%; - display: flex; - justify-content: start; - padding: 8px; - font-size: 32px; - + width: 100%; + display: flex; + justify-content: start; + padding: 8px; + font-size: 32px; } header > * { - flex-shrink: 0; + flex-shrink: 0; } - - header .title { - margin: 0; - margin-right: 32px; - font-size: 32px; - font-weight: normal; - + margin: 0; + margin-right: 32px; + font-size: 32px; + font-weight: normal; } .path-slash { - margin: 0 4px; + margin: 0 4px; } .parent { - /* color: rgb(147, 149, 161); */ + /* color: rgb(147, 149, 161); */ } +.search, +.print { + position: relative; -.search, .print { - position: relative; - - display: inline-block; - height: 32px; - margin-left: auto; - overflow: hidden; - flex: 0 0 32px; - transition: flex 0.3s ease-in; + display: inline-block; + height: 32px; + margin-left: auto; + overflow: hidden; + flex: 0 0 32px; + transition: flex 0.3s ease-in; } -.search:hover{ - transition: flex 0.6s ease-out; - flex: 1 0 auto; +.search:hover { + transition: flex 0.6s ease-out; + flex: 1 0 auto; } -.search svg, .print svg { - width: 32px; - height: 32px; - padding: 4px; - margin: 0; +.search svg, +.print svg { + width: 32px; + height: 32px; + padding: 4px; + margin: 0; } .search input { - border: none; - width: 100%; - height: 100%; - position: absolute; - top: 0; - left: 32px; - outline: none; - border-bottom: 1px solid currentColor; + border: none; + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 32px; + outline: none; + border-bottom: 1px solid currentColor; + + font-size: 32px; - font-size: 32px; + padding: 0; + padding-left: 4px; - padding: 0; - padding-left: 4px; + background: none; +} - background: none; +svg #params, +svg #sockets { + display: none; } diff --git a/static/css/patches.css b/static/css/patches.css index d6362c2..a4de5ca 100644 --- a/static/css/patches.css +++ b/static/css/patches.css @@ -91,11 +91,6 @@ main { font-weight: normal; } -svg #params, -svg #sockets { - display: none; -} - @media (max-width: 767px) { header { display: block; diff --git a/instruments/Bastl_Drum/model.yml b/static/instruments/Bastl_Drum/model.yml similarity index 87% rename from instruments/Bastl_Drum/model.yml rename to static/instruments/Bastl_Drum/model.yml index 4114647..cab1306 100644 --- a/instruments/Bastl_Drum/model.yml +++ b/static/instruments/Bastl_Drum/model.yml @@ -1,6 +1,6 @@ name: Bastl Drum slug: Bastl_Drum -description: The drum without buttons, not that drums usually have button but +description: The classic one, the one that is not broken params: - drum_mod - drum diff --git a/instruments/Bastl_Drum/panel.svg b/static/instruments/Bastl_Drum/panel.svg similarity index 100% rename from instruments/Bastl_Drum/panel.svg rename to static/instruments/Bastl_Drum/panel.svg diff --git a/static/instruments/Bastl_Drum/patches/A_test_patch/A_test_patch.yml b/static/instruments/Bastl_Drum/patches/A_test_patch/A_test_patch.yml new file mode 100644 index 0000000..e965b1a --- /dev/null +++ b/static/instruments/Bastl_Drum/patches/A_test_patch/A_test_patch.yml @@ -0,0 +1,29 @@ +cables: '' +date: '2022-10-01' +decay: '98' +description: a patch to test +drum: '61' +drum_mod: '50' +name: A test patch +output: JBL Spearker +pitch: '50' +pitch_mod: '50' +routing: Drum to JBL +slug: A_test_patch +tempo: '50' +tempo_mod: '50' diff --git a/static/instruments/Bastl_Drum/patches/A_test_patch/snippets/test.wav b/static/instruments/Bastl_Drum/patches/A_test_patch/snippets/test.wav new file mode 100644 index 0000000..f689129 Binary files /dev/null and b/static/instruments/Bastl_Drum/patches/A_test_patch/snippets/test.wav differ diff --git a/static/instruments/Bastl_Drum/patches/Second_test/Second_test.yml b/static/instruments/Bastl_Drum/patches/Second_test/Second_test.yml new file mode 100644 index 0000000..eb26458 --- /dev/null +++ b/static/instruments/Bastl_Drum/patches/Second_test/Second_test.yml @@ -0,0 +1,135 @@ +cables: '' +date: '2022-02-16' +decay: '50' +description: just the second +drum: '100' +drum_mod: '50' +name: Second test +pitch: '50' +pitch_mod: '50' +slug: Second_test +tempo: '50' +tempo_mod: '50' diff --git a/static/instruments/Bastl_Drum/patches/Second_test/snippets/531510__eponn__correct-blips.wav b/static/instruments/Bastl_Drum/patches/Second_test/snippets/531510__eponn__correct-blips.wav new file mode 100644 index 0000000..cc8eb3f Binary files /dev/null and b/static/instruments/Bastl_Drum/patches/Second_test/snippets/531510__eponn__correct-blips.wav differ diff --git a/instruments/Bastl_Kastle_v1.5/model.yml b/static/instruments/Bastl_Kastle_v1.5/model.yml similarity index 100% rename from instruments/Bastl_Kastle_v1.5/model.yml rename to static/instruments/Bastl_Kastle_v1.5/model.yml diff --git a/instruments/Bastl_Kastle_v1.5/panel.svg b/static/instruments/Bastl_Kastle_v1.5/panel.svg similarity index 100% rename from instruments/Bastl_Kastle_v1.5/panel.svg rename to static/instruments/Bastl_Kastle_v1.5/panel.svg diff --git a/instruments/Bastl_Kastle_v1.5/patches/For_Pongi.yml b/static/instruments/Bastl_Kastle_v1.5/patches/For_Pongi.yml similarity index 100% rename from instruments/Bastl_Kastle_v1.5/patches/For_Pongi.yml rename to static/instruments/Bastl_Kastle_v1.5/patches/For_Pongi.yml diff --git a/static/instruments/Bastl_Kastle_v1.5/patches/panel.svg b/static/instruments/Bastl_Kastle_v1.5/patches/panel.svg new file mode 100644 index 0000000..2c048ed --- /dev/null +++ b/static/instruments/Bastl_Kastle_v1.5/patches/panel.svg @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/instruments/Bastl_Kastle_v1.5/patches/uzumaki.yml b/static/instruments/Bastl_Kastle_v1.5/patches/uzumaki.yml similarity index 100% rename from instruments/Bastl_Kastle_v1.5/patches/uzumaki.yml rename to static/instruments/Bastl_Kastle_v1.5/patches/uzumaki.yml diff --git a/instruments/Test_Panel/model.yml b/static/instruments/Test_Panel/model.yml similarity index 100% rename from instruments/Test_Panel/model.yml rename to static/instruments/Test_Panel/model.yml diff --git a/instruments/Test_Panel/panel.svg b/static/instruments/Test_Panel/panel.svg similarity index 100% rename from instruments/Test_Panel/panel.svg rename to static/instruments/Test_Panel/panel.svg diff --git a/instruments/Test_Panel/patches/A_test_patch.yml b/static/instruments/Test_Panel/patches/A_test_patch.yml similarity index 100% rename from instruments/Test_Panel/patches/A_test_patch.yml rename to static/instruments/Test_Panel/patches/A_test_patch.yml diff --git a/templates/patch.html b/templates/patch.html index a02daac..af7434c 100644 --- a/templates/patch.html +++ b/templates/patch.html @@ -43,26 +43,22 @@ {{panel|safe}} {% if patch['cables'] %} {{patch['cables']|safe}} {% endif %} -
+
diff --git a/workbook.py b/workbook.py index e5a7b00..42b567d 100644 --- a/workbook.py +++ b/workbook.py @@ -35,9 +35,9 @@ app.wsgi_app = PrefixMiddleware(app.wsgi_app, prefix='/soupboat/workbook') def create_instrument(name, description, params, sockets, panel): slug = secure_filename(name) - os.mkdir(f'instruments/{slug}') - os.mkdir(f'instruments/{slug}/patches') - os.mkdir(f'instruments/{slug}/samples') + os.mkdir(f'static/instruments/{slug}') + os.mkdir(f'static/instruments/{slug}/patches') + os.mkdir(f'static/instruments/{slug}/samples') instrument = { "name": name, "slug": slug, @@ -46,10 +46,10 @@ def create_instrument(name, description, params, sockets, panel): "sockets": sockets } - with open(f'instruments/{slug}/model.yml', 'w') as f: + with open(f'static/instruments/{slug}/model.yml', 'w') as f: yaml.dump(instrument, f, sort_keys=False) - panel.save(f'instruments/{slug}/panel.svg') + panel.save(f'static/instruments/{slug}/panel.svg') @app.route("/") @@ -66,8 +66,8 @@ def instruments(): instruments = [] - for filename in os.listdir('instruments'): - with open(f'instruments/{filename}/model.yml') as f: + for filename in os.listdir('static/instruments'): + with open(f'static/instruments/{filename}/model.yml') as f: instrument = yaml.load(f, Loader=SafeLoader) instruments.append(instrument) @@ -77,13 +77,13 @@ def instruments(): def patches(instrument): - with open(f'instruments/{instrument}/panel.svg') as f: + with open(f'static/instruments/{instrument}/panel.svg') as f: panel = f.read() patches = [] - for filename in os.listdir(f'instruments/{instrument}/patches'): - with open(f'instruments/{instrument}/patches/{filename}') as f: + for filename in os.listdir(f'static/instruments/{instrument}/patches'): + with open(f'static/instruments/{instrument}/patches/{filename}/{filename}.yml') as f: patch = yaml.load(f, Loader=SafeLoader) patches.append(patch) @@ -117,38 +117,52 @@ def add_patch(instrument): slug = secure_filename(patch["name"]) patch['slug'] = slug - - with open(f'instruments/{instrument}/patches/{slug}.yml', 'w') as f: + Path(f'static/instruments/{instrument}/patches/{slug}').mkdir() + with open(f'static/instruments/{instrument}/patches/{slug}/{slug}.yml', 'w') as f: yaml.dump(patch, f) return redirect(url_for('patches', instrument=instrument)) - with open(f'instruments/{instrument}/panel.svg') as f: + with open(f'static/instruments/{instrument}/panel.svg') as f: panel = f.read() - with open(f'instruments/{instrument}/model.yml') as f: + with open(f'static/instruments/{instrument}/model.yml') as f: instrument = yaml.load(f, Loader=SafeLoader) return render_template('add_patch.html', instrument=instrument, panel=panel) -@app.route("/instruments//") +@app.route("/instruments//", methods=['GET', 'POST']) def patch(instrument, name): + + if request.method == 'POST': + + file = request.files['snippet'] + + if file: + Path(f'static/instruments/{instrument}/patches/{name}/snippets').mkdir(exist_ok=True) + filename = secure_filename(file.filename) + file.save(os.path.join(f'static/instruments/{instrument}/patches/{name}/snippets', filename)) + # description = request.form['description'] + redirect(url_for('patch', instrument=instrument, name=name)) + + snippets = [] + + if os.path.exists(f'static/instruments/{instrument}/patches/{name}/snippets'): + for filename in os.listdir(f'static/instruments/{instrument}/patches/{name}/snippets'): + snippets.append(filename) - - with open(f'instruments/{instrument}/panel.svg') as f: + with open(f'static/instruments/{instrument}/panel.svg') as f: panel = f.read() - with open(f'instruments/{instrument}/patches/{name}.yml') as f: + with open(f'static/instruments/{instrument}/patches/{name}/{name}.yml') as f: patch = yaml.load(f, Loader=SafeLoader) - with open(f'instruments/{instrument}/model.yml') as f: + with open(f'static/instruments/{instrument}/model.yml') as f: instrument = yaml.load(f, Loader=SafeLoader) - - - return render_template('patch.html', instrument=instrument, patch=patch, panel=panel) + return render_template('patch.html', instrument=instrument, patch=patch, panel=panel, snippets=snippets)