Class: VgMetacafe
Instance Method Summary collapse
- #download_url ⇒ Object
- #duration ⇒ Object
- #embed_html(width = 425, height = 344, options = {}) ⇒ Object
- #embed_url ⇒ Object
- #flv ⇒ Object
-
#initialize(url = nil, options = {}) ⇒ VgMetacafe
constructor
A new instance of VgMetacafe.
- #service ⇒ Object
- #thumbnail ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(url = nil, options = {}) ⇒ VgMetacafe
Returns a new instance of VgMetacafe.
9 10 11 12 13 14 15 16 |
# File 'lib/acts_as_unvlogable/vg_metacafe.rb', line 9 def initialize(url=nil, ={}) @url = url @args = parse_url(url) #is the video 'youtubed'? @youtubed = @args[1].index("yt-").nil? ? false : true @yt = @youtubed ? VgYoutube.new("http://www.youtube.com/watch?v=#{@args[1].sub('yt-', '')}") : nil end |
Instance Method Details
#download_url ⇒ Object
50 51 52 |
# File 'lib/acts_as_unvlogable/vg_metacafe.rb', line 50 def download_url nil end |
#duration ⇒ Object
46 47 48 |
# File 'lib/acts_as_unvlogable/vg_metacafe.rb', line 46 def duration nil end |
#embed_html(width = 425, height = 344, options = {}) ⇒ Object
30 31 32 |
# File 'lib/acts_as_unvlogable/vg_metacafe.rb', line 30 def (width=425, height=344, ={}) "<embed src='#{}' width='#{width}' height='#{height}' wmode='transparent' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'></embed>" end |
#embed_url ⇒ Object
26 27 28 |
# File 'lib/acts_as_unvlogable/vg_metacafe.rb', line 26 def "http://www.metacafe.com/fplayer/#{@args[1]}/#{@args[2]}.swf" end |
#flv ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/acts_as_unvlogable/vg_metacafe.rb', line 34 def flv if @youtubed @yt.flv else params = Hash.new open(self.) {|f| params = CGI::parse(f.base_uri.request_uri.split("?")[1]) } CGI::unescape "#{ params['mediaURL']}?__gda__=#{params['gdaKey']}" end end |
#service ⇒ Object
54 55 56 |
# File 'lib/acts_as_unvlogable/vg_metacafe.rb', line 54 def service "Metacafe" end |
#thumbnail ⇒ Object
22 23 24 |
# File 'lib/acts_as_unvlogable/vg_metacafe.rb', line 22 def thumbnail "http://www.metacafe.com/thumb/#{@args[1]}.jpg" end |
#title ⇒ Object
18 19 20 |
# File 'lib/acts_as_unvlogable/vg_metacafe.rb', line 18 def title @youtubed ? @yt.title : (@args[2].humanize unless @args[2].blank?) end |