<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[606] trunk/alexandria/lib/alexandria: - Now nul is returned instead of &quot;&quot;, &quot;n/a&quot;, or &quot;Unknown Binding&quot;, when the provider doesn't return a value</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>606</dd>
<dt>Author</dt> <dd>laurusnobilis</dd>
<dt>Date</dt> <dd>2007-02-18 09:09:21 -0500 (Sun, 18 Feb 2007)</dd>
</dl>

<h3>Log Message</h3>
<pre>- Now nul is returned instead of &quot;&quot;, &quot;n/a&quot;, or &quot;Unknown Binding&quot;, when the provider doesn't return a value
- minor fixes for webster_it
- commented out a line in lib/alexandria/ui/import_dialog.rb that makes alexandria crash when importing a library</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkalexandrialibalexandriabook_providersadlibrisrb">trunk/alexandria/lib/alexandria/book_providers/adlibris.rb</a></li>
<li><a href="#trunkalexandrialibalexandriabook_providersamazonrb">trunk/alexandria/lib/alexandria/book_providers/amazon.rb</a></li>
<li><a href="#trunkalexandrialibalexandriabook_providersmcurb">trunk/alexandria/lib/alexandria/book_providers/mcu.rb</a></li>
<li><a href="#trunkalexandrialibalexandriabook_providersproxisrb">trunk/alexandria/lib/alexandria/book_providers/proxis.rb</a></li>
<li><a href="#trunkalexandrialibalexandriabook_providerswebster_itrb">trunk/alexandria/lib/alexandria/book_providers/webster_it.rb</a></li>
<li><a href="#trunkalexandrialibalexandriauiimport_dialogrb">trunk/alexandria/lib/alexandria/ui/import_dialog.rb</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkalexandrialibalexandriabook_providersadlibrisrb"></a>
<div class="modfile"><h4>Modified: trunk/alexandria/lib/alexandria/book_providers/adlibris.rb (605 => 606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/alexandria/lib/alexandria/book_providers/adlibris.rb        2007-02-16 18:54:50 UTC (rev 605)
+++ trunk/alexandria/lib/alexandria/book_providers/adlibris.rb        2007-02-18 14:09:21 UTC (rev 606)
</span><span class="lines">@@ -69,7 +69,7 @@
</span><span class="cx">                                                 results &lt;&lt; [Book.new(md[1].to_s(), # Title
</span><span class="cx">                                                         [md[3].to_s()], # Authors
</span><span class="cx">                                                         isbn,
</span><del>-                                                        &quot;&quot;, # Publisher
</del><ins>+                                                        nil, # Publisher
</ins><span class="cx">                                                         translate_stuff_stuff(md[4].to_s())), # Edition
</span><span class="cx">                                                         imageAddr]
</span><span class="cx">                                         end
</span><span class="lines">@@ -86,7 +86,8 @@
</span><span class="cx"> 
</span><span class="cx">         def url(book)
</span><span class="cx">                         #puts &quot;debug: url(book)&quot;
</span><del>-            BASE_URI + &quot;shop/product.asp?isbn=&quot; + (book.isbn or &quot;&quot;)
</del><ins>+            return nil unless book.isbn
+            BASE_URI + &quot;product.aspx?isbn=&quot; + book.isbn
</ins><span class="cx">         end
</span><span class="cx"> 
</span><span class="cx">         #######
</span></span></pre></div>
<a id="trunkalexandrialibalexandriabook_providersamazonrb"></a>
<div class="modfile"><h4>Modified: trunk/alexandria/lib/alexandria/book_providers/amazon.rb (605 => 606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/alexandria/lib/alexandria/book_providers/amazon.rb        2007-02-16 18:54:50 UTC (rev 605)
+++ trunk/alexandria/lib/alexandria/book_providers/amazon.rb        2007-02-18 14:09:21 UTC (rev 606)
</span><span class="lines">@@ -112,15 +112,18 @@
</span><span class="cx">                 #    title = title.convert('iso-8859-1','utf-8') 
</span><span class="cx">                 #end
</span><span class="cx"> 
</span><ins>+                media = product.media.squeeze(' ')
+                media = nil if media == 'Unknown Binding'
+
</ins><span class="cx">                 book = Book.new(title,
</span><span class="cx">                                 (product.authors.map { |x| x.squeeze(' ') } \
</span><del>-                                    rescue [ _(&quot;n/a&quot;) ]),
</del><ins>+                                    rescue [  ]),
</ins><span class="cx">                                 product.isbn.squeeze(' '),
</span><span class="cx">                                 (product.manufacturer.squeeze(' ') \
</span><del>-                                    rescue _(&quot;n/a&quot;)),
</del><ins>+                                    rescue nil),
</ins><span class="cx">                                 (Time.parse(product.release_date).year \
</span><span class="cx">                                     rescue nil),
</span><del>-                                product.media.squeeze(' '))
</del><ins>+                                media)
</ins><span class="cx"> 
</span><span class="cx">                 results &lt;&lt; [ book, product.image_url_medium ]
</span><span class="cx">             end
</span></span></pre></div>
<a id="trunkalexandrialibalexandriabook_providersmcurb"></a>
<div class="modfile"><h4>Modified: trunk/alexandria/lib/alexandria/book_providers/mcu.rb (605 => 606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/alexandria/lib/alexandria/book_providers/mcu.rb        2007-02-16 18:54:50 UTC (rev 605)
+++ trunk/alexandria/lib/alexandria/book_providers/mcu.rb        2007-02-18 14:09:21 UTC (rev 606)
</span><span class="lines">@@ -128,10 +128,10 @@
</span><span class="cx">             end
</span><span class="cx"> 
</span><span class="cx">             # TODO: This provider does not include picture for books
</span><del>-            %w{name isbn media manufacturer}.each do |field|
-                print &quot;Checking #{field} for nil\n&quot; if $DEBUG # for DEBUGing
-                product[field]=&quot;&quot; if product[field].nil?
-            end 
</del><ins>+#            %w{name isbn media manufacturer}.each do |field|
+#                print &quot;Checking #{field} for nil\n&quot; if $DEBUG # for DEBUGing
+#                product[field]=&quot;&quot; if product[field].nil?
+#            end 
</ins><span class="cx">             
</span><span class="cx">             print &quot;Creating new book\n&quot; if $DEBUG # for DEBUGing
</span><span class="cx">             book = Book.new(product['name'],
</span></span></pre></div>
<a id="trunkalexandrialibalexandriabook_providersproxisrb"></a>
<div class="modfile"><h4>Modified: trunk/alexandria/lib/alexandria/book_providers/proxis.rb (605 => 606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/alexandria/lib/alexandria/book_providers/proxis.rb        2007-02-16 18:54:50 UTC (rev 605)
+++ trunk/alexandria/lib/alexandria/book_providers/proxis.rb        2007-02-18 14:09:21 UTC (rev 606)
</span><span class="lines">@@ -76,7 +76,7 @@
</span><span class="cx">         end
</span><span class="cx">         
</span><span class="cx">         def parseBook(product_id)
</span><del>-            conv = proc { |str| str.convert(&quot;utf-8&quot;, &quot;windows-1252&quot;) }
</del><ins>+            conv = proc { |str| str.convert(&quot;utf-8&quot;, &quot;windows-1252&quot;) if str != nil }
</ins><span class="cx">             detailspage='http://oas2000.proxis.be/gate/jabba.coreii.g_p?bi=4&amp;sp=DETAILS&amp;mi='+product_id
</span><span class="cx">             product = {}
</span><span class="cx">             product['authors'] = []
</span><span class="lines">@@ -104,12 +104,12 @@
</span><span class="cx">                 end
</span><span class="cx">             end
</span><span class="cx"> 
</span><del>-            %w{name isbn media manufacturer}.each do |field|
-                product[field] = &quot;&quot; if product[field].nil?
-            end 
</del><ins>+#            %w{name isbn media manufacturer}.each do |field|
+#                product[field] = &quot;&quot; if product[field].nil?
+#            end 
</ins><span class="cx">             
</span><span class="cx">             book = Book.new(conv.call(product['name']),
</span><del>-                            (product['authors'].map { |x| conv.call(x) } rescue [ &quot;n/a&quot; ]),
</del><ins>+                            (product['authors'].map { |x| conv.call(x) } rescue [  ]),
</ins><span class="cx">                             conv.call(product['isbn']),
</span><span class="cx">                             conv.call(product['manufacturer']),
</span><span class="cx">                             product['year'],
</span></span></pre></div>
<a id="trunkalexandrialibalexandriabook_providerswebster_itrb"></a>
<div class="modfile"><h4>Modified: trunk/alexandria/lib/alexandria/book_providers/webster_it.rb (605 => 606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/alexandria/lib/alexandria/book_providers/webster_it.rb        2007-02-16 18:54:50 UTC (rev 605)
+++ trunk/alexandria/lib/alexandria/book_providers/webster_it.rb        2007-02-18 14:09:21 UTC (rev 606)
</span><span class="lines">@@ -109,7 +109,7 @@
</span><span class="cx">                 publisher = CGI.unescape(md[2].strip)
</span><span class="cx"> 
</span><span class="cx">            if md = /&lt;li&gt;&lt;span class=&quot;product_label&quot;&gt;Pagine:&lt;\/span&gt; &lt;span class=&quot;product_text&quot;&gt;([^&lt;]+)/.match(data)
</span><del>-             edition = CGI.unescape(md[1].strip) + &quot;p. &quot;
</del><ins>+             edition = CGI.unescape(md[1].strip) + &quot; p.&quot;
</ins><span class="cx">            else
</span><span class="cx">              edition = nil
</span><span class="cx">            end
</span><span class="lines">@@ -123,8 +123,8 @@
</span><span class="cx">   if data =~ /javascript:popImage/ and  md = /&lt;img border=&quot;0&quot; alt=&quot;([^&quot;]+)&quot; src=&quot;([^&quot;]+)/.match(data)
</span><span class="cx">             cover_url = BASE_URI + md[2].strip
</span><span class="cx">             # use &quot;p&quot; instead of &quot;g&quot; for smaller image
</span><del>-            if cover_url[-5] == 104  
-                cover_url[-5] = 112 
</del><ins>+            if cover_url[-5] == 103
+                cover_url[-5] = 112
</ins><span class="cx">             end
</span><span class="cx"> 
</span><span class="cx">             cover_filename = isbn + &quot;.tmp&quot;
</span></span></pre></div>
<a id="trunkalexandrialibalexandriauiimport_dialogrb"></a>
<div class="modfile"><h4>Modified: trunk/alexandria/lib/alexandria/ui/import_dialog.rb (605 => 606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/alexandria/lib/alexandria/ui/import_dialog.rb        2007-02-16 18:54:50 UTC (rev 605)
+++ trunk/alexandria/lib/alexandria/ui/import_dialog.rb        2007-02-18 14:09:21 UTC (rev 606)
</span><span class="lines">@@ -59,7 +59,7 @@
</span><span class="cx">             self.title = _(&quot;Import a Library&quot;) 
</span><span class="cx">             self.action = Gtk::FileChooser::ACTION_OPEN
</span><span class="cx">             self.transient_for = parent
</span><del>-            self.deletable = false
</del><ins>+#            self.deletable = false
</ins><span class="cx">             running = false
</span><span class="cx">             add_button(Gtk::Stock::HELP, Gtk::Dialog::RESPONSE_HELP) 
</span><span class="cx">             add_button(Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL)
</span></span></pre>
</div>
</div>

</body>
</html>