| @@ -1060,5 +1060,26 @@ | |||
| "vcvUrl": "https://library.vcvrack.com/NANOModules/BLANK2Hp", | |||
| "mgUrl": "https://www.modulargrid.net/e/nano-modules-blank-2hp", | |||
| "mgModuleId": 25227 | |||
| }, | |||
| { | |||
| "pluginSlug": "Starling_Via", | |||
| "moduleSlug": "ATSR", | |||
| "vcvUrl": "https://library.vcvrack.com/Starling_Via/ATSR", | |||
| "mgUrl": "https://www.modulargrid.net/e/starling-via-atsr-", | |||
| "mgModuleId": 26726 | |||
| }, | |||
| { | |||
| "pluginSlug": "Starling_Via", | |||
| "moduleSlug": "OSC3", | |||
| "vcvUrl": "https://library.vcvrack.com/Starling_Via/OSC3", | |||
| "mgUrl": "https://www.modulargrid.net/e/starling-via-osc3-", | |||
| "mgModuleId": 26727 | |||
| }, | |||
| { | |||
| "pluginSlug": "Starling_Via", | |||
| "moduleSlug": "SYNC3", | |||
| "vcvUrl": "https://library.vcvrack.com/Starling_Via/SYNC3", | |||
| "mgUrl": "https://www.modulargrid.net/e/starling-via-sync3-", | |||
| "mgModuleId": 26728 | |||
| } | |||
| ] | |||
| @@ -1,58 +0,0 @@ | |||
| import sys | |||
| import os | |||
| import glob | |||
| import json | |||
| import re | |||
| import requests | |||
| # Load existing dataset | |||
| mg_filename = "ModularGrid-VCVLibrary.json" | |||
| with open(mg_filename) as f: | |||
| mg = json.load(f) | |||
| # Iterate plugins | |||
| for manifest_filename in glob.glob('manifests/*.json'): | |||
| with open(manifest_filename) as f: | |||
| plugin = json.load(f) | |||
| plugin_slug = plugin['slug'] | |||
| # Iterate modules in plugin | |||
| for module in plugin.get('modules', []): | |||
| module_slug = module['slug'] | |||
| mg_url = module.get('modularGridUrl') | |||
| if not mg_url: | |||
| continue | |||
| if [x for x in mg if x.get('mgUrl') == mg_url]: | |||
| continue | |||
| mg_data = {} | |||
| mg_data['pluginSlug'] = plugin_slug | |||
| mg_data['moduleSlug'] = module_slug | |||
| mg_data['vcvUrl'] = f"https://library.vcvrack.com/{plugin_slug}/{module_slug}" | |||
| mg_data['mgUrl'] = mg_url | |||
| mg.append(mg_data) | |||
| print(mg_data) | |||
| # Iterate dataset | |||
| for mg_data in mg: | |||
| if mg_data.get('mgModuleId'): | |||
| continue | |||
| # Scrape ModularGrid website for ID | |||
| mg_url = mg_data['mgUrl'] | |||
| r = requests.get(mg_url) | |||
| m = re.search(r'data-module-id = "(\d+)"', r.text) | |||
| mg_id = m.group(1) | |||
| if not mg_id: | |||
| print(f"No ModularGrid ID found for {plugin_slug} {module_slug}") | |||
| continue | |||
| mg_id = int(mg_id) | |||
| mg_data['mgModuleId'] = mg_id | |||
| print(mg_data) | |||
| with open(mg_filename, 'w') as f: | |||
| json.dump(mg, f, indent=2) | |||
| @@ -3,10 +3,12 @@ import os | |||
| import glob | |||
| import json | |||
| import time | |||
| import build | |||
| import zipfile | |||
| import re | |||
| import build | |||
| import update_modulargrid | |||
| PACKAGES_DIR = "../packages" | |||
| SCREENSHOTS_DIR = "../screenshots" | |||
| @@ -79,7 +81,7 @@ for plugin_filename in plugin_filenames: | |||
| build.delete_stage() | |||
| build.build(plugin_filename) | |||
| build.system(f'cp -vi stage/* "{PACKAGES_DIR}"') | |||
| build.system(f'cp -vi stage/* "{RACK_USER_PLUGIN_DIR}"') | |||
| build.system(f'cp -vi stage/*-lin.zip "{RACK_USER_PLUGIN_DIR}"') | |||
| except Exception as e: | |||
| print(e) | |||
| print(f"{slug} build failed") | |||
| @@ -89,7 +91,7 @@ for plugin_filename in plugin_filenames: | |||
| build.delete_stage() | |||
| # Open plugin issue thread | |||
| os.system(f"qutebrowser 'https://github.com/VCVRack/library/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+in%3Atitle+{slug}' &") | |||
| os.system(f"xdg-open 'https://github.com/VCVRack/library/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+in%3Atitle+{slug}' &") | |||
| elif plugin_ext == ".zip": | |||
| # Review manifest for errors | |||
| @@ -119,6 +121,10 @@ if not updated_slugs: | |||
| print("Nothing to build") | |||
| exit(0) | |||
| update_modulargrid.update() | |||
| # Upload data | |||
| built_slugs_str = ", ".join(updated_slugs) | |||
| print() | |||
| @@ -0,0 +1,64 @@ | |||
| import sys | |||
| import os | |||
| import glob | |||
| import json | |||
| import re | |||
| import requests | |||
| def update(): | |||
| # Load existing dataset | |||
| mg_filename = "ModularGrid-VCVLibrary.json" | |||
| with open(mg_filename) as f: | |||
| mg = json.load(f) | |||
| # Iterate plugins | |||
| for manifest_filename in glob.glob('manifests/*.json'): | |||
| with open(manifest_filename) as f: | |||
| plugin = json.load(f) | |||
| plugin_slug = plugin['slug'] | |||
| # Iterate modules in plugin | |||
| for module in plugin.get('modules', []): | |||
| module_slug = module['slug'] | |||
| mg_url = module.get('modularGridUrl') | |||
| if not mg_url: | |||
| continue | |||
| if [x for x in mg if x.get('mgUrl') == mg_url]: | |||
| continue | |||
| mg_data = {} | |||
| mg_data['pluginSlug'] = plugin_slug | |||
| mg_data['moduleSlug'] = module_slug | |||
| mg_data['vcvUrl'] = f"https://library.vcvrack.com/{plugin_slug}/{module_slug}" | |||
| mg_data['mgUrl'] = mg_url | |||
| mg.append(mg_data) | |||
| print(mg_data) | |||
| # Iterate dataset | |||
| for mg_data in mg: | |||
| if mg_data.get('mgModuleId'): | |||
| continue | |||
| # Scrape ModularGrid website for ID | |||
| mg_url = mg_data['mgUrl'] | |||
| r = requests.get(mg_url) | |||
| m = re.search(r'data-module-id = "(\d+)"', r.text) | |||
| mg_id = m.group(1) | |||
| if not mg_id: | |||
| print(f"No ModularGrid ID found for {plugin_slug} {module_slug}") | |||
| continue | |||
| mg_id = int(mg_id) | |||
| mg_data['mgModuleId'] = mg_id | |||
| print(mg_data) | |||
| with open(mg_filename, 'w') as f: | |||
| json.dump(mg, f, indent=2) | |||
| if __name__ == "__main__": | |||
| update() | |||