Lsdvd and Ruby

Hello

lsdvd rather handily offers to output the chapter structure of a DVD as
a Ruby hash.

lsdvd -Or -c -t1 (output as ruby hash, chapters, track 1)

Thing is, I don’t understand how I can use this in a Ruby script. I’ve
previously issued Unix commands with system(name of command) and I can
do this with the above as well, but I don’t see where, or how I get that
Ruby hash and something I can use elsewhere in the script. system()
seems to issue the command, not store the output.

Please note, if you haven’t already guessed, I’m kinda new to Ruby.
Thanks for any help can be offered.

jp

John-Paul Harold wrote:

Hello

lsdvd rather handily offers to output the chapter structure of a DVD as
a Ruby hash.

lsdvd -Or -c -t1 (output as ruby hash, chapters, track 1)

Thing is, I don’t understand how I can use this in a Ruby script. I’ve
previously issued Unix commands with system(name of command) and I can
do this with the above as well, but I don’t see where, or how I get that
Ruby hash and something I can use elsewhere in the script. system()
seems to issue the command, not store the output.

Please note, if you haven’t already guessed, I’m kinda new to Ruby.
Thanks for any help can be offered.

jp

Use backqoutes for your command:
output = yourcommand

To access the error stream as well, you should have a look at open3:
http://www.ruby-doc.org/stdlib/libdoc/open3/rdoc/index.html

Marvin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs