alexandria-book-collection-manager 0.7.8 → 0.7.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +48 -53
- data/.rubocop.yml +18 -5
- data/.rubocop_todo.yml +31 -37
- data/.simplecov +2 -2
- data/CHANGELOG.md +37 -0
- data/ChangeLog.0 +19 -19
- data/INSTALL.md +3 -5
- data/README.md +0 -5
- data/Rakefile +14 -14
- data/alexandria-book-collection-manager.gemspec +35 -34
- data/doc/FAQ +2 -2
- data/lib/alexandria/about.rb +1 -1
- data/lib/alexandria/book_providers/bl_provider.rb +88 -0
- data/lib/alexandria/book_providers/loc_provider.rb +38 -0
- data/lib/alexandria/book_providers/sbn_provider.rb +108 -0
- data/lib/alexandria/book_providers/thalia_provider.rb +1 -1
- data/lib/alexandria/book_providers/web.rb +2 -2
- data/lib/alexandria/book_providers/worldcat.rb +9 -7
- data/lib/alexandria/book_providers/z3950_provider.rb +199 -0
- data/lib/alexandria/book_providers.rb +10 -25
- data/lib/alexandria/console.rb +2 -2
- data/lib/alexandria/default_preferences.rb +1 -1
- data/lib/alexandria/export_library.rb +14 -14
- data/lib/alexandria/image_fetcher.rb +25 -0
- data/lib/alexandria/import_library.rb +10 -10
- data/lib/alexandria/library_store.rb +4 -5
- data/lib/alexandria/models/book.rb +13 -0
- data/lib/alexandria/models/library.rb +15 -23
- data/lib/alexandria/preferences.rb +4 -6
- data/lib/alexandria/{book_providers/pseudomarc.rb → pseudo_marc_parser.rb} +2 -2
- data/lib/alexandria/scanners/cue_cat.rb +1 -1
- data/lib/alexandria/smart_library.rb +2 -2
- data/lib/alexandria/ui/about_dialog.rb +1 -1
- data/lib/alexandria/ui/acquire_dialog.rb +6 -9
- data/lib/alexandria/ui/alert_dialog.rb +2 -2
- data/lib/alexandria/ui/barcode_animation.rb +1 -1
- data/lib/alexandria/ui/book_properties_dialog_base.rb +5 -9
- data/lib/alexandria/ui/completion_models.rb +1 -5
- data/lib/alexandria/ui/conflict_while_copying_dialog.rb +1 -1
- data/lib/alexandria/ui/icons.rb +2 -2
- data/lib/alexandria/ui/init.rb +10 -4
- data/lib/alexandria/ui/listview.rb +1 -1
- data/lib/alexandria/ui/multi_drag_treeview.rb +1 -1
- data/lib/alexandria/ui/new_book_dialog.rb +11 -13
- data/lib/alexandria/ui/new_book_dialog_manual.rb +1 -1
- data/lib/alexandria/ui/preferences_dialog.rb +2 -2
- data/lib/alexandria/ui/provider_preferences_base_dialog.rb +1 -1
- data/lib/alexandria/ui/really_delete_dialog.rb +1 -1
- data/lib/alexandria/ui/ui_manager.rb +17 -25
- data/lib/alexandria/version.rb +1 -1
- data/lib/alexandria/web_themes.rb +1 -1
- data/lib/alexandria.rb +6 -5
- data/po/cs.po +90 -125
- data/po/cy.po +87 -125
- data/po/de.po +96 -125
- data/po/el.po +96 -125
- data/po/es.po +96 -125
- data/po/fr.po +90 -125
- data/po/ga.po +83 -124
- data/po/gl.po +90 -125
- data/po/it.po +90 -125
- data/po/ja.po +90 -125
- data/po/mk.po +96 -125
- data/po/nb.po +90 -125
- data/po/nl.po +107 -124
- data/po/pl.po +113 -124
- data/po/pt.po +90 -125
- data/po/pt_BR.po +90 -125
- data/po/ru.po +92 -124
- data/po/sk.po +90 -125
- data/po/sv.po +90 -125
- data/po/uk.po +90 -125
- data/po/zh_TW.po +90 -125
- data/schemas/alexandria.schemas +1 -1
- data/share/gnome/help/alexandria/C/adding-books.xml +3 -4
- data/share/gnome/help/alexandria/C/introduction.xml +0 -16
- data/share/gnome/help/alexandria/C/searching.xml +1 -4
- data/share/gnome/help/alexandria/C/settings.xml +0 -30
- data/share/gnome/help/alexandria/fr/alexandria.xml +4 -159
- data/share/gnome/help/alexandria/ja/adding-books.xml +1 -1
- data/share/gnome/help/alexandria/ja/introduction.xml +0 -15
- data/share/gnome/help/alexandria/ja/searching.xml +3 -7
- data/share/gnome/help/alexandria/ja/settings.xml +0 -27
- data/spec/alexandria/book_providers/bl_provider_spec.rb +13 -0
- data/spec/alexandria/book_providers/loc_provider_spec.rb +17 -0
- data/spec/alexandria/book_providers/sbn_provider_spec.rb +13 -0
- data/spec/alexandria/book_providers/thalia_provider_spec.rb +1 -1
- data/spec/alexandria/book_providers/world_cat_provider_spec.rb +22 -10
- data/spec/alexandria/book_providers_spec.rb +0 -81
- data/spec/alexandria/book_spec.rb +5 -3
- data/spec/alexandria/export_library_spec.rb +8 -8
- data/spec/alexandria/library_spec.rb +83 -51
- data/spec/alexandria/library_store_spec.rb +1 -1
- data/spec/alexandria/preferences_spec.rb +7 -7
- data/spec/alexandria/pseudo_marc_parser_spec.rb +71 -0
- data/spec/alexandria/scanners/cue_cat_spec.rb +11 -4
- data/spec/alexandria/smart_library_spec.rb +7 -5
- data/spec/alexandria/ui/about_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/acquire_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/alert_dialog_spec.rb +5 -3
- data/spec/alexandria/ui/bad_isbns_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/book_properties_dialog_spec.rb +4 -4
- data/spec/alexandria/ui/confirm_erase_dialog_spec.rb +18 -2
- data/spec/alexandria/ui/conflict_while_copying_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/error_dialog_spec.rb +13 -2
- data/spec/alexandria/ui/export_dialog_spec.rb +3 -3
- data/spec/alexandria/ui/iconview_spec.rb +1 -1
- data/spec/alexandria/ui/import_dialog_spec.rb +3 -3
- data/spec/alexandria/ui/keep_bad_isbn_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/new_book_dialog_manual_spec.rb +4 -4
- data/spec/alexandria/ui/new_book_dialog_spec.rb +2 -2
- data/spec/alexandria/ui/new_provider_dialog_spec.rb +3 -3
- data/spec/alexandria/ui/new_smart_library_dialog_spec.rb +9 -7
- data/spec/alexandria/ui/preferences_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/provider_preferences_dialog_spec.rb +2 -2
- data/spec/alexandria/ui/really_delete_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/sidepane_manager_spec.rb +1 -1
- data/spec/alexandria/ui/skip_entry_dialog_spec.rb +18 -2
- data/spec/alexandria/ui/smart_library_properties_dialog_spec.rb +2 -2
- data/spec/alexandria/ui/ui_manager_spec.rb +83 -5
- data/spec/data/libraries/0.6.2/My Library/9780571147168.yaml +2 -0
- data/spec/spec_helper.rb +23 -32
- data/util/rake/fileinstall.rb +12 -12
- data/util/rake/gettextgenerate.rb +1 -1
- data/util/rake/omfgenerate.rb +1 -1
- metadata +73 -58
- data/lib/alexandria/book_providers/adlibris.rb +0 -191
- data/lib/alexandria/book_providers/amazon_aws.rb +0 -239
- data/lib/alexandria/book_providers/amazon_ecs_util.rb +0 -373
- data/lib/alexandria/book_providers/barnes_and_noble.rb +0 -209
- data/lib/alexandria/book_providers/proxis.rb +0 -176
- data/lib/alexandria/book_providers/siciliano.rb +0 -256
- data/lib/alexandria/book_providers/z3950.rb +0 -408
data/lib/alexandria/ui/init.rb
CHANGED
@@ -25,22 +25,28 @@ class Gtk::ActionGroup
|
|
25
25
|
end
|
26
26
|
|
27
27
|
module Alexandria::UI::FreezeThaw
|
28
|
+
def self.included(base)
|
29
|
+
base.class_eval do
|
30
|
+
attr_accessor :old_model
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
28
34
|
def frozen?
|
29
|
-
|
35
|
+
old_model && !model
|
30
36
|
end
|
31
37
|
|
32
38
|
def freeze
|
33
39
|
return if frozen?
|
34
40
|
|
35
|
-
|
41
|
+
self.old_model = model
|
36
42
|
self.model = nil
|
37
43
|
end
|
38
44
|
|
39
45
|
def unfreeze
|
40
46
|
return unless frozen?
|
41
47
|
|
42
|
-
self.model =
|
43
|
-
|
48
|
+
self.model = old_model
|
49
|
+
self.old_model = nil
|
44
50
|
end
|
45
51
|
end
|
46
52
|
|
@@ -201,7 +201,7 @@ module Alexandria
|
|
201
201
|
@prefs.col_rating_visible,
|
202
202
|
@prefs.col_tags_visible
|
203
203
|
]
|
204
|
-
cols = @listview.columns[1
|
204
|
+
cols = @listview.columns[1..] # skip "Title"
|
205
205
|
cols.each_index do |i|
|
206
206
|
cols[i].visible = cols_visibility[i]
|
207
207
|
end
|
@@ -99,7 +99,7 @@ module Alexandria
|
|
99
99
|
return true
|
100
100
|
end
|
101
101
|
|
102
|
-
return false if event.event_type == :
|
102
|
+
return false if event.event_type == :"2button_press"
|
103
103
|
|
104
104
|
path, _, cell_x, cell_y = get_path_at_pos(event.x, event.y)
|
105
105
|
return false if path.nil?
|
@@ -8,6 +8,7 @@ require "gdk_pixbuf2"
|
|
8
8
|
require "alexandria/ui/builder_base"
|
9
9
|
require "alexandria/ui/error_dialog"
|
10
10
|
require "alexandria/ui/keep_bad_isbn_dialog"
|
11
|
+
require "alexandria/image_fetcher"
|
11
12
|
|
12
13
|
module Alexandria
|
13
14
|
class DuplicateBookException < NameError
|
@@ -16,6 +17,7 @@ module Alexandria
|
|
16
17
|
module UI
|
17
18
|
class NewBookDialog < BuilderBase
|
18
19
|
include Logging
|
20
|
+
include ImageFetcher
|
19
21
|
include GetText
|
20
22
|
extend GetText
|
21
23
|
GetText.bindtextdomain(Alexandria::TEXTDOMAIN, charset: "UTF-8")
|
@@ -163,17 +165,11 @@ module Alexandria
|
|
163
165
|
begin
|
164
166
|
@results.each_with_index do |result, i|
|
165
167
|
uri = result[1]
|
166
|
-
if uri
|
167
|
-
if URI.parse(uri).scheme.nil?
|
168
|
-
File.open(uri, "r") do |io|
|
169
|
-
@images[i] = io.read
|
170
|
-
end
|
171
|
-
else
|
172
|
-
@images[i] = URI.parse(uri).read
|
173
|
-
end
|
174
|
-
end
|
168
|
+
@images[i] = fetch_image(uri) if uri
|
175
169
|
end
|
176
170
|
rescue StandardError => ex
|
171
|
+
log.error { "Couldn't download image: #{ex.class} #{ex}" }
|
172
|
+
log.error { ex.backtrace.join("\n") }
|
177
173
|
@image_error = ex.message
|
178
174
|
end
|
179
175
|
end
|
@@ -181,8 +177,13 @@ module Alexandria
|
|
181
177
|
GLib::Timeout.add(100) do
|
182
178
|
if @image_error
|
183
179
|
image_error_dialog(@image_error).display
|
180
|
+
@image_error = nil
|
184
181
|
else
|
185
182
|
@images.each_pair do |key, value|
|
183
|
+
@images.delete(key)
|
184
|
+
|
185
|
+
next unless value
|
186
|
+
|
186
187
|
loader = GdkPixbuf::PixbufLoader.new
|
187
188
|
loader.last_write(value)
|
188
189
|
pixbuf = loader.pixbuf
|
@@ -195,8 +196,6 @@ module Alexandria
|
|
195
196
|
|
196
197
|
iter[2] = pixbuf # I bet you this is it!
|
197
198
|
end
|
198
|
-
|
199
|
-
@images.delete(key)
|
200
199
|
rescue StandardError => ex
|
201
200
|
image_error_dialog(ex.message).display
|
202
201
|
end
|
@@ -326,7 +325,7 @@ module Alexandria
|
|
326
325
|
|
327
326
|
def on_results_button_press_event(_widget, event)
|
328
327
|
# double left click
|
329
|
-
on_add if (event.event_type == :
|
328
|
+
on_add if (event.event_type == :"2button_press") && (event.button == 1)
|
330
329
|
end
|
331
330
|
|
332
331
|
def add_single_book_by_isbn(library, is_new)
|
@@ -462,7 +461,6 @@ module Alexandria
|
|
462
461
|
# Do not destroy if there is no addition.
|
463
462
|
# return unless book_was_added
|
464
463
|
rescue StandardError => ex
|
465
|
-
# FIXME: Message containing <> should be displayed correctly.
|
466
464
|
ErrorDialog.new(@new_book_dialog, _("Couldn't add the book"), ex.message).display
|
467
465
|
end
|
468
466
|
# books_to_add
|
@@ -93,7 +93,7 @@ module Alexandria
|
|
93
93
|
@treeview_authors.model.each { |_m, _p, i| authors << i[0] }
|
94
94
|
if authors.empty?
|
95
95
|
raise AddError, _("At least one author must be " \
|
96
|
-
|
96
|
+
"provided.")
|
97
97
|
end
|
98
98
|
book = Book.new(title, authors, isbn, publisher,
|
99
99
|
publishing_year.zero? ? nil : publishing_year,
|
@@ -41,7 +41,7 @@ module Alexandria
|
|
41
41
|
else
|
42
42
|
log.warn do
|
43
43
|
"no CheckButton for property #{pref_name} " \
|
44
|
-
|
44
|
+
"(probably conflicting versions of GUI and lib code)"
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
@@ -235,7 +235,7 @@ module Alexandria
|
|
235
235
|
|
236
236
|
def on_providers_button_press_event(_widget, event)
|
237
237
|
# double left click
|
238
|
-
on_provider_setup if (event.event_type == :
|
238
|
+
on_provider_setup if (event.event_type == :"2button_press") && (event.button == 1)
|
239
239
|
end
|
240
240
|
|
241
241
|
def on_close
|
@@ -27,7 +27,7 @@ module Alexandria
|
|
27
27
|
else
|
28
28
|
message = if books.length == 1
|
29
29
|
format(_("Are you sure you want to delete '%s' " \
|
30
|
-
|
30
|
+
"from '%s'?"), books.first.title, library.name)
|
31
31
|
else
|
32
32
|
_("Are you sure you want to delete the " \
|
33
33
|
"selected books from '%s'?") % library.name
|
@@ -418,7 +418,7 @@ module Alexandria
|
|
418
418
|
library.length), library.name, library.length)
|
419
419
|
else
|
420
420
|
format(n_("Library '%s' selected, %d book, " \
|
421
|
-
|
421
|
+
"%d unrated",
|
422
422
|
"Library '%s' selected, %d books, " \
|
423
423
|
"%d unrated",
|
424
424
|
library.length), library.name, library.length, n_unrated)
|
@@ -455,7 +455,7 @@ module Alexandria
|
|
455
455
|
log.debug { "#{@library_listview} : #{@library_popup} : #{@listview}" }
|
456
456
|
log.debug do
|
457
457
|
"@library_listview: #{@library_listview.has_focus?} " \
|
458
|
-
|
458
|
+
"or @library_popup:#{@library_popup.has_focus?}"
|
459
459
|
end
|
460
460
|
log.debug { "@library_listview does *NOT* have focus" }
|
461
461
|
log.debug { "Books are empty: #{books.empty?}" }
|
@@ -531,11 +531,8 @@ module Alexandria
|
|
531
531
|
@actiongroup["Sidepane"].active = false
|
532
532
|
end
|
533
533
|
|
534
|
-
# TODO: Figure out why this frequently selects the wrong book!
|
535
534
|
def select_a_book(book)
|
536
|
-
log.debug { "select_a_book: listview" }
|
537
535
|
select_book_in_view(book, @listview)
|
538
|
-
log.debug { "select_a_book: iconview" }
|
539
536
|
select_book_in_view(book, @iconview)
|
540
537
|
end
|
541
538
|
|
@@ -612,8 +609,8 @@ module Alexandria
|
|
612
609
|
|
613
610
|
def handle_ruined_books
|
614
611
|
new_message = _(
|
615
|
-
"The data files for the following books are malformed or empty. Do you wish to" \
|
616
|
-
"
|
612
|
+
"The data files for the following books are malformed or empty. Do you wish to " \
|
613
|
+
"attempt to download new information for them from the online book providers?\n")
|
617
614
|
|
618
615
|
@libraries.ruined_books.each do |bi|
|
619
616
|
new_message += "\n#{bi[1] || bi[1].inspect}"
|
@@ -657,8 +654,8 @@ module Alexandria
|
|
657
654
|
end
|
658
655
|
|
659
656
|
log.debug do
|
660
|
-
"Trying to add #{book.title}, #{cover_uri}" \
|
661
|
-
|
657
|
+
"Trying to add #{book.title}, #{cover_uri} " \
|
658
|
+
"in library ''#{library.name}'"
|
662
659
|
end
|
663
660
|
library.save_cover(book, cover_uri) unless cover_uri.nil?
|
664
661
|
library << book
|
@@ -878,7 +875,6 @@ module Alexandria
|
|
878
875
|
end
|
879
876
|
|
880
877
|
def iter_from_ident(ident)
|
881
|
-
log.debug { ident.to_s }
|
882
878
|
iter = @model.iter_first
|
883
879
|
ok = true if iter
|
884
880
|
while ok
|
@@ -890,7 +886,6 @@ module Alexandria
|
|
890
886
|
end
|
891
887
|
|
892
888
|
def iter_from_book(book)
|
893
|
-
log.debug { book.to_s }
|
894
889
|
iter_from_ident(book.ident)
|
895
890
|
end
|
896
891
|
|
@@ -1074,7 +1069,7 @@ module Alexandria
|
|
1074
1069
|
# added by Cathal Mc Ginley, 23 Oct 2007
|
1075
1070
|
log.debug do
|
1076
1071
|
"library_sort_order #{@notebook.page}: " \
|
1077
|
-
|
1072
|
+
"#{@iconview.model.inspect} #{@listview.model.inspect}"
|
1078
1073
|
end
|
1079
1074
|
result, sort_column, sort_order = current_view.model.sort_column_id
|
1080
1075
|
if result
|
@@ -1100,10 +1095,10 @@ module Alexandria
|
|
1100
1095
|
def get_previous_selected_library(library)
|
1101
1096
|
log.debug { "get_previous_selected_library: #{library}" }
|
1102
1097
|
@previous_selected_library = selected_library
|
1103
|
-
if @previous_selected_library
|
1104
|
-
select_library(library)
|
1105
|
-
else
|
1098
|
+
if @previous_selected_library == library
|
1106
1099
|
@previous_selected_library = nil
|
1100
|
+
else
|
1101
|
+
select_library(library)
|
1107
1102
|
end
|
1108
1103
|
end
|
1109
1104
|
|
@@ -1181,23 +1176,20 @@ module Alexandria
|
|
1181
1176
|
private
|
1182
1177
|
|
1183
1178
|
def select_book_in_view(book, view)
|
1184
|
-
@filtered_model.refilter
|
1185
|
-
iter = iter_from_book book
|
1186
|
-
return unless iter
|
1187
|
-
|
1188
|
-
path = iter.path
|
1189
1179
|
return unless view.model
|
1190
1180
|
|
1181
|
+
@filtered_model.refilter
|
1182
|
+
iter = iter_from_book(book) or return
|
1183
|
+
path = iter.path
|
1191
1184
|
path = view_path_to_model_path(view, path)
|
1192
|
-
log.debug { "Path for #{book.ident} is #{path}" }
|
1193
1185
|
selection = view.respond_to?(:selection) ? view.selection : view
|
1194
1186
|
selection.unselect_all
|
1195
|
-
selection.select_path(path)
|
1187
|
+
selection.select_path(path) if path
|
1196
1188
|
end
|
1197
1189
|
|
1198
|
-
def view_path_to_model_path(view,
|
1199
|
-
|
1200
|
-
@filtered_model.convert_path_to_child_path(
|
1190
|
+
def view_path_to_model_path(view, view_path)
|
1191
|
+
filter_path = view.model.convert_path_to_child_path(view_path)
|
1192
|
+
@filtered_model.convert_path_to_child_path(filter_path) if filter_path
|
1201
1193
|
end
|
1202
1194
|
end
|
1203
1195
|
end
|
data/lib/alexandria/version.rb
CHANGED
data/lib/alexandria.rb
CHANGED
@@ -21,10 +21,11 @@ require "alexandria/logging"
|
|
21
21
|
require "alexandria/about"
|
22
22
|
|
23
23
|
module Alexandria
|
24
|
-
def self.
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
def self.clear_invalid_proxy
|
25
|
+
current_proxy = ENV.fetch("http_proxy", nil)
|
26
|
+
return if current_proxy.nil?
|
27
|
+
|
28
|
+
ENV["http_proxy"] = nil if URI.parse(current_proxy).userinfo.nil?
|
28
29
|
end
|
29
30
|
|
30
31
|
def self.set_log_level
|
@@ -33,7 +34,7 @@ module Alexandria
|
|
33
34
|
end
|
34
35
|
|
35
36
|
def self.main
|
36
|
-
|
37
|
+
clear_invalid_proxy
|
37
38
|
set_log_level
|
38
39
|
Alexandria::UI.main
|
39
40
|
end
|