Last active
March 6, 2017 11:04
-
-
Save Simon-L/d8280b58d1b671e2ce90c48f88dfdb88 to your computer and use it in GitHub Desktop.
What are the pd objects supported by Heavy right now...? And is that patch supported?!
This file contains hidden or 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
| const fs = require('fs') | |
| var $ = require('cheerio') | |
| var request = require('request') | |
| var pdfu = require('pd-fileutils') | |
| var file_pd = fs.readFileSync(process.argv[2]).toString() | |
| var nodes = pdfu.parse(file_pd).nodes | |
| function gotHTML(err, resp, html) { | |
| if (err) return console.error(err) | |
| var parsedHTML = $.load(html) | |
| var objects = [] | |
| parsedHTML('tbody tr td').map(function(i, object) { | |
| objects.push(object.children[0].data) | |
| }) | |
| objects.push("text", "msg") | |
| console.log("As of right now, Heavy supports these objects:", objects.join(", "), "\n") | |
| var uncompatibleNodes = [] | |
| nodes.forEach(function inspectNodes(node, i, a) { | |
| if (!objects.includes(node.proto)) { | |
| uncompatibleNodes.push(node) | |
| console.error("\x1b[31m%s\x1b[0m %s", node.proto, " is either an abstraction or an object that is not supported. (" + node.proto + node.args.join(' ') + ")") | |
| } | |
| if ((node.subpatch !== undefined)) { | |
| node.subpatch.nodes.forEach(inspectNodes) | |
| } | |
| }) | |
| console.log("\x1b[31m%s\x1b[0m %s", "\nAbstractions or uncompatible objects: ", uncompatibleNodes.map((n) => {return n.proto}).join(", ")) | |
| } | |
| var domain = 'https://enzienaudio.com/docs/pdobjects.html' | |
| request(domain, gotHTML) |
This file contains hidden or 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
| { | |
| "name": "heavypdobjects", | |
| "version": "0.0.1", | |
| "description": "What are the pd objects supported by Heavy right now...?", | |
| "main": "index.js", | |
| "scripts": { | |
| "test": "echo \"Error: no test specified\" && exit 1" | |
| }, | |
| "author": "", | |
| "license": "ISC", | |
| "dependencies": { | |
| "cheerio": "^0.22.0", | |
| "pd-fileutils": "git+https://github.com/Simon-L/pd-fileutils.git", | |
| "pd-fileutils.parser": "git+https://github.com/Simon-L/pd-fileutils.parser.git", | |
| "request": "^2.79.0" | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rev1
Example output of just now:
Rev2