Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > lsdvd and Ruby

Reply
Thread Tools

lsdvd and Ruby

 
 
John-Paul Harold
Guest
Posts: n/a
 
      02-27-2010
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
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Marvin Gülker
Guest
Posts: n/a
 
      02-27-2010
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/libdo...doc/index.html

Marvin
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ruby extension (C++) on OS X [ruby 1.8.2] and Google-Sketchup [ruby 1.8.5] Nicholas Ruby 3 01-28-2007 01:48 AM
The Ruby Edge - Digg for Ruby and Ruby On Rails roschler Ruby 0 10-15-2006 11:35 PM
ruby-talk, comp.lang.ruby, ruby-talk-google Phrogz Ruby 4 09-05-2006 08:19 PM
#!/usr/bin/ruby , #!/usr/bin/ruby -w , #!/usr/bin/ruby -T?, #!/usr/bin/ruby -T1... anne001 Ruby 1 04-23-2006 03:02 PM
[ANN] ruby-freedb, ruby-serialport, ruby-mp3info moved to Rubyforge guillaume.pierronnet@ratp.fr Ruby 0 08-31-2003 11:57 PM



Advertisments