Class: VgRutube

Inherits:
Object show all
Defined in:
lib/acts_as_unvlogable/vg_rutube.rb

Instance Method Summary collapse

Constructor Details

#initialize(url = nil, options = {}) ⇒ VgRutube

Returns a new instance of VgRutube.



3
4
5
6
# File 'lib/acts_as_unvlogable/vg_rutube.rb', line 3

def initialize(url=nil, options={})
  @url = url
  parse_url(url)
end

Instance Method Details

#download_urlObject



46
47
48
# File 'lib/acts_as_unvlogable/vg_rutube.rb', line 46

def download_url
  nil
end

#durationObject



50
51
52
# File 'lib/acts_as_unvlogable/vg_rutube.rb', line 50

def duration
  nil
end

#embed_html(width = 425, height = 344, options = {}) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/acts_as_unvlogable/vg_rutube.rb', line 26

def embed_html(width=425, height=344, options={})
  # overridden cause we have to change default size if needed
  return <<-"END"
  <object width="#{width}" height="#{height}"><param
    name="movie" value="#{embed_url}"></param><param
    name="wmode" value="window"></param><param
    name="allowFullScreen" value="true"></param><embed
    src="#{embed_url}" type="application/x-shockwave-flash"
    wmode="window" width="#{width}" height="#{height}"
    allowFullScreen="true"></embed>
  </object>
  END
end

#embed_urlObject



21
22
23
24
# File 'lib/acts_as_unvlogable/vg_rutube.rb', line 21

def embed_url
  # path to swf
  "http://video.rutube.ru/#{movie_hash}"
end

#flvObject



40
41
42
43
44
# File 'lib/acts_as_unvlogable/vg_rutube.rb', line 40

def flv
  # Fragile, untested, issues one redirect to actual location
  # can't be extracted from rt_info
  "http://bl.rutube.ru/#{movie_hash}.iflv"
end

#serviceObject



54
55
56
# File 'lib/acts_as_unvlogable/vg_rutube.rb', line 54

def service
  "Rutube"
end

#thumbnailObject

this method of extraction is somewhat fragile to changes in RuTube urls more correct way would be using rt_info structure, like it was done in title()



14
15
16
17
18
19
# File 'lib/acts_as_unvlogable/vg_rutube.rb', line 14

def thumbnail
  # size=1 gives bigger thumbnail.
  # I'm not sure how to add size parameter in compatible way
  size = 2
  "http://img.rutube.ru/thumbs/#{movie_hash[0,2]}/#{movie_hash[2,2]}/#{movie_hash}-#{size}.jpg"
end

#titleObject



8
9
10
# File 'lib/acts_as_unvlogable/vg_rutube.rb', line 8

def title
  rt_info["movie"][0]["title"][0].strip
end