muri 1.1.5 → 1.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,6 +1,10 @@
1
1
  Muri Changelog
2
2
  ===================================
3
3
 
4
+ Version 1.1.6 (Git)
5
+ * Reenabled Facebook album parsing ability
6
+ * Enabled short URL's for youtube (ex/ http://youtu.be/ZL1Jta1j42c)
7
+
4
8
  Version 1.1.5
5
9
  * Minor update, changed facebook "media_api_id" to only return a string representation, not a hash
6
10
  - Facebook provides "media_api_ids" which is a hash including pid, uid, and fql_id (the regular "media_api_id")
data/README.textile CHANGED
@@ -7,14 +7,14 @@ MURI Currently supports:
7
7
  ** "API documentation":http://code.google.com/apis/youtube/2.0/developers_guide_protocol_audience.html
8
8
  * Vimeo (single videos and albums)
9
9
  ** "API documentation":http://vimeo.com/api/docs/simple-api
10
- * Flickr (single images and sets)
10
+ * Flickr (single media items and sets)
11
11
  ** "API documentation":http://www.flickr.com/services/api/ or "API Doc 2":http://developer.yahoo.com/flickr/
12
12
  * Imageshack
13
- * Photobucket
13
+ * Photobucket (media items and albums)
14
14
  ** "API documentation":http://photobucket.com/developer/documentation
15
15
  * Twitpic
16
16
  ** "API documentation":http://twitpic.com/api.do
17
- * Facebook (photos and albums)
17
+ * Facebook (photos, videos and albums)
18
18
  ** "API documentation":http://wiki.developers.facebook.com/index.php/API
19
19
  * Picasa (photos)
20
20
  ** "API documentation":http://code.google.com/apis/picasaweb/docs/2.0/developers_guide.html
data/Rakefile CHANGED
@@ -14,8 +14,14 @@ rescue LoadError
14
14
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
15
15
  end
16
16
  require 'rake'
17
- require 'spec/rake/spectask'
17
+ require 'rspec/core/rake_task'
18
18
 
19
- Spec::Rake::SpecTask.new('tests') do |t|
20
- t.spec_files = FileList['test/*.rb']
19
+ RSpec::Core::RakeTask.new('tests') do |t|
20
+ t.rcov_opts = FileList['test/*.rb']
21
21
  end
22
+
23
+ # require 'spec/rake/spectask'
24
+ #
25
+ # Spec::Rake::SpecTask.new('tests') do |t|
26
+ # t.spec_files = FileList['test/*.rb']
27
+ # end
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 1
4
- :patch: 5
4
+ :patch: 6
@@ -5,11 +5,11 @@ class Muri
5
5
  private
6
6
  FACEBOOK_PHOTO = "photo"
7
7
  FACEBOOK_VIDEO = "video"
8
+ FACEBOOK_ALBUM = "album"
8
9
 
9
- #FACEBOOK_ALBUM = "album"
10
10
  REGEX_FACEBOOK_PHOTO = /\/photo\.php/i
11
11
  REGEX_FACEBOOK_VIDEO = /\/video\/video\.php/i
12
- #REGEX_FACEBOOK_ALBUM = /^\/album\.php$/i
12
+ REGEX_FACEBOOK_ALBUM = /\/album\.php/i
13
13
 
14
14
  def self.included(base)
15
15
  base.class_eval do
@@ -50,17 +50,20 @@ class Muri
50
50
  self.media_api_ids = { :pid => pid, :uid => media_creator, :fql_id => fql_id }
51
51
 
52
52
  self.media_website = "#{url_common}/photo.php?pid=#{self.media_id}&id=#{media_creator}"
