[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Ruby can call external shell commands, right?

Preston Crawford

7/14/2005 11:03:00 PM

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
3 Answers

Ezra Zygmuntowicz

7/14/2005 11:22:00 PM

0

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
On Jul 14, 2005, at 4:05 PM, Preston Crawford wrote:

> 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
ezra@yakima-herald.com



Charles Mills

7/14/2005 11:32:00 PM

0

Ezra Zygmuntowicz wrote:
> 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.

> HTH
> -Ezra
> On Jul 14, 2005, at 4:05 PM, Preston Crawford wrote:
>
> > 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
> ezra@yakima-herald.com

Charles Mills

7/14/2005 11:37:00 PM

0

Charles Mills wrote:
> Ezra Zygmuntowicz wrote:
> > 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.
>

nevermind about Process.new - Process is a module, but you may find it
useful.

> > HTH
> > -Ezra
> > On Jul 14, 2005, at 4:05 PM, Preston Crawford wrote:
> >
> > > 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
> > ezra@yakima-herald.com