Ralph Shnelvar
2012-Jan-03 08:54 UTC
File size of web-based flv. Reading some bytes from a web-based file.
This is such a noobie question. I have a file, http://www.ultradedup.com/videolib/One-minute-commercial-027.flv I want to do two simple things: 1) I want to get the file size. 2) I want to read a few hundred bytes from the beginning of the file so as to pick up te flv''s time duration. Are there RoR and/or Ruby facilities to do this? Ralph Shnelvar -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Peter Hickman
2012-Jan-03 09:37 UTC
Re: File size of web-based flv. Reading some bytes from a web-based file.
Well the File lass has a size method and you can open files and read them with sysread which is available in the IO class (which you get when you open a file) Also this has nothing to do with RoR -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ralph Shnelvar
2012-Jan-03 12:51 UTC
Re[2]: File size of web-based flv. Reading some bytes from a web-based file.
Peter,
Tuesday, January 3, 2012, 2:37:35 AM, you wrote:
PH> Well the File lass has a size method and you can open files and read
PH> them with sysread which is available in the IO class (which you get
PH> when you open a file)
PH> Also this has nothing to do with RoR
At least on my machine
C:\Users\Ralph>irb
irb(main):001:0>
File.size(''c:/RailsInstaller/Sites/ultradedup002/app/views/usage/VideoTutorials.html.haml'')
=> 32406
irb(main):002:0>
File.size(''http://www.ultradedup.com/videolib/One-minute-commercial-027.flv'')
Errno::EINVAL: Invalid argument -
http://www.ultradedup.com/videolib/One-minute-commercial-027.flv
from (irb):2:in `size''
from (irb):2
from C:/RailsInstaller/Ruby1.9.2/bin/irb:12:in `<main>''
irb(main):003:0>
So File.size() seems to work on local files and not web-based files.
I''ll take this to the ruby chat list.
Ralph Shnelvar
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Sanjiv Jha
2012-Jan-03 13:43 UTC
Re: Re[2]: File size of web-based flv. Reading some bytes from a web-based file.
Hi Ralphs, just use these response = http.request_head(RemoteAddress) file_size = response[''content-length''] Josh Software Private Limited <http://www.joshsoftware.com> 6, Thube Park, Shivaji Nagar, Pune - 411005 Office: +91-020-25539995 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.