Am 21.03.2017 um 08:40 schrieb Martin Tarenskeen: > > On Mon, 20 Mar 2017, Trevor wrote: > >> It's not hard to hit LilyBin from the command line, but the >> interface isn't >> great. Try curl -X POST -H "Content-Type:application/json" >> >> https://7icpm9qr6a.execute-api.us-west-2.amazonaws.com/prod/prepare_preview/stable >> -d '{"code": "% LilyBin\n\\score{\n\t{\n\t\t\\repeat unfold 120 >> { c4. d e f }\n\t}\n\n\t\\layout{}\n\t\\midi{}\n}\n"}'. >> The response will include an "id" field. You can download the >> result from >> https://s3-us-west-2.amazonaws.com/lilybin-scores/${id}.pdf. > > Thanks. That's a good start. I have tried it, and it works. But yes, > it looks ugly :-) > > I am trying to put this idea in a working bash or python script now. > I am not really a virtuoso with grep and regular expressions, but I > guess I could use that to extract the stringvalue after the "id": > field from the response I am getting from the first line > > {"stdout":"","stderr":"Processing `input.ly'\nParsing...\ninput.ly:1: > warning: no \\version statement found, please add\n\n\\version > \"2.18.2\"\n\nfor future compatibility\nInterpreting > music...[8][16][24][32][40][48][56]\nPreprocessing graphical > objects...\nInterpreting music...\nMIDI output to > `rendered.midi'...\nFinding the ideal number of pages...\nFitting > music on 1 or 2 pages...\nDrawing systems...\nLayout output to > `rendered.ps'...\nConverting to `./rendered.pdf'...\nSuccess: > compilation successfully > completed\n","id":"1490078842785-3632-246681695-lnytb2x5437hkt9","files":{"pdf":true,"midi":true}} > > I am sure one of you reading this wants to take the challenge to > construct a regex to use with grep that will return the id, in this > example that should be "1490078842785-3632-246681695-lnytb2x5437hkt9" > without the quotes?
I *want* but I can*'t afford it. But this is a JSON string, so you'll be conveniently able to extract this with https://docs.python.org/2/library/json.html or https://docs.python.org/3/library/json.html HTH Urs _______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
