Batch conversion from the command line

• May 12, 2016 - 09:50
Reported version
3.0
Type
Functional
Severity
S5 - Suggestion
Status
closed
Project

Currently to convert a given file to PNG and PDF we need to call MuseScore twice on the command line. It costs time to init MuseScore. What about having the possibility to do


mscore -a filename.json

With filename.json

[
{ in:"toto.mscz", out:"toto.png"}
{ in:"fsf.mscz", out:"toto.pdf"}
{ in:"sdf.mscz", out:"toto.mxl"}
{ in:"fdfdf.mscz", out:"toto.png"}
{ in:"fff.mscz", out:"toto.png"}
]


Comments

This could be useful, but perhaps there is a way to keep MuseScore running and listening for commands in the background so that it doesn't have to be started fresh each time?

On Linux, if I do this:

mscore file1.mscz    # opens file1.mscz with MuseScore GUI

And then this from a new Terminal window without quitting MuseScore.

mscore file2.mscz    # opens file2.mscz with MuseScore GUI

The result is file1.mscz and file2.mscz are displayed in separate tabs of the same MuseScore window. The the second file appears to open faster than the first one (at least the splash image doesn't appear the second time).

Perhaps there is a way to do something similar with batch conversion? Something like:

mscore  --noquit &   # wait for new commands in the background
mscore  file1.mscz -o file1.mid
mscore  file1.mscz -o file1.pdf
mscore  file2.mscz -o file2.mid
mscore  file2.mscz -o file2.pdf
mscore --quit

The --noquit command could timeout if no commands were received for 5 seconds and then MuseScore would quit anyway.

This would be easier to automate via a bash script than the JSON method, but I suppose the JSON method might still be useful for situations where MuseScore is running on a webserver.

Just so you know, this FR comes from the vtests. Currently to render all the vtests we need to run MuseScore several dozen of times on travis. It would be cool to do it one go.

Other json proposal


[
{ in:"toto.mscz", out: ["toto.png", "toto.pdf"]}
{ in:"sdf.mscz", out:["toto.mxl"]}
{ in:"fdfdf.mscz", out:["to.png"]}
{ in:"fff.mscz", out:["tot.png"]}
]