cameraman 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ *.swo
6
+ *.swp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in cameraman.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/cameraman.gemspec ADDED
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "cameraman/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "cameraman"
7
+ s.version = Cameraman::VERSION
8
+ s.authors = ["Christian Mortaro"]
9
+ s.email = ["mortaro@towsta.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Single interface to manipulate videos from 3rd party services}
12
+ s.description = %q{Abstracts the methods from different video services, like Youtube and Redtube}
13
+
14
+ s.rubyforge_project = "cameraman"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ end
@@ -0,0 +1,23 @@
1
+ module Cameraman
2
+ module Sources
3
+
4
+ class RedTube
5
+
6
+ attr_accessor :id
7
+
8
+ def initialize id
9
+ @id = id
10
+ end
11
+
12
+ def embed
13
+ "http://embed.redtube.com/player/?id=#{@id}&style=redtube"
14
+ end
15
+
16
+ def original_url
17
+ "http://www.redtube.com/#{@id}"
18
+ end
19
+
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ module Cameraman
2
+ module Sources
3
+
4
+ class XVideos
5
+
6
+ attr_accessor :id
7
+
8
+ def initialize id
9
+ @id = id
10
+ end
11
+
12
+ def embed
13
+ "http://flashservice.xvideos.com/embedframe/#{@id}"
14
+ end
15
+
16
+ def original_url
17
+ "http://www.xvideos.com/video#{@id}"
18
+ end
19
+
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ module Cameraman
2
+ module Sources
3
+
4
+ class YouTube
5
+
6
+ attr_accessor :id
7
+
8
+ def initialize id
9
+ @id = id
10
+ end
11
+
12
+ def embed
13
+ "http://www.youtube.com/embed/#{@id}"
14
+ end
15
+
16
+ def original_url
17
+ "http://www.youtube.com/watch?v=#{@id}"
18
+ end
19
+
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ module Cameraman
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,23 @@
1
+ module Cameraman
2
+ class VideoReference
3
+
4
+ attr_accessor :item
5
+
6
+ def initialize args
7
+ @item = eval "Cameraman::Sources::#{args[:source]}.new '#{args[:id]}'"
8
+ end
9
+
10
+ def original_url
11
+ @item.original_url
12
+ end
13
+
14
+ def embed
15
+ @item.embed
16
+ end
17
+
18
+ def source
19
+ @item.class.to_s.split('::').last
20
+ end
21
+
22
+ end
23
+ end
data/lib/cameraman.rb ADDED
@@ -0,0 +1,9 @@
1
+ require "cameraman/version"
2
+ require "cameraman/video_reference"
3
+ require "cameraman/sources/youtube"
4
+ require "cameraman/sources/xvideos"
5
+ require "cameraman/sources/redtube"
6
+
7
+ module Cameraman
8
+ # Your code goes here...
9
+ end
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cameraman
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Christian Mortaro
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-11-26 00:00:00 -02:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: Abstracts the methods from different video services, like Youtube and Redtube
22
+ email:
23
+ - mortaro@towsta.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - .gitignore
32
+ - Gemfile
33
+ - Rakefile
34
+ - cameraman.gemspec
35
+ - lib/cameraman.rb
36
+ - lib/cameraman/sources/redtube.rb
37
+ - lib/cameraman/sources/xvideos.rb
38
+ - lib/cameraman/sources/youtube.rb
39
+ - lib/cameraman/version.rb
40
+ - lib/cameraman/video_reference.rb
41
+ has_rdoc: true
42
+ homepage: ""
43
+ licenses: []
44
+
45
+ post_install_message:
46
+ rdoc_options: []
47
+
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 0
57
+ version: "0"
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ segments:
64
+ - 0
65
+ version: "0"
66
+ requirements: []
67
+
68
+ rubyforge_project: cameraman
69
+ rubygems_version: 1.3.7
70
+ signing_key:
71
+ specification_version: 3
72
+ summary: Single interface to manipulate videos from 3rd party services
73
+ test_files: []
74
+