53
- # elsif ((self.uri.path =~ REGEX_FACEBOOK_ALBUM) &&
54
- # params["aid"] =~ /^([0-9]+)$/ &&
55
- # params["id"] =~ /^([0-9]+)$/ &&
56
- # params["l"] =~ /^([0-9a-z]+)$/i)
57
- #
58
- # self.media_api_type = FACEBOOK_ALBUM
59
- # self.media_id = params["aid"]
60
- # media_creator = params["id"]
61
- # share_key = params["l"]
62
- #
63
- # self.media_website = "#{url_common}/album.php?aid=#{self.media_id}&l=#{share_key}&id=#{media_creator}"
53
+ elsif (url_string =~ REGEX_FACEBOOK_ALBUM &&
54
+ (aid = url_string.gsub(/\A.*?aid=(\d+)(&.*|\Z)/i, '\1')) &&
55
+ (uid = url_string.gsub(/\A.*?[^a]id=(\d+)(&.*|\Z)/i, '\1')))
56
+
57
+ self.media_api_type = FACEBOOK_ALBUM
58
+ self.media_id = aid
59
+ media_creator = uid
60
+
61
+ fql_id = ((media_creator.to_i << 32) + self.media_id.to_i).to_s
62
+
63
+ self.media_api_id = fql_id
64
+
65
+ self.media_api_ids = { :aid => aid, :uid => media_creator, :fql_id => fql_id }
66
+ self.media_website = "#{url_common}/album.php?aid=#{self.media_id}&id=#{media_creator}"
64
67
  else
65
68
  raise UnsupportedURI
66
69
  end
@@ -10,6 +10,7 @@ class Muri
10
10
  REGEX_YOUTUBE_VIDEO_DIRECT = /\/v\/([a-z0-9\-\_]+)/i
11
11
  REGEX_YOUTUBE_PLAYLIST_WATCH = /^\/view\_play\_list\/?$/i
12
12
  REGEX_YOUTUBE_PLAYLIST_DIRECT = /^\/p\/([a-z0-9\-\_]+)/i
13
+ REGEX_YOUTUBE_SHORTURL = /^\/([a-z0-9]+)$/i
13
14
 
14
15
  def self.included(base)
15
16
  base.class_eval do
@@ -18,7 +19,7 @@ class Muri
18
19
  end
19
20
 
20
21
  def self.parsable?(uri)
21
- uri.host =~ /^(www\.)?youtube\.com$/i
22
+ uri.host =~ /^(www\.)?youtu(be\.com|\.be)$/i
22
23
  end
23
24
 
24
25
  def youtube_parse
@@ -39,6 +40,9 @@ class Muri
39
40
  elsif (self.uri.path =~ REGEX_YOUTUBE_PLAYLIST_WATCH) && params['p']
40
41
  self.media_id = params['p']
41
42
  self.media_api_type = YOUTUBE_PLAYLIST
43
+ elsif (self.uri.path =~ REGEX_YOUTUBE_SHORTURL)
44
+ self.media_id = $1
45
+ self.media_api_type = YOUTUBE_VIDEO
42
46
  else
43
47
  raise UnsupportedURI
44
48
  end
data/muri.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{muri}
8
- s.version = "1.1.5"
8
+ s.version = "1.1.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["William Schneider"]
12
- s.date = %q{2010-04-29}
12
+ s.date = %q{2011-04-19}
13
13
  s.description = %q{Automatically get media information from the URL.}
14
14
  s.email = %q{bananastalktome@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -33,31 +33,31 @@ Gem::Specification.new do |s|
33
33
  "lib/muri/filters/vimeo.rb",
34
34
  "lib/muri/filters/youtube.rb",
35
35
  "muri.gemspec",
36
- "test/error_test.rb",
37
- "test/facebook_test.rb",
38
- "test/flickr_test.rb",
39
- "test/imageshack_test.rb",
40
- "test/photobucket_test.rb",
41
- "test/picasa_test.rb",
42
- "test/twitpic_test.rb",
43
- "test/vimeo_test.rb",
44
- "test/youtube_test.rb"
36
+ "spec/error_spec.rb",
37
+ "spec/facebook_spec.rb",
38
+ "spec/flickr_spec.rb",
39
+ "spec/imageshack_spec.rb",
40
+ "spec/photobucket_spec.rb",
41
+ "spec/picasa_spec.rb",
42
+ "spec/twitpic_spec.rb",
43
+ "spec/vimeo_spec.rb",
44
+ "spec/youtube_spec.rb"
45
45
  ]
