[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

IO.popen question...

Michael Barinek

7/18/2006 8:04:00 PM

I posted this on the Rails forum but is really just a ruby question...


////

iâ??m fairly new to ruby...

any suggestions getting the below to work...


iâ??d like to use myfile_field.read within encodeVideo

and then self.data = Student_Interviews.flv



class Myfile < ActiveRecord::Base
2 Answers

Justin Collins

7/18/2006 10:37:00 PM

0


Michael Barinek wrote:
> I posted this on the Rails forum but is really just a ruby question...
>
>
> ////
>
> iâ??m fairly new to ruby...
>
> any suggestions getting the below to work...
>
>
Hi,
It would help if you mentioned what isn't working for you. Are you
getting errors? What are they? Where? Or do you just need help with the
logic?

> iâ??d like to use myfile_field.read within encodeVideo
>
> and then self.data = Student_Interviews.flv
>
>
>
> class Myfile < ActiveRecord::Base
> .
> .
> .
> def encodeVideo opts #, stream
> IO.popen(â?ffmpeg #{opts}â?, â??wâ??)#{ |io| io.puts stream}
> end
>

I think you want to use io.print, because puts will append a newline.

> def myfile=(myfile_field)
> if myfile_field and myfile_field.length > 0
>
> encodeVideo â??-i /tmp/Student_Interviews.mov -ar 22050 -ab 64 -f flv -s
> 320�240 /tmp/Student_Interviews.flv�#, myfile_field.read
>
> #self.data = myfile_field.read
> self.filename = Myfile.base_part_of(myfile_field.original_filename) +
> Date.to_s
> filesize = (myfile_field.length / 1000).to_i
> if filesize == 0
> self.filesize = 1 # a file of 0 KB doesnâ??t make sense
> else
> self.filesize = filesize
> end
>
> end
> en

Help us help you, as they say.

-Justin

Michael Barinek

7/19/2006 3:32:00 AM

0

i need help with the logic and block...

i've commented out the areas i like to get working...

#{ |io| io.puts stream}

#, myfile_field.read

--
Posted via http://www.ruby-....