muri 1.1.8 → 1.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,5 +1,7 @@
1
1
  Muri Changelog
2
2
  ===================================
3
+ Version 1.1.9
4
+ * Updated flickr static url's to use & recognize new http://farm{farm-id}.staticflickr.com/ scheme
3
5
 
4
6
  Version 1.1.8
5
7
  * Fix to allow youtube short URL's to properly work (youtu.be/blah style)
data/README.textile CHANGED
@@ -37,7 +37,7 @@ Using muri is just as easy!
37
37
  </code>
38
38
  </pre>
39
39
 
40
- If @a.valid?@ you are good to go. If not, either the URI host was not recognized, or the path/parameters provided along with a known URI host were not recognized. When these two types of errors are encountered, an exception is caught and returned in @a.errors@ as either "Muri::NoParser" or "Muri::UnrecognizedURI" (or potentially "URI::BadURIError" or "URI::InvalidURIError" if the URI passed is bad). If you don't care about the type of error, just whether the URI was parsed, @a.valid?@ will give you a boolean answer.
40
+ If @a.valid?@ is true, you are good to go. If not, either the URI host was not recognized, or the path/parameters provided along with a known URI host were not recognized. When these two types of errors are encountered, an exception is caught and returned in @a.errors@ as either "Muri::NoParser" or "Muri::UnrecognizedURI" (or potentially "URI::BadURIError" or "URI::InvalidURIError" if the URI passed is bad). If you don't care about the type of error, just whether the URI was parsed, @a.valid?@ will give you a boolean answer.
41
41
 
42
42
  Assuming the URI was successfully parsed (thus @a.valid? == true@), all media types share several common attributes:
43
43
 
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 1
4
- :patch: 8
4
+ :patch: 9
5
5
  :build:
@@ -7,7 +7,7 @@ class Muri
7
7
  FLICKR_SET = "set"
8
8
 
9
9
  REGEX_FLICKR_MEDIA_OR_SET = /^\/photos\/([a-z0-9\-\_\@]+?)\/(sets\/)?([0-9]+)/i
10
- REGEX_FLICKR_STATIC_MEDIA = /^farm([1-3])\.static.flickr.com\/([0-9]+?)\/([0-9]+?)\_([a-z0-9]+?)((?:\_[a-z]){1,2}){0,1}\.([a-z]+)/i
10
+ REGEX_FLICKR_STATIC_MEDIA = /^farm([1-3])\.static.?flickr.com\/([0-9]+?)\/([0-9]+?)\_([a-z0-9]+?)((?:\_[a-z]){1,2}){0,1}\.([a-z]+)/i
11
11
  REGEX_FLICKR_SHORTURL = /^flic\.kr\/p\/([a-z0-9]+)/i
12
12
 
13
13
  def self.included(base)
@@ -17,7 +17,7 @@ class Muri
17
17
  end
18
18
 
19
19
  def self.parsable?(uri)
20
- uri.host =~ /^(www\.)?(flic\.kr|(farm[0-9]\.static\.|)(flickr)\.com)/i
20
+ uri.host =~ /^(www\.)?(flic\.kr|(farm[0-9]\.static\.?|)(flickr)\.com)/i
21
21
  end
22
22
 
23
23
  def flickr_parse
@@ -33,7 +33,7 @@ class Muri
33
33
  self.media_id = $3
34
34
  self.media_api_type = FLICKR_MEDIA
35
35
  media_secret = $4
36
- url_prefix = "http://farm#{farm}.static.flickr.com/#{server_id}/#{self.media_id}_#{media_secret}"
36
+ url_prefix = "http://farm#{farm}.staticflickr.com/#{server_id}/#{self.media_id}_#{media_secret}"
37
37
  self.media_url = "#{url_prefix}.jpg"
38
38
  self.media_thumbnail = "#{url_prefix}_t.jpg"
39
39
  elsif (self.uri.host + self.uri.path) =~ REGEX_FLICKR_SHORTURL
@@ -82,24 +82,3 @@ class Muri
82
82
  end
83
83
  end
84
84
  end