46
46
  s.homepage = %q{http://github.com/bananastalktome/muri/}
47
47
  s.rdoc_options = ["--charset=UTF-8"]
48
48
  s.require_paths = ["lib"]
49
- s.rubygems_version = %q{1.3.6}
49
+ s.rubygems_version = %q{1.3.5}
50
50
  s.summary = %q{Media URI Parser}
51
51
  s.test_files = [
52
- "test/error_test.rb",
53
- "test/facebook_test.rb",
54
- "test/flickr_test.rb",
55
- "test/imageshack_test.rb",
56
- "test/photobucket_test.rb",
57
- "test/picasa_test.rb",
58
- "test/twitpic_test.rb",
59
- "test/vimeo_test.rb",
60
- "test/youtube_test.rb"
52
+ "spec/vimeo_spec.rb",
53
+ "spec/flickr_spec.rb",
54
+ "spec/twitpic_spec.rb",
55
+ "spec/picasa_spec.rb",
56
+ "spec/photobucket_spec.rb",
57
+ "spec/facebook_spec.rb",
58
+ "spec/youtube_spec.rb",
59
+ "spec/error_spec.rb",
60
+ "spec/imageshack_spec.rb"
61
61
  ]
62
62
 
63
63
  if s.respond_to? :specification_version then
@@ -17,6 +17,25 @@ shared_examples_for "Facebook parse" do
17
17
  @a.valid?.should == true
18
18
  end
19
19
  end
20
+ shared_examples_for "Facebook parse album" do
21
+ it_should_behave_like "Facebook parse"
22
+ it "should have media api type = FACEBOOK_VIDEO" do
23
+ @a.media_api_type.should == Muri::FACEBOOK_ALBUM
24
+ end
25
+
26
+ it "should be facebook video" do
27
+ @a.facebook_album?.should == true
28
+ end
29
+
30
+ it "should not be facebook photo" do
31
+ @a.facebook_photo?.should == false
32
+ end
33
+
34
+ it "should not be flickr media" do
35
+ @a.flickr_media?.should == false
36
+ end
37
+ end
38
+
20
39
  shared_examples_for "Facebook parse video" do
21
40
  it_should_behave_like "Facebook parse"
22
41
  it "should have media api type = FACEBOOK_VIDEO" do
@@ -70,6 +89,12 @@ end
70
89
  :media_id => '545993063513',
71
90
  :media_website => "http://www.facebook.com/video/video.php?v=545993063513",
72
91
  :media_api_id => '545993063513'
92
+ },
93
+ 'http://www.facebook.com/home.php?#!/album.php?id=15201063&aid=2149275' =>
94
+ { :type => :album,
95
+ :media_id => '2149275',
96
+ :media_website => 'http://www.facebook.com/album.php?aid=2149275&id=15201063',
97
+ :media_api_id => '65288068451584923'
73
98
  }
74
99
  }.each do |url, values|
75
100
  describe "Facebook parse #{url}" do
@@ -80,6 +105,8 @@ end
80
105
  it_should_behave_like "Facebook parse photo"
81
106
  elsif values[:type] == :video
82
107
  it_should_behave_like "Facebook parse video"
108
+ elsif values[:type] == :album
109
+ it_should_behave_like "Facebook parse album"
83
110
  end
84
111
 
85
112
  if values[:media_id]
