rfeedreader 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 1.0.13 2008-06-19
2
+
3
+ * Add: MRSS support
4
+
1
5
  == 1.0.11 2008-03-05
2
6
 
3
7
  * Remove: word cut is a bad idea without enough testing
data/lib/rfeedreader.rb CHANGED
@@ -110,14 +110,13 @@ module Rfeedreader
110
110
  end
111
111
 
112
112
  class Feed
113
- attr_accessor :feed_url, :title, :link, :charset, :entries
113
+ attr_accessor :feed_url, :title, :link, :charset, :entries, :is_mrss
114
114
 
115
115
  def initialize(link, hpricot_doc)
116
116
  @feed_url = link
117
- read_title hpricot_doc
118
- read_link hpricot_doc
119
- read_charset hpricot_doc
120
117
  @entries = []
118
+
119
+ read_header hpricot_doc
121
120
  end
122
121
 
123
122
  def parse_entries(hpricot_doc, nb_posts=10)
@@ -126,21 +125,27 @@ module Rfeedreader
126
125
 
127
126
  # Parse each item
128
127
  (hpricot_doc/"item|entry")[0..nb_posts - 1].each do |item|
129
- case type
130
- when "source_flickr"
131
- @entries<<Entry_Flickr.new(item, self.charset)
132
- when "source_fotolog"
133
- @entries<<Entry_Fotolog.new(item, self.charset)
134
- when "source_google_video"
135
- @entries<<Entry_Google_Video.new(item, self.charset)
136
- when "source_jumpcut"
137
- @entries<<Entry_Jumpcut.new(item, self.charset)
138
- when "source_picasa"
139
- @entries<<Entry_Picasa.new(item, self.charset)
140
- when "source_youtube"
141
- @entries<<Entry_Youtube.new(item, self.charset)
142
- else
143
- @entries<<Entry.new(item, self.charset)
128
+
129
+ if @is_mrss
130
+ puts "is_mrss"
131
+ @entries<<Entry_MRSS.new(item, self.charset)
132
+ else
133
+ case type
134
+ when "source_flickr"
135
+ @entries<<Entry_Flickr.new(item, self.charset)
136
+ when "source_fotolog"
137
+ @entries<<Entry_Fotolog.new(item, self.charset)
138
+ when "source_google_video"
139
+ @entries<<Entry_Google_Video.new(item, self.charset)
140
+ when "source_jumpcut"
141
+ @entries<<Entry_Jumpcut.new(item, self.charset)
142
+ when "source_picasa"
143
+ @entries<<Entry_Picasa.new(item, self.charset)
144
+ when "source_youtube"
145
+ @entries<<Entry_Youtube.new(item, self.charset)
146
+ else
147
+ @entries<<Entry.new(item, self.charset)
148
+ end
144
149
  end
145
150
  end
146
151
  end
@@ -163,9 +168,22 @@ module Rfeedreader
163
168
 
164
169
  protected
165
170
 
171
+ def read_header(hpricot_doc)
172
+ read_title hpricot_doc
173
+ read_link hpricot_doc
174
+ read_charset hpricot_doc
175
+ read_mrss hpricot_doc
176
+ end
177
+
178
+ def read_mrss(hpricot_doc)
179
+ media = hpricot_doc.to_s.scan(/xmlns:media=['"]?([^'"]*)['" ]/)
180
+ media *= "" if media.is_a? Array
181
+ @is_mrss = media == "http://search.yahoo.com/mrss/"
182
+ end
183
+
166
184
  def read_charset(hpricot_doc)
167
185
  @charset = hpricot_doc.to_s.scan(/encoding=['"]?([^'"]*)['" ]/)
168
- @charset = @charset[0] if @charset.is_a? Array
186
+ @charset *= "" if @charset.is_a? Array
169
187
  @charset = @charset.to_s.downcase
170
188
  @charset = 'utf-8' if @charset.empty?
171
189
  end
@@ -275,6 +293,13 @@ module Rfeedreader
275
293
  "Entry: title: #{@title} - link: #{@url}\n\rdescription: #{@description}"
276
294
  end
277
295
  end
296
+
297
+ class Entry_MRSS<Entry
298
+ def read_description
299
+ image = @hpricot_item.search("media:thumbnail").to_s.scan(/url=['"]?([^'"]*)['" ]/).to_s
300
+ @description = "<a href='#{@link}' class='image_link'><img src='#{image}' class='post_image'/></a>"
301
+ end
302
+ end
278
303
 
279
304
  class Entry_Flickr<Entry
280
305
  def read_description
@@ -2,7 +2,7 @@ module Rfeedreader #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- TINY = 12
5
+ TINY = 13
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -246,4 +246,8 @@ class TestRfeedreader < Test::Unit::TestCase
246
246
  def test_maria
247
247
  read_first "http://unamiradadesdeelsur.wordpress.com/"
248
248
  end
249
+
250
+ def test_mrss
251
+ read_first "http://www.mariabonitacoisas.com.br/home/rss/mrss"
252
+ end
249
253
  end
data/website/index.html CHANGED
@@ -33,7 +33,7 @@
33
33
  <h1>rfeedreader</h1>
34
34
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/rfeedreader"; return false'>
35
35
  <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/rfeedreader" class="numbers">1.0.11</a>
36
+ <a href="http://rubyforge.org/projects/rfeedreader" class="numbers">1.0.13</a>
37
37
  </div>
