readbeyond / aeneas-vagrant

aeneas-vagrant automates the creation of a Vagrant box to run aeneas
GNU Affero General Public License v3.0
9 stars 5 forks source link

Script to forward commands/arguments from host to guest and back #8

Open readbeyond opened 7 years ago

readbeyond commented 7 years ago

From https://github.com/readbeyond/aeneas/issues/176#issuecomment-301203596 :

Just an idea, maybe not a good one: you could make python 'stubs' for the aeneas commands that live in the aeneas-vagrant folder. These would only forward the arguments to the real aeneas commands in the VM via 'vagrant ssh -c.' I think 'vagrant ssh -c' is not set up to print stderr to the terminal from the VM child process, only stdin. Not quite sure though. Like this, it's really almost like having aeneas installed natively.. I had difficulties installed aeneas natively on ubuntu 16.04 (such issues are understandable). Although, it's probably confusing for the user that they can't specify input files outside of the aeneas-vagrant folder. Ah, forget it. If I have a better idea I'll let you know. :-)

readbeyond commented 7 years ago

I was not aware that vagrant ssh supports the -c option. (I do not use the Vagrant image myself.) That is quite interesting, thank you.

I am not sure if I understand correctly your suggestion, though.

What I understood is that you would like to be able to run, in the host OS, something like:

$ vagrant_aeneas_task audio.mp3 text.txt "..." out.srt

and vagrant_aeneas_task should basically run vagrant ssh -c, passing the other command line parameters. If this is what you want, then it can be done with a simple bash script, like this:

#!/bin/bash

# check on the number of parameters, omitted here...

# the paths should be actually expressed relative to the shared directory
AUDIO=$1
TEXT=$2
CONF=$3
OUT=$4

# maybe we want to pass other parameters (-l -r="..." etc) as well...

vagrant ssh -c "python -m aeneas.tools.execute_task /vagrant/$AUDIO /vagrant/$TEXT $CONF /vagrant/$OUT"

Does this make sense?