I’m writing a ruby script that will take a number of video and audio tracks, run a transcode job on them and monitor the progress. This is going to be called by the command line and the arguments will look like this:
--V1 /path/to/video_file_1.mxf --A1 /path/to/audio_file_1.mxf --A2 /path/to/audio_file_2.mxf
Right now I’m using OptionParser as such:
opts.on("--V1 X") do |video_track|
options.video_tracks << VideoTrack.new({ :track => 1, :path => video_track })
end
opts.on("--A1 X") do |audio_track|
options.audio_tracks << AudioTrack.new({ :track => 1, :path => audio_track })
end
This obviously is ridiculous because I’ll need to have a case for each potential track.
Ideally I would like to be able to regex the flags so that I don’t need so many cases. I’ve looked at the documentation and tried several things but I’ve had no luck. Could anyone help a guy out?