laserlemon-videoclip 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION.yml +1 -1
- data/lib/videoclip/videos/blip.rb +32 -28
- data/videoclip.gemspec +1 -1
- metadata +1 -1
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('videoclip', '0.2.
|
5
|
+
Echoe.new('videoclip', '0.2.1') do |g|
|
6
6
|
g.description = %(Save videos from popular sites alongside your ActiveRecord models)
|
7
7
|
g.url = 'http://github.com/laserlemon/videoclip'
|
8
8
|
g.author = 'Steve Richert'
|
data/VERSION.yml
CHANGED
@@ -1,31 +1,35 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
path
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
1
|
+
module LaserLemon
|
2
|
+
module Videoclip
|
3
|
+
class Video::Blip < Video
|
4
|
+
def self.match?(uri)
|
5
|
+
(uri.host =~ /^(?:www\.)?blip\.tv$/i) && (uri.path =~ /^\/file\/\d+$/)
|
6
|
+
end
|
7
|
+
|
8
|
+
def assign(uri)
|
9
|
+
@url = "http://blip.tv#{uri.path}"
|
10
|
+
response = Net::HTTP.get(URI.parse(@url + '?skin=api'))
|
11
|
+
@key = parse_response(response, %w(response payload asset embed_lookup))
|
12
|
+
end
|
13
|
+
|
14
|
+
def embed(style = nil)
|
15
|
+
%(<embed src="http://blip.tv/play/#{@key}" type="application/x-shockwave-flash" width="#{width(style)}" height="#{height(style)}" allowscriptaccess="always" allowfullscreen="true"></embed>)
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
def chrome_height
|
21
|
+
30
|
22
|
+
end
|
23
|
+
|
24
|
+
def parse_response(response, path, default = nil)
|
25
|
+
begin
|
26
|
+
path.collect!(&:to_s)
|
27
|
+
destination = path.pop
|
28
|
+
path.inject(Hash.from_xml(response)){|h,p| h.fetch(p, {}) }.fetch(destination, default)
|
29
|
+
rescue
|
30
|
+
default
|
31
|
+
end
|
32
|
+
end
|
29
33
|
end
|
30
34
|
end
|
31
35
|
end
|
data/videoclip.gemspec
CHANGED