@@ -79,7 +79,17 @@ end
79
79
  { :type => :video,
80
80
  :media_id => 'IPFnWoYy_8w',
81
81
  :media_api_id => 'IPFnWoYy_8w'
82
- }
82
+ },
83
+ "http://youtu.be/ZL1Jta1j42c" =>
84
+ { :type => :video,
85
+ :media_id => "ZL1Jta1j42c",
86
+ :media_api_id => "ZL1Jta1j42c"
87
+ },
88
+ "http://youtu.be/ZL1Jta1j42c?hd=1" =>
89
+ { :type => :video,
90
+ :media_id => "ZL1Jta1j42c",
91
+ :media_api_id => "ZL1Jta1j42c"
92
+ }
83
93
  }.each do |url, values|
84
94
  describe "Youtube parse #{values[:type]} #{url}" do
85
95
  before(:all) do
metadata CHANGED
@@ -1,12 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muri
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 1
8
- - 5
9
- version: 1.1.5
4
+ version: 1.1.6
10
5
  platform: ruby
11
6
  authors:
12
7
  - William Schneider
@@ -14,7 +9,7 @@ autorequire:
14
9
  bindir: bin
15
10
  cert_chain: []
16
11
 
17
- date: 2010-04-29 00:00:00 -04:00
12
+ date: 2011-04-19 00:00:00 -04:00
18
13
  default_executable:
19
14
  dependencies: []
20
15
 
@@ -44,15 +39,15 @@ files:
44
39
  - lib/muri/filters/vimeo.rb
45
40
  - lib/muri/filters/youtube.rb
46
41
  - muri.gemspec
47
- - test/error_test.rb
48
- - test/facebook_test.rb
49
- - test/flickr_test.rb
50
- - test/imageshack_test.rb
51
- - test/photobucket_test.rb
52
- - test/picasa_test.rb
53
- - test/twitpic_test.rb
54
- - test/vimeo_test.rb
55
- - test/youtube_test.rb
42
+ - spec/error_spec.rb
43
+ - spec/facebook_spec.rb
44
+ - spec/flickr_spec.rb
45
+ - spec/imageshack_spec.rb
46
+ - spec/photobucket_spec.rb
47
+ - spec/picasa_spec.rb
48
+ - spec/twitpic_spec.rb
49
+ - spec/vimeo_spec.rb
50
+ - spec/youtube_spec.rb
56
51
  has_rdoc: true
57
52
  homepage: http://github.com/bananastalktome/muri/
58
53
  licenses: []
@@ -66,30 +61,28 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
61
  requirements:
67
62
  - - ">="
68
63
  - !ruby/object:Gem::Version
69
- segments:
70
- - 0
71
64
  version: "0"
65
+ version:
72
66
  required_rubygems_version: !ruby/object:Gem::Requirement
73
67
  requirements:
74
68
  - - ">="
75
69
  - !ruby/object:Gem::Version
76
- segments:
77
- - 0
78
70
  version: "0"
71
+ version:
79
72
  requirements: []
80
73
 
81
74
  rubyforge_project:
82
- rubygems_version: 1.3.6
75
+ rubygems_version: 1.3.5
83
76
  signing_key:
84
77
  specification_version: 3
85
78
  summary: Media URI Parser
86
79
  test_files:
87
- - test/error_test.rb
88
- - test/facebook_test.rb
89
- - test/flickr_test.rb
90
- - test/imageshack_test.rb
91
- - test/photobucket_test.rb
92
- - test/picasa_test.rb
93
- - test/twitpic_test.rb
94
- - test/vimeo_test.rb
95
- - test/youtube_test.rb
80
+ - spec/vimeo_spec.rb
81
+ - spec/flickr_spec.rb
82
+ - spec/twitpic_spec.rb
83
+ - spec/picasa_spec.rb
84
+ - spec/photobucket_spec.rb
85
+ - spec/facebook_spec.rb
86
+ - spec/youtube_spec.rb
87
+ - spec/error_spec.rb
88
+ - spec/imageshack_spec.rb
File without changes
File without changes
File without changes
File without changes
File without changes