viddl-rb 0.4.4 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
data/plugins/blip.rb ADDED
@@ -0,0 +1,25 @@
1
+ class Blip < PluginBase
2
+ # this will be called by the main app to check weather this plugin is responsible for the url passed
3
+ def self.matches_provider?(url)
4
+ url.include?("blip.tv")
5
+ end
6
+
7
+ # return the url for original video file and title
8
+ def self.get_urls_and_filenames(url)
9
+ id = self.to_id(url)
10
+ xml_url = "http://blip.tv/rss/#{id}"
11
+ doc = Nokogiri::XML(open(xml_url))
12
+ user = doc.at("//channel/item/blip:user").inner_text
13
+ title = doc.at("//channel/item/title").inner_text.gsub(" ", "_")
14
+ download_url = doc.at("//channel/item/media:group/media:content").attributes["url"].value
15
+ extention = download_url.split(".").last
16
+ file_name = "#{id}-#{user}-#{title}.#{extention}"
17
+
18
+ [{:url => download_url, :name => file_name}]
19
+ end
20
+
21
+ # usually id is last 7 digits
22
+ def self.to_id(url)
23
+ URI::split(url)[5].split("/")[2].split("-").last
24
+ end
25
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: viddl-rb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 4
10
- version: 0.4.4
9
+ - 5
10
+ version: 0.4.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Marc Seeger
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-17 00:00:00 +02:00
18
+ date: 2011-09-28 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -44,11 +44,11 @@ files:
44
44
  - bin/viddl-rb
45
45
  - helper/download-helper.rb
46
46
  - helper/plugin-helper.rb
47
+ - plugins/blip.rb
47
48
  - plugins/megavideo.rb
48
49
  - plugins/vimeo.rb
49
50
  - plugins/youtube.rb
50
51
  - CHANGELOG.txt
51
- - My_Boyfriend_the_Sex_Tourist___Thailand.mp4
52
52
  - README.txt
53
53
  has_rdoc: true
54
54
  homepage: https://github.com/rb2k/viddl-rb