38
38
  <h2>What</h2>
39
39
 
@@ -89,7 +89,7 @@ Rfeedfinder.read('http://blog.alexgirard.com/feed/', nb_posts=3)
89
89
 
90
90
  <p>Comments are welcome. Send an email to <a href="mailto:alx.girard@gmail.com">Alexandre Girard</a>.</p>
91
91
  <p class="coda">
92
- <a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 27th February 2008<br>
92
+ <a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 2nd June 2008<br>
93
93
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
94
94
  </p>
95
95
  </div>
metadata CHANGED
@@ -1,73 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
4
2
  name: rfeedreader
5
3
  version: !ruby/object:Gem::Version
6
- version: 1.0.12
7
- date: 2008-03-12 00:00:00 +01:00
8
- summary: Feed parser to read feed and return first posts of this feed. Special parsing from sources like Flickr, Jumcut, Google video, ...
9
- require_paths:
10
- - lib
11
- email: alx.girard@gmail.com
12
- homepage: http://rfeedreader.rubyforge.org
13
- rubyforge_project: rfeedreader
14
- description: Feed parser to read feed and return first posts of this feed. Special parsing from sources like Flickr, Jumcut, Google video, ...
15
- autorequire:
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ version: 1.0.13
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - Alexandre Girard
31
- files:
32
- - History.txt
33
- - License.txt
34
- - Manifest.txt
35
- - README.txt
36
- - Rakefile
37
- - lib/rfeedreader.rb
38
- - lib/rfeedreader/version.rb
39
- - scripts/txt2html
40
- - setup.rb
41
- - test/test_helper.rb
42
- - test/test_rfeedreader.rb
43
- - website/index.html
44
- - website/index.txt
45
- - website/javascripts/rounded_corners_lite.inc.js
46
- - website/stylesheets/screen.css
47
- - website/template.rhtml
48
- test_files:
49
- - test/test_helper.rb
50
- - test/test_rfeedreader.rb
51
- rdoc_options:
52
- - --main
53
- - README.txt
54
- extra_rdoc_files:
55
- - History.txt
56
- - License.txt
57
- - Manifest.txt
58
- - README.txt
59
- - website/index.txt
60
- executables: []
61
-
62
- extensions: []
63
-
64
- requirements: []
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
65
11
 
12
+ date: 2008-06-20 00:00:00 -03:00
13
+ default_executable:
66
14
  dependencies:
67
15
  - !ruby/object:Gem::Dependency
68
16
  name: rfeedfinder
69
17
  version_requirement:
70
- version_requirements: !ruby/object:Gem::Version::Requirement
18
+ version_requirements: !ruby/object:Gem::Requirement
71
19
  requirements:
72
20
  - - ">="
73
21
  - !ruby/object:Gem::Version
@@ -76,7 +24,7 @@ dependencies:
76
24
  - !ruby/object:Gem::Dependency
77
25
  name: htmlentities
78
26
  version_requirement:
79
- version_requirements: !ruby/object:Gem::Version::Requirement
27
+ version_requirements: !ruby/object:Gem::Requirement
80
28
  requirements:
81
29
  - - ">="
82
30
  - !ruby/object:Gem::Version
@@ -85,9 +33,68 @@ dependencies:
85
33
  - !ruby/object:Gem::Dependency
86
34
  name: hpricot
87
35
  version_requirement:
88
- version_requirements: !ruby/object:Gem::Version::Requirement
36
+ version_requirements: !ruby/object:Gem::Requirement
89
37
  requirements:
90
38
  - - ">="
91
39
  - !ruby/object:Gem::Version
92
40
  version: "0.6"
93
41
  version:
42
+ description: Feed parser to read feed and return first posts of this feed. Special parsing from sources like Flickr, Jumcut, Google video, ...
43
+ email: alx.girard@gmail.com
44
+ executables: []
45
+
46
+ extensions: []
47
+
48
+ extra_rdoc_files:
49
+ - History.txt
50
+ - License.txt
51
+ - Manifest.txt
52
+ - README.txt
53
+ - website/index.txt
54
+ files:
55
+ - History.txt
56
+ - License.txt
57
+ - Manifest.txt
58
+ - README.txt
59
+ - Rakefile
60
+ - lib/rfeedreader.rb
61
+ - lib/rfeedreader/version.rb
62
+ - scripts/txt2html
63
+ - setup.rb
64
+ - test/test_helper.rb
65
+ - test/test_rfeedreader.rb
66
+ - website/index.html
67
+ - website/index.txt
68
+ - website/javascripts/rounded_corners_lite.inc.js
69
+ - website/stylesheets/screen.css
70
+ - website/template.rhtml
71
+ has_rdoc: true
72
+ homepage: http://rfeedreader.rubyforge.org
73
+ post_install_message:
74
+ rdoc_options:
75
+ - --main
76
+ - README.txt
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: "0"
84
+ version:
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: "0"
90
+ version:
91
+ requirements: []
92
+
93
+ rubyforge_project: rfeedreader
94
+ rubygems_version: 1.1.1
95
+ signing_key:
96
+ specification_version: 2
97
+ summary: Feed parser to read feed and return first posts of this feed. Special parsing from sources like Flickr, Jumcut, Google video, ...
98
+ test_files:
99
+ - test/test_helper.rb
100
+ - test/test_rfeedreader.rb