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
.
.
.
def encodeVideo opts #, stream
IO.popen(¡Éffmpeg #{opts}¡É, ¡Æw¡Ç)#{ |io| io.puts stream}
end

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
end


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