Ruby can call external shell commands, right?

P

Preston Crawford

I'm trying to use it to scrape the URL for one of my favorite radio
shows (All Things Considered) since it isn't available to me in portable
format on Linux. I'd like to scrape the URL, parse the XML and as I
navigate the tree make external calls to mplayer, etc. Should this be
theoretically possible? Never done this with Ruby before.

Preston
 
E

Ezra Zygmuntowicz

Preston-
Yes you can do that a few different ways:
with backticks: `mplayer myfile.mp3`
or system: system("mplayer myfile.mp3")
or %x: %x{ mplayer myfile.mp3 }

HTH
-Ezra
I'm trying to use it to scrape the URL for one of my favorite radio
shows (All Things Considered) since it isn't available to me in
portable
format on Linux. I'd like to scrape the URL, parse the XML and as I
navigate the tree make external calls to mplayer, etc. Should this be
theoretically possible? Never done this with Ruby before.

Preston

-Ezra Zygmuntowicz
Yakima Herald-Republic
WebMaster
509-577-7732
(e-mail address removed)
 
C

Charles Mills

Ezra said:
Preston-
Yes you can do that a few different ways:
with backticks: `mplayer myfile.mp3`
or system: system("mplayer myfile.mp3")
or %x: %x{ mplayer myfile.mp3 }

don't forget IO.popen and Process.new.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top