rpms/alexandria/devel alexandria-0.6.5-WorldCat-results.patch, NONE, 1.1 alexandria-0.6.5-crash-in-turkish.patch, 1.1, 1.2 alexandria.spec, 1.41, 1.42

Mamoru Tasaka mtasaka at fedoraproject.org
Wed Sep 2 04:59:43 UTC 2009


Author: mtasaka

Update of /cvs/extras/rpms/alexandria/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv28218

Modified Files:
	alexandria-0.6.5-crash-in-turkish.patch alexandria.spec 
Added Files:
	alexandria-0.6.5-WorldCat-results.patch 
Log Message:
* Wed Sep  2 2009 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 0.6.5-7
- Fix for parsing WorldCat provider search result (alexandria-Bugs-27028)


alexandria-0.6.5-WorldCat-results.patch:
 worldcat.rb |   35 ++++++++++++++++++++++++++++-------
 1 file changed, 28 insertions(+), 7 deletions(-)

--- NEW FILE alexandria-0.6.5-WorldCat-results.patch ---
Index: lib/alexandria/book_providers/worldcat.rb
===================================================================
--- lib/alexandria/book_providers/worldcat.rb	(revision 1088)
+++ lib/alexandria/book_providers/worldcat.rb	(revision 1089)
@@ -23,7 +23,11 @@
 # New WorldCat provider, taken from the Palatina MetaDataSource and
 # modified to fit the structure of Alexandria book providers.
 # (25 Feb 2009)
+#
+# Updated from Palatina, to reflect changes in the worldcat website.
+# (1 Sep 2009)
 
+
 require 'cgi'
 require 'alexandria/net'
 
@@ -136,7 +140,17 @@
           raise NoResultsError
         end
 
-        title_header = doc%'h1.item-title'
+
+        if doc % 'table.table-results'
+          log.info { "Found multiple results for lookup: fetching first result only" }
+          search_results = parse_search_result_data(html)
+          first = search_results.first
+          rslt2 = transport.get_response(URI.parse(first[:url]))
+          html2 = rslt2.body
+          doc = Hpricot(html2)
+        end
+
+        title_header = doc%'h1.title'
         title = title_header.inner_text if title_header
         unless title
           log.warn { "Unexpected lack of title from WorldCat lookup" }
@@ -145,18 +159,25 @@
         log.info { "Found book #{title} at WorldCat" }
 
         authors = []
-        authors_div = doc%'div.item-author'
-        if authors_div
-          (authors_div/:a).each do |a|
+        authors_tr = doc%'tr#details-allauthors'
+        if authors_tr
+          (authors_tr/:a).each do |a|
             authors << a.inner_text
           end
         end
 
         # can we do better? get the City name?? or multiple publishers?
-        publisher_row = doc%'td.label[text()*=Publisher]/..'
+        bibdata = doc % 'div#bibdata'
+        bibdata_table = bibdata % :table
+        publisher_row = bibdata_table % 'th[text()*=Publisher]/..'
+
         if publisher_row
           publication_info = (publisher_row/'td').last.inner_text
-          publication_info =~ /:*([^;,]+)/
+          if publication_info.index(':')
+            publication_info =~ /:[\s]*([^;,]+)/
+          else
+            publication_info =~ /([^;,]+)/
+          end
           publisher = $1
           publication_info =~ /([12][0-9]{3})/
           year = $1.to_i if $1
@@ -167,7 +188,7 @@
 
         isbn = search_isbn
         unless isbn
-          isbn_row = doc%'td.label[text()*=ISBN]/..'
+          isbn_row = doc % 'tr#details-standardno' ##bibdata_table % 'th[text()*=ISBN]/..'
           if isbn_row
             isbns = (isbn_row/'td').last.inner_text.split
             isbn = Library.canonicalise_isbn(isbns.first)

alexandria-0.6.5-crash-in-turkish.patch:
 icons.rb |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: alexandria-0.6.5-crash-in-turkish.patch
===================================================================
RCS file: /cvs/extras/rpms/alexandria/devel/alexandria-0.6.5-crash-in-turkish.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- alexandria-0.6.5-crash-in-turkish.patch	28 Aug 2009 19:57:58 -0000	1.1
+++ alexandria-0.6.5-crash-in-turkish.patch	2 Sep 2009 04:59:43 -0000	1.2
@@ -1,7 +1,7 @@
 Index: lib/alexandria/ui/icons.rb
 ===================================================================
 --- lib/alexandria/ui/icons.rb	(revision 1087)
-+++ lib/alexandria/ui/icons.rb	(working copy)
++++ lib/alexandria/ui/icons.rb	(revision 1088)
 @@ -63,7 +63,9 @@
        def self.load_icon_images
          Dir.entries(ICONS_DIR).each do |file|


Index: alexandria.spec
===================================================================
RCS file: /cvs/extras/rpms/alexandria/devel/alexandria.spec,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -p -r1.41 -r1.42
--- alexandria.spec	29 Aug 2009 12:52:22 -0000	1.41
+++ alexandria.spec	2 Sep 2009 04:59:43 -0000	1.42
@@ -5,7 +5,7 @@
 %define		majorver	0.6.5
 %undefine		minorver	
 
-%define		fedorarel	6
+%define		fedorarel	6.1
 %define		rel		%{?minorver:0.}%{fedorarel}%{?minorver:.%minorver}
 
 
@@ -33,9 +33,11 @@ Patch4:		alexandria-0.6.5-search-result-
 # ref: alexandria-Bugs-27000
 Patch5:		alexandria-0.6.5-deastore-author-missing.patch
 # Alexandria crashes in tr_TR.UTF-8 on startup
-# RH bug 520170
-# alexandria-Bugs-27015, applied in rev 1088
+# RH bug 520170, alexandria-Bugs-27015
 Patch6:		alexandria-0.6.5-crash-in-turkish.patch
+# Fix for parsing WorldCat search result
+# ref: alexandria-Bugs-27028
+Patch7:		alexandria-0.6.5-WorldCat-results.patch
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildArch:	noarch
@@ -90,6 +92,7 @@ Alexandria is a GNOME application to hel
 %patch4 -p0 -b .sanity
 %patch5 -p0 -b .deastore
 %patch6 -p0 -b .tr_TR
+%patch7 -p0 -b .worldcat
 
 # Embed Fedora EVR
 %{__sed} -i.evr \
@@ -216,16 +219,20 @@ exit 0
 %{_datadir}/icons/hicolor/*/apps/%{name}.*
 
 %changelog
+* Wed Sep  2 2009 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 0.6.5-7
+- Fix for parsing WorldCat provider search result (alexandria-Bugs-27028)
+
 * Sat Aug 28 2009 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 0.6.5-6
-- Fix crash on startup in tr_TR.UTF-8 (bug 520170)
+- Fix crash on startup in tr_TR.UTF-8 (bug 520170, alexandria-Bugs-27015)
 
 * 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-Bugs-27000)
 
 * 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 
-  functionality of alexandria)
+  functionality of alexandria, alexandria-Bugs-26968)
 
 * Thu Aug 20 2009 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 0.6.5-2
 - Kill the previous 2 patches (for now)




More information about the fedora-extras-commits mailing list