alexandria-book-collection-manager 0.7.4 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +31 -6
- data/.rubocop_todo.yml +33 -33
- data/.travis.yml +39 -0
- data/CHANGELOG.md +8 -0
- data/README.md +1 -1
- data/Rakefile +4 -2
- data/alexandria-book-collection-manager.gemspec +2 -1
- data/bin/alexandria +0 -10
- data/doc/FAQ +1 -2
- data/doc/dependency_decisions.yml +5 -5
- data/lib/alexandria.rb +3 -1
- data/lib/alexandria/book_providers.rb +1 -4
- data/lib/alexandria/book_providers/adlibris.rb +4 -20
- data/lib/alexandria/book_providers/amazon_aws.rb +15 -8
- data/lib/alexandria/book_providers/amazon_ecs_util.rb +16 -10
- data/lib/alexandria/book_providers/barnes_and_noble.rb +1 -1
- data/lib/alexandria/book_providers/douban.rb +2 -2
- data/lib/alexandria/book_providers/proxis.rb +6 -2
- data/lib/alexandria/book_providers/pseudomarc.rb +3 -1
- data/lib/alexandria/book_providers/siciliano.rb +24 -27
- data/lib/alexandria/book_providers/thalia.rb +1 -1
- data/lib/alexandria/book_providers/worldcat.rb +5 -3
- data/lib/alexandria/book_providers/z3950.rb +20 -14
- data/lib/alexandria/export_library.rb +15 -12
- data/lib/alexandria/import_library.rb +65 -65
- data/lib/alexandria/library_collection.rb +2 -1
- data/lib/alexandria/library_store.rb +18 -7
- data/lib/alexandria/models/book.rb +2 -1
- data/lib/alexandria/models/library.rb +9 -3
- data/lib/alexandria/preferences.rb +13 -6
- data/lib/alexandria/scanners/keyboard.rb +2 -2
- data/lib/alexandria/smart_library.rb +41 -39
- data/lib/alexandria/ui/acquire_dialog.rb +47 -48
- data/lib/alexandria/ui/alert_dialog.rb +2 -1
- data/lib/alexandria/ui/barcode_animation.rb +6 -5
- data/lib/alexandria/ui/book_properties_dialog_base.rb +7 -3
- data/lib/alexandria/ui/callbacks.rb +14 -7
- data/lib/alexandria/ui/dndable.rb +1 -1
- data/lib/alexandria/ui/export_dialog.rb +0 -2
- data/lib/alexandria/ui/icons.rb +2 -1
- data/lib/alexandria/ui/iconview.rb +5 -3
- data/lib/alexandria/ui/import_dialog.rb +6 -8
- data/lib/alexandria/ui/keep_bad_isbn_dialog.rb +4 -3
- data/lib/alexandria/ui/listview.rb +34 -31
- data/lib/alexandria/ui/multi_drag_treeview.rb +3 -2
- data/lib/alexandria/ui/new_book_dialog.rb +28 -30
- data/lib/alexandria/ui/new_book_dialog_manual.rb +3 -1
- data/lib/alexandria/ui/provider_preferences_base_dialog.rb +2 -1
- data/lib/alexandria/ui/sidepane_manager.rb +6 -3
- data/lib/alexandria/ui/smart_library_properties_dialog_base.rb +5 -3
- data/lib/alexandria/ui/ui_manager.rb +22 -12
- data/lib/alexandria/version.rb +2 -2
- data/po/Makefile +2 -2
- data/share/alexandria/glade/acquire_dialog__builder.glade +1 -1
- data/share/alexandria/glade/book_properties_dialog__builder.glade +1 -1
- data/share/alexandria/glade/new_book_dialog__builder.glade +1 -1
- data/share/alexandria/glade/preferences_dialog__builder.glade +1 -1
- data/share/gnome/help/alexandria/C/introduction.xml +0 -4
- data/share/gnome/help/alexandria/C/searching.xml +1 -1
- data/share/gnome/help/alexandria/ja/introduction.xml +0 -4
- data/spec/alexandria/book_providers_spec.rb +12 -16
- data/spec/alexandria/console_spec.rb +1 -1
- data/spec/alexandria/ui/main_app_spec.rb +4 -31
- data/spec/alexandria/ui/really_delete_dialog_spec.rb +2 -1
- data/tasks/spec.rake +6 -4
- data/util/rake/fileinstall.rb +3 -1
- metadata +19 -7
- data/dogtail/basic_run_test.py +0 -9
- data/lib/alexandria/book_providers/renaud.rb +0 -142
- data/tasks/dogtail.rake +0 -6
@@ -103,29 +103,11 @@ module Alexandria
|
|
103
103
|
book_search_results
|
104
104
|
end
|
105
105
|
|
106
|
-
# def binding_type(binding) # swedish string
|
107
|
-
# # hrm, this is a HACK and not currently working
|
108
|
-
# # perhaps use regexes instead...
|
109
|
-
# {"inbunden" => :hardback,
|
110
|
-
# "pocket" => :paperback,
|
111
|
-
# "storpocket" => :paperback,
|
112
|
-
# "kartonnage" => :hardback,
|
113
|
-
# "kassettbok" => :audiobook}[binding.downcase] or :paperback
|
114
|
-
# # Häftad == Paperback
|
115
|
-
# end
|
116
|
-
|
117
106
|
def normalize(text)
|
118
|
-
# unless text.nil?
|
119
|
-
# text = @ent.decode(text).strip
|
120
|
-
# end
|
121
107
|
text
|
122
108
|
end
|
123
109
|
|
124
110
|
def parse_result_data(html)
|
125
|
-
# adlibris site presents data in ISO-8859-1, so change it to UTF-8
|
126
|
-
# html = Iconv.conv("UTF-8", "ISO-8859-1", html)
|
127
|
-
## File.open(',log.html', 'wb') {|f| f.write('<?xml encoding="utf-8"?>'); f.write(html) } # DEBUG
|
128
|
-
# doc = Hpricot(html)
|
129
111
|
doc = html_to_doc(html)
|
130
112
|
begin
|
131
113
|
title = nil
|
@@ -179,7 +161,9 @@ module Alexandria
|
|
179
161
|
|
180
162
|
# cover
|
181
163
|
image_url = nil
|
182
|
-
|
164
|
+
cover_img =
|
165
|
+
doc.search('span.imageWithShadow img[@id$="ProductImageNotLinked"]').first
|
166
|
+
if cover_img
|
183
167
|
image_url = if %r{^http\://}.match?(cover_img["src"])
|
184
168
|
cover_img["src"]
|
185
169
|
else
|
@@ -195,7 +179,7 @@ module Alexandria
|
|
195
179
|
|
196
180
|
book = Book.new(title, authors, isbn, publisher, year, binding)
|
197
181
|
|
198
|
-
|
182
|
+
[book, image_url]
|
199
183
|
rescue StandardError => ex
|
200
184
|
raise ex if ex.instance_of? NoResultsError
|
201
185
|
|
@@ -50,7 +50,9 @@ module Alexandria
|
|
50
50
|
if token
|
51
51
|
token.new_value = token.value.strip if token.value != token.value.strip
|
52
52
|
end
|
53
|
-
|
53
|
+
if token && ((token.value.size != 20) || (token.value == "0J356Z09CN88KB743582"))
|
54
|
+
token.new_value = ""
|
55
|
+
end
|
54
56
|
|
55
57
|
secret = prefs.variable_named("secret_key")
|
56
58
|
if secret
|
@@ -60,7 +62,9 @@ module Alexandria
|
|
60
62
|
associate = prefs.variable_named("associate_tag")
|
61
63
|
if associate
|
62
64
|
associate.new_value = "rubyalexa-20" if associate.value.strip.empty?
|
63
|
-
|
65
|
+
if associate.value != associate.value.strip
|
66
|
+
associate.new_value = associate.value.strip
|
67
|
+
end
|
64
68
|
end
|
65
69
|
end
|
66
70
|
|
@@ -99,8 +103,9 @@ module Alexandria
|
|
99
103
|
when SEARCH_BY_ISBN
|
100
104
|
criterion = Library.canonicalise_isbn(criterion)
|
101
105
|
# This isn't ideal : I'd like to do an ISBN/EAN-specific search
|
102
|
-
res = Amazon::Ecs.item_search(criterion,
|
103
|
-
|
106
|
+
res = Amazon::Ecs.item_search(criterion,
|
107
|
+
response_group: "ItemAttributes,Images",
|
108
|
+
country: request_locale)
|
104
109
|
res.items.each do |item|
|
105
110
|
products << item
|
106
111
|
end
|
@@ -194,7 +199,7 @@ module Alexandria
|
|
194
199
|
end
|
195
200
|
if type == SEARCH_BY_ISBN
|
196
201
|
if results.size == 1
|
197
|
-
|
202
|
+
results.first
|
198
203
|
else
|
199
204
|
log.info { "Found multiple results for lookup: checking each" }
|
200
205
|
query_isbn_canon = Library.canonicalise_ean(criterion)
|
@@ -206,11 +211,13 @@ module Alexandria
|
|
206
211
|
log.debug { "rejected possible result #{book}" }
|
207
212
|
end
|
208
213
|
# gone through all and no ISBN match, so just return first result
|
209
|
-
log.info
|
210
|
-
|
214
|
+
log.info do
|
215
|
+
"no more results to check. Returning first result, just an approximation"
|
216
|
+
end
|
217
|
+
results.first
|
211
218
|
end
|
212
219
|
else
|
213
|
-
|
220
|
+
results
|
214
221
|
end
|
215
222
|
end
|
216
223
|
|
@@ -16,12 +16,14 @@ module Amazon
|
|
16
16
|
class Ecs
|
17
17
|
include Alexandria::Logging
|
18
18
|
|
19
|
-
SERVICE_URLS = {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
SERVICE_URLS = {
|
20
|
+
us: "http://webservices.amazon.com/onca/xml?Service=AWSECommerceService",
|
21
|
+
uk: "http://webservices.amazon.co.uk/onca/xml?Service=AWSECommerceService",
|
22
|
+
ca: "http://webservices.amazon.ca/onca/xml?Service=AWSECommerceService",
|
23
|
+
de: "http://webservices.amazon.de/onca/xml?Service=AWSECommerceService",
|
24
|
+
jp: "http://webservices.amazon.co.jp/onca/xml?Service=AWSECommerceService",
|
25
|
+
fr: "http://webservices.amazon.fr/onca/xml?Service=AWSECommerceService"
|
26
|
+
}.freeze
|
25
27
|
|
26
28
|
@@options = {}
|
27
29
|
@@debug = false
|
@@ -59,7 +61,8 @@ module Amazon
|
|
59
61
|
end
|
60
62
|
|
61
63
|
# Search amazon items with search terms. Default search index option is 'Books'.
|
62
|
-
# For other search type other than keywords, please specify
|
64
|
+
# For other search type other than keywords, please specify
|
65
|
+
# :type => [search type param name].
|
63
66
|
def self.item_search(terms, opts = {})
|
64
67
|
opts[:operation] = "ItemSearch"
|
65
68
|
opts[:search_index] = opts[:search_index] || "Books"
|
@@ -88,7 +91,8 @@ module Amazon
|
|
88
91
|
config ? Net::HTTP.Proxy(*config) : Net::HTTP
|
89
92
|
end
|
90
93
|
|
91
|
-
# Generic send request to ECS REST service. You have to specify the
|
94
|
+
# Generic send request to ECS REST service. You have to specify the
|
95
|
+
# :operation parameter.
|
92
96
|
def self.send_request(opts)
|
93
97
|
opts = options.merge(opts) if options
|
94
98
|
request_url = prepare_url(opts)
|
@@ -296,7 +300,8 @@ module Amazon
|
|
296
300
|
end
|
297
301
|
|
298
302
|
# Find Hpricot::Elements matching the given path, and convert to Amazon::Element.
|
299
|
-
# Returns an array Amazon::Elements if more than Hpricot::Elements size is
|
303
|
+
# Returns an array Amazon::Elements if more than Hpricot::Elements size is
|
304
|
+
# greater than 1.
|
300
305
|
def search_and_convert(path)
|
301
306
|
elements = self./(path)
|
302
307
|
return unless elements
|
@@ -322,7 +327,8 @@ module Amazon
|
|
322
327
|
Element.get_array(@element, path)
|
323
328
|
end
|
324
329
|
|
325
|
-
# Get the children element text values in hash format with the element
|
330
|
+
# Get the children element text values in hash format with the element
|
331
|
+
# names as the hash keys.
|
326
332
|
def get_hash(path = "")
|
327
333
|
Element.get_hash(@element, path)
|
328
334
|
end
|
@@ -192,7 +192,7 @@ module Alexandria
|
|
192
192
|
book_data[:isbn], book_data[:publisher],
|
193
193
|
book_data[:publication_year],
|
194
194
|
book_data[:binding])
|
195
|
-
|
195
|
+
[book, book_data[:image_url]]
|
196
196
|
rescue StandardError => ex
|
197
197
|
raise ex if ex.instance_of? NoResultsError
|
198
198
|
|
@@ -65,7 +65,9 @@ module Alexandria
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def url(book)
|
68
|
-
|
68
|
+
if book.isbn.nil? || book.isbn.empty?
|
69
|
+
ISBN_REDIRECT_BASE_URL % Library.canonicalise_ean(book.isbn)
|
70
|
+
end
|
69
71
|
end
|
70
72
|
|
71
73
|
## from Palatina
|
@@ -94,7 +96,9 @@ module Alexandria
|
|
94
96
|
if title_link
|
95
97
|
result[:title] = text_of(title_link)
|
96
98
|
result[:lookup_url] = title_link["href"]
|
97
|
-
|
99
|
+
unless /^http/.match?(result[:lookup_url])
|
100
|
+
result[:lookup_url] = "#{SITE}#{result[:lookup_url]}"
|
101
|
+
end
|
98
102
|
end
|
99
103
|
book_search_results << result
|
100
104
|
end
|
@@ -88,7 +88,9 @@ module Alexandria
|
|
88
88
|
|
89
89
|
binding_data = details[m[:binding][0]]
|
90
90
|
if binding_data
|
91
|
-
|
91
|
+
if binding_data.first[m[:binding][1]] =~ /([a-zA-Z][a-z\s]+[a-z])/
|
92
|
+
binding = Regexp.last_match[1]
|
93
|
+
end
|
92
94
|
end
|
93
95
|
|
94
96
|
publisher = nil
|
@@ -125,33 +125,31 @@ module Alexandria
|
|
125
125
|
|
126
126
|
list_items = doc.search("div.pesquisa-item-lista-conteudo")
|
127
127
|
list_items.each do |item|
|
128
|
-
|
129
|
-
result = {}
|
128
|
+
result = {}
|
130
129
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
130
|
+
# author & publisher
|
131
|
+
author_publisher = ""
|
132
|
+
item.children.each do |node|
|
133
|
+
author_publisher += node.to_s if node.text?
|
134
|
+
author_publisher.strip!
|
135
|
+
break unless author_publisher.empty?
|
136
|
+
end
|
137
|
+
author, publisher = author_publisher.split("/")
|
138
|
+
result[:author] = author.strip if author
|
139
|
+
result[:publisher] = publisher.strip if publisher
|
141
140
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
141
|
+
# title & url
|
142
|
+
link = item % "a"
|
143
|
+
result[:title] = link.inner_text.strip
|
144
|
+
link_to_description = link["href"]
|
145
|
+
slash = ""
|
146
|
+
slash = "/" unless %r{^/}.match?(link_to_description)
|
147
|
+
result[:url] = "#{SITE}#{slash}#{link_to_description}"
|
149
148
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
end
|
149
|
+
book_search_results << result
|
150
|
+
rescue StandardError => ex
|
151
|
+
trace = ex.backtrace.join("\n> ")
|
152
|
+
log.error { "Failed parsing Siciliano search page #{ex.message}\n#{trace}" }
|
155
153
|
end
|
156
154
|
|
157
155
|
book_search_results
|
@@ -186,9 +184,8 @@ module Alexandria
|
|
186
184
|
# publish year
|
187
185
|
publish_year = nil
|
188
186
|
edition = details["Edio"]
|
189
|
-
|
190
|
-
|
191
|
-
end
|
187
|
+
# publication date
|
188
|
+
publish_year = Regexp.last_match[1].to_i if edition && edition =~ /([12][0-9]{3})/
|
192
189
|
# cover
|
193
190
|
# ImgSrc[1]="/imagem/imagem.dll?pro_id=1386929&PIM_Id=658849";
|
194
191
|
image_urls = []
|
@@ -148,7 +148,9 @@ module Alexandria
|
|
148
148
|
end
|
149
149
|
|
150
150
|
# gone through all and no ISBN match, so just return first result
|
151
|
-
log.info
|
151
|
+
log.info do
|
152
|
+
"no more results to check. Returning first result, just an approximation"
|
153
|
+
end
|
152
154
|
return first_result
|
153
155
|
|
154
156
|
end
|
@@ -195,7 +197,7 @@ module Alexandria
|
|
195
197
|
|
196
198
|
isbn = search_isbn
|
197
199
|
unless isbn
|
198
|
-
isbn_row = doc % "tr#details-standardno"
|
200
|
+
isbn_row = doc % "tr#details-standardno"
|
199
201
|
if isbn_row
|
200
202
|
isbns = (isbn_row / "td").last.inner_text.split
|
201
203
|
isbn = Library.canonicalise_isbn(isbns.first)
|
@@ -210,7 +212,7 @@ module Alexandria
|
|
210
212
|
|
211
213
|
image_url = nil # hm, it's on the website, but uses JavaScript...
|
212
214
|
|
213
|
-
|
215
|
+
[book, image_url]
|
214
216
|
rescue StandardError => ex
|
215
217
|
raise ex if ex.instance_of? NoResultsError
|
216
218
|
|
@@ -22,7 +22,8 @@ module Alexandria
|
|
22
22
|
prefs.add("hostname", _("Hostname"), "")
|
23
23
|
prefs.add("port", _("Port"), 7090)
|
24
24
|
prefs.add("database", _("Database"), "")
|
25
|
-
prefs.add("record_syntax", _("Record syntax"), "USMARC",
|
25
|
+
prefs.add("record_syntax", _("Record syntax"), "USMARC",
|
26
|
+
["USMARC", "UNIMARC", "SUTRS"])
|
26
27
|
prefs.add("username", _("Username"), "", nil, false)
|
27
28
|
prefs.add("password", _("Password"), "", nil, false)
|
28
29
|
prefs.add("charset", _("Charset encoding"), "ISO-8859-1")
|
@@ -100,7 +101,7 @@ module Alexandria
|
|
100
101
|
def books_from_marc(resultset, _isbn)
|
101
102
|
results = []
|
102
103
|
resultset[0..9].each do |record|
|
103
|
-
marc_txt = record.render(prefs["charset"], "UTF-8")
|
104
|
+
marc_txt = record.render(prefs["charset"], "UTF-8")
|
104
105
|
log.debug { marc_txt }
|
105
106
|
if $DEBUG
|
106
107
|
File.open(",marc.txt", "wb") do |f| # DEBUG
|
@@ -110,7 +111,9 @@ module Alexandria
|
|
110
111
|
book = nil
|
111
112
|
begin
|
112
113
|
mappings = Alexandria::PseudoMarcParser::USMARC_MAPPINGS
|
113
|
-
|
114
|
+
if prefs["hostname"] == "z3950.bnf.fr"
|
115
|
+
mappings = Alexandria::PseudoMarcParser::BNF_FR_MAPPINGS
|
116
|
+
end
|
114
117
|
# try pseudo-marc parser first (it seems to have more luck)
|
115
118
|
book = Alexandria::PseudoMarcParser.marc_text_to_book(marc_txt,
|
116
119
|
mappings)
|
@@ -205,8 +208,9 @@ module Alexandria
|
|
205
208
|
end
|
206
209
|
|
207
210
|
def url(book)
|
208
|
-
|
209
|
-
|
211
|
+
isbn = Library.canonicalise_isbn(book.isbn)
|
212
|
+
"http://catalog.loc.gov/cgi-bin/Pwebrecon.cgi?" \
|
213
|
+
"DB=local&CNT=25+records+per+page&CMD=isbn+#{isbn}"
|
210
214
|
rescue StandardError => ex
|
211
215
|
log.warn { "Cannot create url for book #{book}; #{ex.message}" }
|
212
216
|
nil
|
@@ -344,7 +348,8 @@ module Alexandria
|
|
344
348
|
"Codice%2520ISBN%253C%2FB%253E%253C%2Ffont%253E%2520" \
|
345
349
|
"contiene%2520%2522%2520%253CFONT%2520COLOR%253Dred%253E" +
|
346
350
|
canonicalise_isbn_with_dashes(book.isbn) +
|
347
|
-
"%253C%2FFONT%253E%2522&session=&zurl=opac
|
351
|
+
"%253C%2FFONT%253E%2522&session=&zurl=opac" \
|
352
|
+
"&zquery=%281%3D7+4%3D2+2%3D3+5%3D100+6%3D1+3%3D3+%22" +
|
348
353
|
canonicalise_isbn_with_dashes(book.isbn) +
|
349
354
|
"%22%29&language=it&maxentries=10&target=0&position=1"
|
350
355
|
rescue StandardError => ex
|
@@ -363,23 +368,23 @@ module Alexandria
|
|
363
368
|
if isbn[0..1] == "88"
|
364
369
|
# Italian speaking area
|
365
370
|
if isbn > "8895000" && (isbn <= "8899999996")
|
366
|
-
|
371
|
+
isbn[0..1] + "-" + isbn[2..6] + "-" + isbn[7..8] + "-" + isbn[9..9]
|
367
372
|
elsif isbn > "88900000"
|
368
|
-
|
373
|
+
isbn[0..1] + "-" + isbn[2..7] + "-" + isbn[8..8] + "-" + isbn[9..9]
|
369
374
|
elsif isbn > "8885000"
|
370
|
-
|
375
|
+
isbn[0..1] + "-" + isbn[2..6] + "-" + isbn[7..8] + "-" + isbn[9..9]
|
371
376
|
elsif isbn > "886000"
|
372
|
-
|
377
|
+
isbn[0..1] + "-" + isbn[2..5] + "-" + isbn[6..8] + "-" + isbn[9..9]
|
373
378
|
elsif isbn > "88200"
|
374
|
-
|
379
|
+
isbn[0..1] + "-" + isbn[2..4] + "-" + isbn[5..8] + "-" + isbn[9..9]
|
375
380
|
elsif isbn > "8800"
|
376
|
-
|
381
|
+
isbn[0..1] + "-" + isbn[2..3] + "-" + isbn[4..8] + "-" + isbn[9..9]
|
377
382
|
else
|
378
383
|
raise "Invalid ISBN"
|
379
384
|
end
|
380
385
|
|
381
386
|
else
|
382
|
-
|
387
|
+
isbn
|
383
388
|
end
|
384
389
|
end
|
385
390
|
#
|
@@ -393,7 +398,8 @@ module Alexandria
|
|
393
398
|
#
|
394
399
|
# Dashes:
|
395
400
|
# this database requires that Italian books are searched with dashes :(
|
396
|
-
# However, they have also books with dashes in wrong positions, for
|
401
|
+
# However, they have also books with dashes in wrong positions, for
|
402
|
+
# instance 88-061-4934-2
|
397
403
|
#
|
398
404
|
# References:
|
399
405
|
# http://opac.internetculturale.it/cgi-bin/main.cgi?type=field
|
@@ -50,13 +50,11 @@ module Alexandria
|
|
50
50
|
|
51
51
|
def export_as_tellico_xml_archive(filename)
|
52
52
|
File.open(File.join(Dir.tmpdir, "tellico.xml"), "w") do |io|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
raise ex
|
59
|
-
end
|
53
|
+
to_tellico_document.write(io, 0)
|
54
|
+
rescue StandardError => ex
|
55
|
+
puts ex.message
|
56
|
+
puts ex.backtrace
|
57
|
+
raise ex
|
60
58
|
end
|
61
59
|
copy_covers(File.join(Dir.tmpdir, "images"))
|
62
60
|
Dir.chdir(Dir.tmpdir) do
|
@@ -117,7 +115,8 @@ module Alexandria
|
|
117
115
|
io.puts book.authors.join(", ")
|
118
116
|
io.puts book.edition
|
119
117
|
io.puts((book.isbn || ""))
|
120
|
-
# we need to close the files so the iPod can be ejected/unmounted
|
118
|
+
# we need to close the files so the iPod can be ejected/unmounted
|
119
|
+
# without us closing Alexandria
|
121
120
|
io.close
|
122
121
|
end
|
123
122
|
end
|
@@ -131,8 +130,8 @@ module Alexandria
|
|
131
130
|
"Rating(#{Book::DEFAULT_RATING} to #{Book::MAX_RATING_STARS})", "Notes",
|
132
131
|
"Want?", "Read?", "Own?", "Tags"]
|
133
132
|
each do |book|
|
134
|
-
csv << [book.title, book.authors.join(", "), book.publisher, book.edition,
|
135
|
-
book.publishing_year, book.rating, book.notes,
|
133
|
+
csv << [book.title, book.authors.join(", "), book.publisher, book.edition,
|
134
|
+
book.isbn, book.publishing_year, book.rating, book.notes,
|
136
135
|
(book.want ? "1" : "0"), (book.redd ? "1" : "0"), (book.own ? "1" : "0"),
|
137
136
|
(book.tags ? book.tags.join(", ") : "")]
|
138
137
|
end
|
@@ -245,7 +244,9 @@ module Alexandria
|
|
245
244
|
end
|
246
245
|
entry.add_element("read").text = book.redd.to_s if book.redd
|
247
246
|
entry.add_element("loaned").text = book.loaned.to_s if book.loaned
|
248
|
-
|
247
|
+
unless book.rating == Book::DEFAULT_RATING
|
248
|
+
entry.add_element("rating").text = book.rating
|
249
|
+
end
|
249
250
|
entry.add_element("comments").text = book.notes if book.notes && !book.notes.empty?
|
250
251
|
if File.exist?(cover(book))
|
251
252
|
entry.add_element("cover").text = final_cover(book)
|
@@ -381,7 +382,9 @@ module Alexandria
|
|
381
382
|
bibtex << "\",\n"
|
382
383
|
bibtex << "title = \"#{latex_escape(book.title)}\",\n"
|
383
384
|
bibtex << "publisher = \"#{latex_escape(book.publisher)}\",\n"
|
384
|
-
|
385
|
+
if book.notes && !book.notes.empty?
|
386
|
+
bibtex << "OPTnote = \"#{latex_escape(book.notes)}\",\n"
|
387
|
+
end
|
385
388
|
# year is a required field in bibtex @BOOK
|
386
389
|
bibtex << "year = " + (book.publishing_year || '"n/a"').to_s + "\n"
|
387
390
|
bibtex << "}\n\n"
|