I'm trying to extract subtitles from unencrypted DVDs with a program, so I can save them seperately. I know there are programs that do that (I found this page for example: http://www.bunkus.org/dvdripping4linux/en/separate/subtitles.html), but I would like to be able to do it with a library call or something like that (do libdvdread or libdvdnav support this), preferably using ruby.
A:
I don't know of any library, which would be able to do this.
In ruby you can call programs. For example to get a directory listing you can do
files= `ls "#{dir}"`.to_a
The backtick variant gives you stdout of the calle program.
To know wheter a file exists
system("ls \"#{file}\"")
The system
variant tells you whether the return value of the called program was 0
.
Using this two methods, you can do almost anything with noninteracitve programs. The programs described in http://www.bunkus.org/dvdripping4linux/en/separate/subtitles.html seme to be suitable for this kind of control.
Be carefull with escaping arguments you give to external programs. If an argumend is "; rm -rf *; ls ".
undesirable things may happen.
johannes
2009-12-13 21:18:06