rpms/alexandria/devel alexandria-0.6.5-deastore-author-missing.patch, NONE, 1.1 alexandria-0.6.5-search-result-sanity-check.patch, 1.1, 1.2 alexandria.spec, 1.38, 1.39
Mamoru Tasaka
mtasaka at fedoraproject.org
Thu Aug 27 02:48:15 UTC 2009
Author: mtasaka
Update of /cvs/extras/rpms/alexandria/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv22443/devel
Modified Files:
alexandria-0.6.5-search-result-sanity-check.patch
alexandria.spec
Added Files:
alexandria-0.6.5-deastore-author-missing.patch
Log Message:
* Thu Aug 27 2009 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 0.6.5-5
- Add sanity check for invalid search result, now using upstream patch
- Fix DeaStore provider where search result contains no Author
alexandria-0.6.5-deastore-author-missing.patch:
deastore.rb | 61 ++++++++++++++++++++++++++++++++++++++++++++++--------------
1 file changed, 47 insertions(+), 14 deletions(-)
--- NEW FILE alexandria-0.6.5-deastore-author-missing.patch ---
Index: lib/alexandria/book_providers/deastore.rb
===================================================================
--- lib/alexandria/book_providers/deastore.rb (revision 1086)
+++ lib/alexandria/book_providers/deastore.rb (revision 1087)
@@ -49,12 +49,18 @@
def get_book_from_search_result(result)
log.debug { "Fetching book from #{result[:url]}" }
html_data = agent.get(result[:url])
+ #File.open("rsltflarn#{Time.now().usec()}.html", 'wb') do |f|
+ # f.write(html_data.body)
+ #end
parse_result_data(html_data.body)
end
def search(criterion, type)
criterion = criterion.convert("ISO-8859-1", "UTF-8") # still needed??
html_data = agent.get(create_search_uri(type, criterion))
+ #File.open("flarn#{Time.now().usec()}.html", 'wb') do |f|
+ # f.write(html_data.body)
+ #end
results = parse_search_result_data(html_data.body)
raise NoResultsError if results.empty?
@@ -89,7 +95,9 @@
search_term_encoded = CGI.escape(search_term)
end
- BASE_SEARCH_URL % [search_type_code, search_term_encoded]
+ uri = BASE_SEARCH_URL % [search_type_code, search_term_encoded]
+ log.debug { uri }
+ uri
end
def parse_search_result_data(html)
@@ -109,13 +117,21 @@
# p Data di pubblicazione: \n 2009
# p.prezzo (price)
- cover_url = ''
- cover_images = div/'a/img'
- unless cover_images.empty?
- img = cover_images.first
- image_url = img['src']
- cover_url = "#{SITE}#{image_url}"
- end
+# cover_url = ''
+# cover_images = div/'a/img'
+# unless cover_images.empty?
+# img = cover_images.first
+# image_url = img['src']
+# if image_url =~ /^http/
+# cover_url = '' # image_url
+# elsif image_url[0..0] != '/'
+# cover_url = "#{SITE}/#{image_url}"
+# else
+# cover_url = "#{SITE}#{image_url}"
+# end
+# log.debug { "Search Cover Image URL #{cover_url}" }
+
+# end
content = div/'div.scheda_content'
title_link = (content/:a).first
@@ -167,12 +183,17 @@
end
# author(s)
+ authors = []
author_span = data%'span.int_scheda[text()*=Autore]'
- author_links = author_span/'a.info'
- authors = []
- author_links.each do |link|
- authors << normalize(link.inner_text)
+ unless author_span
+ author_span = data%'span.int_scheda[text()*=cura]' # editor
end
+ if author_span
+ author_links = author_span/'a.info'
+ author_links.each do |link|
+ authors << normalize(link.inner_text)
+ end
+ end
# publisher
publisher_par = data%'span.int_scheda[text()*=Editore]/..'
@@ -231,7 +252,19 @@
#cover
image_url = nil
if cover_link
- image_url = "#{SITE}#{cover_link}"
+ if cover_link =~ /^http/
+ # e.g. http://images.btol.com/ContentCafe/Jacket.aspx?\
+ # Return=1&Type=M&Value=9788873641803&password=\
+ # CC70580&userID=DEA40305
+ # seems not to work, or to be blank anyway, so set to nil
+ image_url = nil
+ elsif cover_link[0..0] != '/'
+ image_url = "#{SITE}/#{cover_link}"
+ else
+ image_url = "#{SITE}#{cover_link}"
+ end
+
+ log.debug { "Cover Image URL:: #{image_url}" }
end
book = Book.new(title, authors, isbn, publisher, publish_year, binding)
@@ -239,7 +272,7 @@
return [book, image_url]
rescue Exception => ex
trace = ex.backtrace.join("\n> ")
- log.error { "Failed parsing Siciliano product page #{ex.message}\n#{trace}" }
+ log.error { "Failed parsing DeaStore product page #{ex.message}\n#{trace}" }
return nil
end
end
alexandria-0.6.5-search-result-sanity-check.patch:
book_providers.rb | 3 +++
1 file changed, 3 insertions(+)
Index: alexandria-0.6.5-search-result-sanity-check.patch
===================================================================
RCS file: /cvs/extras/rpms/alexandria/devel/alexandria-0.6.5-search-result-sanity-check.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- alexandria-0.6.5-search-result-sanity-check.patch 19 Aug 2009 22:14:00 -0000 1.1
+++ alexandria-0.6.5-search-result-sanity-check.patch 27 Aug 2009 02:48:15 -0000 1.2
@@ -1,13 +1,13 @@
Index: lib/alexandria/book_providers.rb
===================================================================
---- lib/alexandria/book_providers.rb (revision 1085)
-+++ lib/alexandria/book_providers.rb (working copy)
+--- lib/alexandria/book_providers.rb (revision 1086)
++++ lib/alexandria/book_providers.rb (revision 1087)
@@ -46,6 +46,9 @@
self.instance.notify_observers(:searching, factory.fullname) # new
results = factory.search(criterion, type)
+ # sanity check if at least one valid result is actually found
-+ results.delete_if { |book, cover| ((!book) || (!cover)) }
++ results.delete_if { |book, cover| book.nil? }
+
if results.length == 0
self.instance.changed
Index: alexandria.spec
===================================================================
RCS file: /cvs/extras/rpms/alexandria/devel/alexandria.spec,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -p -r1.38 -r1.39
--- alexandria.spec 26 Aug 2009 17:44:17 -0000 1.38
+++ alexandria.spec 27 Aug 2009 02:48:15 -0000 1.39
@@ -5,7 +5,7 @@
%define majorver 0.6.5
%undefine minorver
-%define fedorarel 4
+%define fedorarel 5
%define rel %{?minorver:0.}%{fedorarel}%{?minorver:.%minorver}
@@ -26,8 +26,12 @@ Patch2: alexandria-0.6.4.1-hang-importi
# ref: alexandria-Bugs-26968
Patch3: alexandria-0.6.5-glib_convert-syntax.patch
# Add some sanity check for search results
-# Currently discussed on alexandria-Bugs-27000
+# ref: alexandria-Bugs-27000
Patch4: alexandria-0.6.5-search-result-sanity-check.patch
+# Fix for DeaStore search engine where search result does not
+# contain Author item
+# ref: alexandria-Bugs-27000
+Patch5: alexandria-0.6.5-deastore-author-missing.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
@@ -80,6 +84,7 @@ Alexandria is a GNOME application to hel
%patch2 -p0 -b .up25348
%patch3 -p0 -b .glib
%patch4 -p0 -b .sanity
+%patch5 -p0 -b .deastore
# Embed Fedora EVR
%{__sed} -i.evr \
@@ -206,8 +211,9 @@ exit 0
%{_datadir}/icons/hicolor/*/apps/%{name}.*
%changelog
-* Thu Aug 27 2009 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 0.6.5-4
-- Add trial sanity check again
+* Thu Aug 27 2009 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 0.6.5-5
+- Add sanity check for invalid search result, now using upstream patch
+- Fix DeaStore provider where search result contains no Author
* Fri Aug 21 2009 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 0.6.5-3
- Clarify GLib.convert usage in utils.rb (does not change the
More information about the fedora-extras-commits
mailing list