diff --git a/alexandria-0.6.5-WorldCat-results.patch b/alexandria-0.6.5-WorldCat-results.patch new file mode 100644 index 0000000..f11fda7 --- /dev/null +++ b/alexandria-0.6.5-WorldCat-results.patch @@ -0,0 +1,75 @@ +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) diff --git a/alexandria-0.6.5-crash-in-turkish.patch b/alexandria-0.6.5-crash-in-turkish.patch index 6ed09ca..645f830 100644 --- a/alexandria-0.6.5-crash-in-turkish.patch +++ b/alexandria-0.6.5-crash-in-turkish.patch @@ -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| diff --git a/alexandria.spec b/alexandria.spec index 1f8289f..103a8b2 100644 --- a/alexandria.spec +++ b/alexandria.spec @@ -5,7 +5,7 @@ %define majorver 0.6.5 %undefine minorver -%define fedorarel 6 +%define fedorarel 7 %define rel %{?minorver:0.}%{fedorarel}%{?minorver:.%minorver} @@ -33,9 +33,11 @@ Patch4: alexandria-0.6.5-search-result-sanity-check.patch # 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 -# Must report upstream +# 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 help you manage your book collection. %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 - 0.6.5-7 +- Fix for parsing WorldCat provider search result (alexandria-Bugs-27028) + * Sat Aug 28 2009 Mamoru Tasaka - 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 - 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 - 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 - 0.6.5-2 - Kill the previous 2 patches (for now)