acts_as_unvlogable 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in acts_as_unvlogable.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem "bundler", "~> 1.0.0"
8
+ gem 'ruby-debug', :platforms => :mri_18
9
+ gem 'ruby-debug19', :require => 'ruby-debug', :platforms => :mri_19
10
+ end
11
+
12
+ group :development, :test do
13
+ gem "shoulda"
14
+ end
15
+
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 unvlog.com
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.markdown ADDED
@@ -0,0 +1,130 @@
1
+ Acts as unvlogable
2
+ ==================
3
+
4
+ What the hell is this!
5
+ ----------------------
6
+
7
+ This is the plugin that we use in [unvlog.com](http://unvlog.com) to manage the supported video services. It is an easy way to obtain a few basics about a video only through its url.
8
+
9
+ A quick example:
10
+
11
+ To include [this video](http://www.youtube.com/watch?v=GPQnbtldFyo) in [this post](http://unvlog.com/blat/2008/3/10/otro-pelotazo) we need to know its title, the correct way to embed it and its thumbnail url. With this plugin we have an easy access to this data:
12
+
13
+ @aha = UnvlogIt.new("http://www.youtube.com/watch?v=GPQnbtldFyo")
14
+ @aha.title => "paradon del portero"
15
+ @aha.thumbnail => "http://i4.ytimg.com/vi/GPQnbtldFyo/default.jpg"
16
+ @aha.embed_url => "http://www.youtube.com/v/GPQnbtldFyo"
17
+ @aha.embed_html(width, height) => "<object [...]</object>"
18
+ @aha.flv => "http://...flv"
19
+ # all together :)
20
+ @aha.video_details(width, height) => {
21
+ :title => ...,
22
+ :thumbnail => ...,
23
+ :embed_url => ...,
24
+ :embed_html => ...,
25
+ :flv => ...
26
+ }
27
+
28
+ With this plugin we have an unique way to manage multiple services :)
29
+
30
+
31
+ Install it!
32
+ -----------
33
+
34
+ 1. Install it as a gem:
35
+
36
+ gem "acts_as_unvlogable"
37
+
38
+ 2. Optionally you can create the `config/unvlogable.yml` to store keys for the different services. You have in the plugin a [sample file](http://github.com/mamuso/acts_as_unvlogable/tree/master/unvlogable_sample.yml). At this moment you only need specify keys for flickr.
39
+
40
+
41
+ Dependencies
42
+ ------------
43
+
44
+ The plugin depends on [youtube-it](https://github.com/kylejginavan/youtube_it), [xml-simple](http://xml-simple.rubyforge.org/) and [hpricot](https://code.whytheluckystiff.net/hpricot/).
45
+
46
+ We have included a modified version of the flickr gem to skip the gem dependency and manage video capabilities.
47
+
48
+
49
+ Use it!
50
+ -------
51
+
52
+
53
+ The idea is make it as simple as possible. For a given video URL as <http://vimeo.com/1785993>:
54
+
55
+ videotron = UnvlogIt.new("http://vimeo.com/1785993")
56
+
57
+ Then we have methods to know the 'basics' for use this video on your application.
58
+
59
+ - __title:__ A method to know the title of the video on the service.
60
+
61
+ videotron.title
62
+ => "Beached"
63
+
64
+ - __service:__ A method to know the name of the video provider service.
65
+
66
+ videotron.service
67
+ => "Vimeo"
68
+
69
+ - __thumbnail:__ An image representation of the video. Each service has a different size, but... it works :)
70
+
71
+ videotron.thumbnail
72
+ => "http://bc1.vimeo.com/vimeo/thumbs/143104745_640.jpg"
73
+
74
+ - __embed\_url:__ The url (with flashvars) of the video player.
75
+
76
+ videotron.embed_url
77
+ => "http://vimeo.com/moogaloop.swf?clip_id=1785993 [...] &show_portrait=1"
78
+
79
+ - __embed\_html(width, height):__ Uses the embed\_url to build an oembed string. The default width x height is 425 x 344, but we can specify a different one.
80
+
81
+ videotron.embed_html(400, 300)
82
+ => "<object width='400' height='300'><param name='mo [...] 300'></embed></object>"
83
+
84
+ - __flv:__ Gets the flv url. In this edition we implement this method in all the services, but is possible that we can't get the flv in some scenarios. Remember that in some services the flv url expires and in most of their terms don't allow use the flv without its player.
85
+
86
+ videotron.flv
87
+ => "http://www.vimeo.com/moogaloop/play/clip:1785993/ [...] 8ee400/video.flv"
88
+
89
+ - __video\_details(width, height):__ All together :), returns all the previous elements in a hash. Width and height can be specified to build the embed\_html.
90
+
91
+ videotron.video_details
92
+ => "{ [...] }"
93
+
94
+
95
+ Supported services
96
+ ------------------
97
+
98
+ At this moment we support the following video services:
99
+
100
+ - [Youtube](http://www.youtube.com/)
101
+ - [Vimeo](http://vimeo.com/)
102
+ - [Flickr (videos)](http://flickr.com/)
103
+ - [Metacafe](http://metacafe.com/)
104
+ - [Dailymotion](http://dailymotion.com/)
105
+ - [Collegehumor](http://collegehumor.com/)
106
+ - [Blip.tv](http://blip.tv/)
107
+ - [Myspace](http://vids.myspace.com/)
108
+ - [Ted Talks](http://www.ted.com/talks/)
109
+ - [11870.com](http://11870.com/)
110
+ - [Marca.tv](http://www.marca.tv/)
111
+ - [Dalealplay](http://www.dalealplay.com/)
112
+ - [RuTube](http://www.rutube.ru/)
113
+
114
+ Broken services
115
+ ---------------
116
+
117
+ These services were implemented but due to changes in the website they don't work anymore. Any patch for fixing them would be great ;)
118
+
119
+ - [Qik](http://qik.com/)
120
+ - [MTV](http://www.mtvhive.com/)
121
+
122
+ You can detect new broken services when running the tests.
123
+
124
+ We are always open to incude new services.
125
+
126
+ And... what else?
127
+ -----------------
128
+ If you find a bug or want to suggest a new video service, please tell it to us in [a ticket](http://github.com/mamuso/acts_as_unvlogable/issues).
129
+
130
+ Thanks!!
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "acts_as_unvlogable/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "acts_as_unvlogable"
7
+ s.version = ActsAsUnvlogable::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Manuel Muñoz", "Fernando Blat", "Alberto Romero"]
10
+ s.email = ["mamusino@gmail.com", "ferblape@gmail.com", "denegro@gmail.com"]
11
+ s.homepage = ""
12
+ s.summary = %q{An easy way to include external video services in a rails app}
13
+ s.description = %q{An easy way to include external video services in a rails app. This gem provides you wrappers for the most common video services, such as Youtube, Vimeo, Flickr, and so on...}
14
+
15
+ s.rubyforge_project = "acts_as_unvlogable"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+ s.add_development_dependency "shoulda"
22
+ s.add_development_dependency "ruby-debug"
23
+ s.add_dependency("xml-simple")
24
+ s.add_dependency("youtube_it")
25
+ s.add_dependency("hpricot")
26
+ end