85
- # if !$5.nil?
86
- # @info[:media_size] = case $5.downcase
87
- # when '_s' then 'square'
88
- # when '_t' then 'thumbnail'
89
- # when '_m' then 'small'
90
- # when '_b' then 'large'
91
- # when '_o' then 'original'
92
- # else 'medium'
93
- # end
94
- # end
95
- # @info[:content_type] = $6
96
- # http://www.flickr.com/photos/bananastalktome/2088436532/ (preview)
97
- # http://flic.kr/p/4bxMqq (preview)
98
- # http://farm3.static.flickr.com/2178/2088436532_ee07b4474e_m.jpg (direct)
99
- # farm-id: 3
100
- # server-id: 2178
101
- # photo-id: 2088436532
102
- # secret: ee07b4474e
103
- # size: m
104
- # * add _d before .jpg in url to create a download URL
105
- # http://www.flickr.com/photos/bananastalktome/sets/72157623467777820/ (set preview)
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.8"
8
+ s.version = "1.1.9"
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{2011-08-23}
12
+ s.date = %q{2012-02-17}
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 = [
@@ -49,15 +49,15 @@ Gem::Specification.new do |s|
49
49
  s.rubygems_version = %q{1.4.2}
50
50
  s.summary = %q{Media URI Parser}
51
51
  s.test_files = [
52
- "spec/vimeo_spec.rb",
52
+ "spec/error_spec.rb",
53
+ "spec/picasa_spec.rb",
53
54
  "spec/flickr_spec.rb",
54
55
  "spec/twitpic_spec.rb",
55
- "spec/picasa_spec.rb",
56
56
  "spec/photobucket_spec.rb",
57
- "spec/facebook_spec.rb",
58
57
  "spec/youtube_spec.rb",
59
- "spec/error_spec.rb",
60
- "spec/imageshack_spec.rb"
58
+ "spec/facebook_spec.rb",
59
+ "spec/imageshack_spec.rb",
60
+ "spec/vimeo_spec.rb"
61
61
  ]
62
62
 
63
63
  if s.respond_to? :specification_version then
data/spec/flickr_spec.rb CHANGED
@@ -54,7 +54,14 @@ end
54
54
  :media_id => '2088436532',
55
55
  :media_website => 'http://flic.kr/p/4bxMqq',
56
56
  :media_api_id => '2088436532',
57
- :media_thumbnail => 'http://farm3.static.flickr.com/2178/2088436532_ee07b4474e_t.jpg'
57
+ :media_thumbnail => 'http://farm3.staticflickr.com/2178/2088436532_ee07b4474e_t.jpg'
58
+ },
59
+ 'http://farm3.staticflickr.com/2178/2088436532_ee07b4474e_b.jpg' =>
60
+ { :type => :photo,
61
+ :media_id => '2088436532',
62
+ :media_website => 'http://flic.kr/p/4bxMqq',
63
+ :media_api_id => '2088436532',
64
+ :media_thumbnail => 'http://farm3.staticflickr.com/2178/2088436532_ee07b4474e_t.jpg'
58
65
  },
59
66
  'http://www.flickr.com/photos/bananastalktome/sets/72157623467777820/' =>
60
67
  { :type => :set,
data/spec/youtube_spec.rb CHANGED
@@ -89,7 +89,12 @@ end
89
89
  { :type => :video,
90
90
  :media_id => "ZL1Jta1j42c",
91
91
  :media_api_id => "ZL1Jta1j42c"
92
- }
92
+ },
93
+ "http://youtu.be/QH2-TGUlwu4" =>
94
+ { :type => :video,
95
+ :media_id => "QH2-TGUlwu4",
96
+ :media_api_id => "QH2-TGUlwu4"
97
+ }
93
98
  }.each do |url, values|
94
99
  describe "Youtube parse #{values[:type]} #{url}" do
95
100
  before(:all) do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muri
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 8
10
- version: 1.1.8
9
+ - 9
10
+ version: 1.1.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - William Schneider
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-23 00:00:00 -04:00
18
+ date: 2012-02-17 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -89,12 +89,12 @@ signing_key:
89
89
  specification_version: 3
90
90
  summary: Media URI Parser
91
91
  test_files:
92
- - spec/vimeo_spec.rb
92
+ - spec/error_spec.rb
93
+ - spec/picasa_spec.rb
93
94
  - spec/flickr_spec.rb
94
95
  - spec/twitpic_spec.rb
95
- - spec/picasa_spec.rb
96
96
  - spec/photobucket_spec.rb
97
- - spec/facebook_spec.rb
98
97
  - spec/youtube_spec.rb
99
- - spec/error_spec.rb
98
+ - spec/facebook_spec.rb
100
99
  - spec/imageshack_spec.rb
100
+ - spec/vimeo_spec.rb