[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (fwd)
From: |
Urs Liska |
Subject: |
Re: (fwd) |
Date: |
Tue, 21 Mar 2017 08:50:16 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0 |
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
- Re: (fwd), Martin Tarenskeen, 2017/03/21
- Re: (fwd),
Urs Liska <=
- Re: (fwd), Martin Tarenskeen, 2017/03/21
- Re: (fwd), Sven Axelsson, 2017/03/21
- Re: (fwd), Martin Tarenskeen, 2017/03/21
- Re: (fwd), Sven Axelsson, 2017/03/22
- Message not available
- Re: (fwd), Sven Axelsson, 2017/03/22
- Re: (fwd), Martin Tarenskeen, 2017/03/22
- Re: (fwd), Sven Axelsson, 2017/03/22
- Message not available
- lilybin php script (was: Re: (fwd)), Martin Tarenskeen, 2017/03/23
- Re: lilybin php script (was: Re: (fwd)), Trevor, 2017/03/23
- Re: lilybin php script (was: Re: (fwd)), Martin Tarenskeen, 2017/03/23