alexandria-book-collection-manager 0.7.9 → 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 +6 -6
- data/.rubocop_todo.yml +13 -26
- data/.simplecov +2 -2
- data/CHANGELOG.md +8 -0
- data/Rakefile +3 -3
- data/alexandria-book-collection-manager.gemspec +18 -18
- data/lib/alexandria/book_providers/z3950_provider.rb +1 -1
- data/lib/alexandria/console.rb +2 -2
- data/lib/alexandria/export_library.rb +4 -4
- data/lib/alexandria/import_library.rb +1 -1
- data/lib/alexandria/library_store.rb +1 -1
- data/lib/alexandria/models/library.rb +2 -2
- data/lib/alexandria/{book_providers/pseudomarc.rb → pseudo_marc_parser.rb} +1 -1
- data/lib/alexandria/smart_library.rb +2 -2
- data/lib/alexandria/ui/alert_dialog.rb +2 -2
- data/lib/alexandria/ui/book_properties_dialog_base.rb +3 -3
- data/lib/alexandria/ui/icons.rb +2 -2
- data/lib/alexandria/ui/init.rb +10 -4
- data/lib/alexandria/ui/ui_manager.rb +4 -4
- data/lib/alexandria/version.rb +1 -1
- data/lib/alexandria/web_themes.rb +1 -1
- data/lib/alexandria.rb +6 -5
- data/spec/alexandria/book_providers/bl_provider_spec.rb +1 -1
- data/spec/alexandria/book_providers/loc_provider_spec.rb +2 -2
- data/spec/alexandria/book_providers/sbn_provider_spec.rb +1 -1
- 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_spec.rb +5 -3
- data/spec/alexandria/export_library_spec.rb +8 -8
- data/spec/alexandria/library_spec.rb +67 -53
- 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 +5 -3
- data/spec/spec_helper.rb +23 -32
- data/util/rake/fileinstall.rb +8 -8
- data/util/rake/gettextgenerate.rb +1 -1
- metadata +15 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 829e1e63ffab2d61ef2a83a75ac56bf393e503f45ef4ba6d7914ce1c5a38e845
|
4
|
+
data.tar.gz: 5732456488a3f7ad93a3ec2d35c0011a2155f32496397740f3262bfb7dadd463
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 128ded6fe79d486802a8790f557cd0a94cd32f6345a996827b7acd8171067be0146f5bdeec10c015c331b2e6b73cfdff877295c3dbfde60d726b53c6241d941c
|
7
|
+
data.tar.gz: 87675903b9ef31770693a072e832b798d4512d5f0ce9aac59d0dab3421f8974919d1ce4b67673f2fa5841da8e35d665ea83c04928befaa6b7b305a102c89e917
|
data/.github/workflows/ruby.yml
CHANGED
@@ -4,11 +4,11 @@
|
|
4
4
|
|
5
5
|
name: CI
|
6
6
|
|
7
|
-
on:
|
7
|
+
"on":
|
8
8
|
push:
|
9
|
-
branches: [
|
9
|
+
branches: [master]
|
10
10
|
pull_request:
|
11
|
-
branches: [
|
11
|
+
branches: [master]
|
12
12
|
schedule:
|
13
13
|
- cron: '16 4 12 * *'
|
14
14
|
|
@@ -19,10 +19,10 @@ jobs:
|
|
19
19
|
|
20
20
|
strategy:
|
21
21
|
matrix:
|
22
|
-
ruby: [2.6, 2.7, "3.0", "3.1"]
|
22
|
+
ruby: [2.6, 2.7, "3.0", "3.1", "3.2.0-preview2"]
|
23
23
|
|
24
24
|
steps:
|
25
|
-
- uses: actions/checkout@
|
25
|
+
- uses: actions/checkout@v3
|
26
26
|
- name: Install non-ruby dependencies
|
27
27
|
run: |
|
28
28
|
sudo apt-get update
|
@@ -53,7 +53,7 @@ jobs:
|
|
53
53
|
runs-on: ubuntu-latest
|
54
54
|
|
55
55
|
steps:
|
56
|
-
- uses: actions/checkout@
|
56
|
+
- uses: actions/checkout@v3
|
57
57
|
- name: Install non-ruby dependencies
|
58
58
|
run: |
|
59
59
|
sudo apt-get update
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config --no-offense-counts --no-auto-gen-timestamp`
|
3
|
-
# using RuboCop version 1.
|
3
|
+
# using RuboCop version 1.36.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -12,12 +12,12 @@ Lint/DuplicateBranch:
|
|
12
12
|
- 'lib/alexandria/book_providers/sbn_provider.rb'
|
13
13
|
- 'util/rake/fileinstall.rb'
|
14
14
|
|
15
|
-
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
15
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
|
16
16
|
Metrics/AbcSize:
|
17
|
-
Max:
|
17
|
+
Max: 109
|
18
18
|
|
19
|
-
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
20
|
-
#
|
19
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods, inherit_mode.
|
20
|
+
# AllowedMethods: refine
|
21
21
|
Metrics/BlockLength:
|
22
22
|
Max: 64
|
23
23
|
|
@@ -29,11 +29,11 @@ Metrics/BlockNesting:
|
|
29
29
|
Metrics/ClassLength:
|
30
30
|
Max: 991
|
31
31
|
|
32
|
-
# Configuration parameters: IgnoredMethods.
|
32
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
|
33
33
|
Metrics/CyclomaticComplexity:
|
34
|
-
Max:
|
34
|
+
Max: 21
|
35
35
|
|
36
|
-
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
36
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
37
37
|
Metrics/MethodLength:
|
38
38
|
Max: 98
|
39
39
|
|
@@ -45,7 +45,7 @@ Metrics/ModuleLength:
|
|
45
45
|
Metrics/ParameterLists:
|
46
46
|
Max: 7
|
47
47
|
|
48
|
-
# Configuration parameters: IgnoredMethods.
|
48
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
|
49
49
|
Metrics/PerceivedComplexity:
|
50
50
|
Max: 27
|
51
51
|
|
@@ -76,20 +76,7 @@ RSpec/FilePath:
|
|
76
76
|
- 'spec/alexandria/ui/iconview_spec.rb'
|
77
77
|
- 'spec/alexandria/ui/sound_spec.rb'
|
78
78
|
|
79
|
-
|
80
|
-
Max: 7
|
81
|
-
|
82
|
-
# Cop supports --auto-correct.
|
83
|
-
# Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers.
|
84
|
-
# SupportedStyles: inflected, explicit
|
85
|
-
RSpec/PredicateMatcher:
|
86
|
-
Exclude:
|
87
|
-
- 'spec/alexandria/export_library_spec.rb'
|
88
|
-
- 'spec/alexandria/library_spec.rb'
|
89
|
-
- 'spec/alexandria/library_store_spec.rb'
|
90
|
-
- 'spec/alexandria/scanners/cue_cat_spec.rb'
|
91
|
-
|
92
|
-
# Cop supports --auto-correct.
|
79
|
+
# This cop supports safe autocorrection (--autocorrect).
|
93
80
|
Rake/Desc:
|
94
81
|
Exclude:
|
95
82
|
- 'Rakefile'
|
@@ -99,7 +86,7 @@ Rake/DuplicateTask:
|
|
99
86
|
Exclude:
|
100
87
|
- 'Rakefile'
|
101
88
|
|
102
|
-
#
|
89
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
103
90
|
# Configuration parameters: EnforcedStyle.
|
104
91
|
# SupportedStyles: nested, compact
|
105
92
|
Style/ClassAndModuleChildren:
|
@@ -121,7 +108,8 @@ Style/ClassVars:
|
|
121
108
|
Style/Documentation:
|
122
109
|
Enabled: false
|
123
110
|
|
124
|
-
#
|
111
|
+
# This cop supports safe autocorrection (--autocorrect).
|
112
|
+
# Configuration parameters: EnforcedStyle, MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
125
113
|
# SupportedStyles: annotated, template, unannotated
|
126
114
|
Style/FormatStringToken:
|
127
115
|
Exclude:
|
@@ -133,7 +121,6 @@ Style/OptionalBooleanParameter:
|
|
133
121
|
Exclude:
|
134
122
|
- 'lib/alexandria/book_providers.rb'
|
135
123
|
- 'lib/alexandria/book_providers/worldcat.rb'
|
136
|
-
- 'lib/alexandria/console.rb'
|
137
124
|
- 'lib/alexandria/execution_queue.rb'
|
138
125
|
- 'lib/alexandria/export_format.rb'
|
139
126
|
- 'lib/alexandria/library_sort_order.rb'
|
data/.simplecov
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.7.10 / 2022-10-14
|
4
|
+
|
5
|
+
* Loosen dependency on the marc gem
|
6
|
+
* Update dependency on the gtk3 and gstreamer gems
|
7
|
+
* Make Alexandria's own MARC parser handle nil records ([#198] by [mvz])
|
8
|
+
* Support upcoming Ruby 3.2
|
9
|
+
|
3
10
|
## 0.7.9 / 2022-02-04
|
4
11
|
|
5
12
|
* Drop support for Ruby 2.5
|
@@ -135,6 +142,7 @@
|
|
135
142
|
[HappyFacade]: https://github.com/HappyFacade
|
136
143
|
|
137
144
|
<!-- issues and pull requests -->
|
145
|
+
[#198]: https://github.com/mvz/alexandria-book-collection-manager/pull/198
|
138
146
|
[#139]: https://github.com/mvz/alexandria-book-collection-manager/pull/139
|
139
147
|
[#136]: https://github.com/mvz/alexandria-book-collection-manager/pull/136
|
140
148
|
[#134]: https://github.com/mvz/alexandria-book-collection-manager/pull/134
|
data/Rakefile
CHANGED
@@ -15,12 +15,12 @@ require "omfgenerate"
|
|
15
15
|
|
16
16
|
require_relative "lib/alexandria/version"
|
17
17
|
|
18
|
-
stage_dir = ENV
|
19
|
-
prefix_dir = ENV
|
18
|
+
stage_dir = ENV.fetch("DESTDIR", "tmp")
|
19
|
+
prefix_dir = ENV.fetch("PREFIX", "/usr")
|
20
20
|
|
21
21
|
PROJECT = "alexandria"
|
22
22
|
PREFIX = prefix_dir
|
23
|
-
share_dir = ENV
|
23
|
+
share_dir = ENV.fetch("SHARE", "#{PREFIX}/share")
|
24
24
|
SHARE = share_dir
|
25
25
|
|
26
26
|
GettextGenerateTask.new(PROJECT) do |g|
|
@@ -47,23 +47,23 @@ Gem::Specification.new do |spec|
|
|
47
47
|
spec.require_paths = ["lib"]
|
48
48
|
spec.rdoc_options = ["--main", "README.md"]
|
49
49
|
|
50
|
-
spec.add_runtime_dependency
|
51
|
-
spec.add_runtime_dependency
|
52
|
-
spec.add_runtime_dependency
|
53
|
-
spec.add_runtime_dependency
|
54
|
-
spec.add_runtime_dependency
|
55
|
-
spec.add_runtime_dependency
|
56
|
-
spec.add_runtime_dependency
|
57
|
-
spec.add_runtime_dependency
|
58
|
-
spec.add_runtime_dependency
|
50
|
+
spec.add_runtime_dependency "gettext", ["~> 3.1"]
|
51
|
+
spec.add_runtime_dependency "gstreamer", ["~> 4.0.2"]
|
52
|
+
spec.add_runtime_dependency "gtk3", ["~> 4.0.2"]
|
53
|
+
spec.add_runtime_dependency "htmlentities", ["~> 4.3"]
|
54
|
+
spec.add_runtime_dependency "image_size", ["~> 3.0"]
|
55
|
+
spec.add_runtime_dependency "marc", ">= 1.0", "< 1.3"
|
56
|
+
spec.add_runtime_dependency "nokogiri", ["~> 1.11"]
|
57
|
+
spec.add_runtime_dependency "psych", ">= 3.2", "< 4.1"
|
58
|
+
spec.add_runtime_dependency "zoom", ["~> 0.5.0"]
|
59
59
|
|
60
|
-
spec.add_development_dependency
|
61
|
-
spec.add_development_dependency
|
62
|
-
spec.add_development_dependency
|
63
|
-
spec.add_development_dependency
|
64
|
-
spec.add_development_dependency
|
65
|
-
spec.add_development_dependency
|
66
|
-
spec.add_development_dependency
|
67
|
-
spec.add_development_dependency
|
68
|
-
spec.add_development_dependency
|
60
|
+
spec.add_development_dependency "gnome_app_driver", "~> 0.3.2"
|
61
|
+
spec.add_development_dependency "rake", ["~> 13.0"]
|
62
|
+
spec.add_development_dependency "rspec", ["~> 3.0"]
|
63
|
+
spec.add_development_dependency "rubocop", "~> 1.32"
|
64
|
+
spec.add_development_dependency "rubocop-i18n", ["~> 3.0"]
|
65
|
+
spec.add_development_dependency "rubocop-performance", "~> 1.13"
|
66
|
+
spec.add_development_dependency "rubocop-rake", "~> 0.6.0"
|
67
|
+
spec.add_development_dependency "rubocop-rspec", "~> 2.7"
|
68
|
+
spec.add_development_dependency "webmock", "~> 3.9"
|
69
69
|
end
|
data/lib/alexandria/console.rb
CHANGED
@@ -5,14 +5,14 @@
|
|
5
5
|
# See the file README.md for authorship and licensing information.
|
6
6
|
|
7
7
|
module Alexandria
|
8
|
-
def self.list_books_on_console
|
8
|
+
def self.list_books_on_console
|
9
9
|
collection = Alexandria::LibraryCollection.instance
|
10
10
|
collection.reload
|
11
11
|
libraries = collection.all_regular_libraries
|
12
12
|
output_string = ""
|
13
13
|
@books = libraries.flatten
|
14
14
|
@books.each do |book|
|
15
|
-
book_authors = book.authors.join(" & ")
|
15
|
+
book_authors = book.authors.join(" & ")
|
16
16
|
output_string += [book.title, book_authors].join(", ") + "\n"
|
17
17
|
end
|
18
18
|
output_string
|
@@ -73,7 +73,7 @@ module Alexandria
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def export_as_html(filename, theme)
|
76
|
-
FileUtils.
|
76
|
+
FileUtils.mkdir_p(filename)
|
77
77
|
Dir.chdir(filename) do
|
78
78
|
copy_covers("pixmaps")
|
79
79
|
FileUtils.cp_r(theme.pixmaps_directory, "pixmaps") if theme.has_pixmaps?
|
@@ -91,7 +91,7 @@ module Alexandria
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def export_as_ipod_notes(filename, _theme)
|
94
|
-
FileUtils.
|
94
|
+
FileUtils.mkdir_p(filename)
|
95
95
|
tempdir = Dir.getwd
|
96
96
|
Dir.chdir(filename)
|
97
97
|
copy_covers("pixmaps")
|
@@ -211,8 +211,8 @@ module Alexandria
|
|
211
211
|
doc = REXML::Document.new
|
212
212
|
doc << REXML::XMLDecl.new
|
213
213
|
doc << REXML::DocType.new("tellico",
|
214
|
-
'PUBLIC "-//Robby Stephenson/DTD Tellico V7.0//EN"' \
|
215
|
-
'
|
214
|
+
'PUBLIC "-//Robby Stephenson/DTD Tellico V7.0//EN" ' \
|
215
|
+
'"http://periapsis.org/tellico/dtd/v7/tellico.dtd"')
|
216
216
|
tellico = doc.add_element("tellico")
|
217
217
|
tellico.add_attribute("syntaxVersion", "7")
|
218
218
|
tellico.add_namespace("http://periapsis.org/tellico/")
|
@@ -72,7 +72,7 @@ module Alexandria
|
|
72
72
|
return nil unless system("unzip -qqt \"#{filename}\"")
|
73
73
|
|
74
74
|
tmpdir = File.join(Dir.tmpdir, "tellico_export")
|
75
|
-
FileUtils.rm_rf(tmpdir)
|
75
|
+
FileUtils.rm_rf(tmpdir)
|
76
76
|
Dir.mkdir(tmpdir)
|
77
77
|
Dir.chdir(tmpdir) do
|
78
78
|
system("unzip -qq \"#{filename}\"")
|
@@ -43,7 +43,7 @@ module Alexandria
|
|
43
43
|
test = [0, nil]
|
44
44
|
ruined_books = []
|
45
45
|
library = Library.new(name, self)
|
46
|
-
FileUtils.mkdir_p(library.path)
|
46
|
+
FileUtils.mkdir_p(library.path)
|
47
47
|
Dir.chdir(library.path) do
|
48
48
|
Dir["*" + Library::EXT[:book]].sort.each do |filename|
|
49
49
|
test[1] = filename if (test[0]).zero?
|
@@ -20,7 +20,7 @@ module Alexandria
|
|
20
20
|
attr_reader :name
|
21
21
|
attr_accessor :ruined_books, :updating, :deleted_books
|
22
22
|
|
23
|
-
DEFAULT_DIR = File.join(
|
23
|
+
DEFAULT_DIR = File.join(Dir.home, ".alexandria")
|
24
24
|
EXT = { book: ".yaml", cover: ".cover" }.freeze
|
25
25
|
|
26
26
|
include GetText
|
@@ -379,7 +379,7 @@ module Alexandria
|
|
379
379
|
end
|
380
380
|
|
381
381
|
def copy_covers(somewhere)
|
382
|
-
FileUtils.rm_rf(somewhere)
|
382
|
+
FileUtils.rm_rf(somewhere)
|
383
383
|
FileUtils.mkdir(somewhere)
|
384
384
|
each do |book|
|
385
385
|
next unless File.exist?(cover(book))
|
@@ -148,7 +148,7 @@ module Alexandria
|
|
148
148
|
if book
|
149
149
|
@cache[book].save(book)
|
150
150
|
else
|
151
|
-
FileUtils.mkdir_p(base_dir)
|
151
|
+
FileUtils.mkdir_p(base_dir)
|
152
152
|
File.open(yaml, "w") { |io| io.puts to_hash.to_yaml }
|
153
153
|
end
|
154
154
|
end
|
@@ -162,7 +162,7 @@ module Alexandria
|
|
162
162
|
end
|
163
163
|
|
164
164
|
def copy_covers(somewhere)
|
165
|
-
FileUtils.rm_rf(somewhere)
|
165
|
+
FileUtils.rm_rf(somewhere)
|
166
166
|
FileUtils.mkdir(somewhere)
|
167
167
|
each do |book|
|
168
168
|
library = @cache[book]
|
@@ -34,6 +34,8 @@ module Alexandria
|
|
34
34
|
@dialog.child.pack_start(hbox)
|
35
35
|
end
|
36
36
|
|
37
|
+
attr_reader :dialog
|
38
|
+
|
37
39
|
def show_all
|
38
40
|
dialog.show_all
|
39
41
|
end
|
@@ -52,8 +54,6 @@ module Alexandria
|
|
52
54
|
|
53
55
|
private
|
54
56
|
|
55
|
-
attr_reader :dialog
|
56
|
-
|
57
57
|
def make_label(markup)
|
58
58
|
label = Gtk::Label.new
|
59
59
|
label.set_alignment(0, 0)
|
@@ -151,7 +151,7 @@ module Alexandria
|
|
151
151
|
|
152
152
|
def want_toggled; end
|
153
153
|
|
154
|
-
@@latest_filechooser_directory =
|
154
|
+
@@latest_filechooser_directory = Dir.home
|
155
155
|
def on_change_cover
|
156
156
|
dialog = Gtk::FileChooserDialog.new(title: _("Select a cover image"),
|
157
157
|
parent: @book_properties_dialog,
|
@@ -177,8 +177,8 @@ module Alexandria
|
|
177
177
|
FileUtils.cp(dialog.filename, "#{@cover_file}.orig")
|
178
178
|
new_width = cover.width / (cover.height / COVER_ABSOLUTE_MAXHEIGHT.to_f)
|
179
179
|
log.info do
|
180
|
-
"Scaling large cover image to" \
|
181
|
-
"
|
180
|
+
"Scaling large cover image to " \
|
181
|
+
"#{new_width.to_i} x #{COVER_ABSOLUTE_MAXHEIGHT}"
|
182
182
|
end
|
183
183
|
cover = cover.scale(new_width.to_i, COVER_ABSOLUTE_MAXHEIGHT)
|
184
184
|
cover.save(@cover_file, "jpeg")
|
data/lib/alexandria/ui/icons.rb
CHANGED
@@ -35,8 +35,8 @@ module Alexandria
|
|
35
35
|
return GdkPixbuf::Pixbuf.new(file: filename) if File.exist?(filename)
|
36
36
|
rescue GdkPixbuf::PixbufError
|
37
37
|
log.error do
|
38
|
-
"Failed to load GdkPixbuf::Pixbuf," \
|
39
|
-
"
|
38
|
+
"Failed to load GdkPixbuf::Pixbuf, " \
|
39
|
+
"please ensure that #{filename} is a valid image file"
|
40
40
|
end
|
41
41
|
end
|
42
42
|
BOOK_ICON
|
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
|
|
@@ -609,8 +609,8 @@ module Alexandria
|
|
609
609
|
|
610
610
|
def handle_ruined_books
|
611
611
|
new_message = _(
|
612
|
-
"The data files for the following books are malformed or empty. Do you wish to" \
|
613
|
-
"
|
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")
|
614
614
|
|
615
615
|
@libraries.ruined_books.each do |bi|
|
616
616
|
new_message += "\n#{bi[1] || bi[1].inspect}"
|
@@ -654,8 +654,8 @@ module Alexandria
|
|
654
654
|
end
|
655
655
|
|
656
656
|
log.debug do
|
657
|
-
"Trying to add #{book.title}, #{cover_uri}" \
|
658
|
-
"
|
657
|
+
"Trying to add #{book.title}, #{cover_uri} " \
|
658
|
+
"in library ''#{library.name}'"
|
659
659
|
end
|
660
660
|
library.save_cover(book, cover_uri) unless cover_uri.nil?
|
661
661
|
library << book
|
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
|
@@ -8,10 +8,10 @@ require "spec_helper"
|
|
8
8
|
|
9
9
|
describe Alexandria::BookProviders::LOCProvider do
|
10
10
|
it "works for a book with ASCII title" do
|
11
|
-
|
11
|
+
expect(described_class).to have_correct_search_result_for "9780805335583"
|
12
12
|
end
|
13
13
|
|
14
14
|
it "works for a book with a title with non-ASCII letters" do
|
15
|
-
|
15
|
+
expect(described_class).to have_correct_search_result_for "9782070379248"
|
16
16
|
end
|
17
17
|
end
|
@@ -114,6 +114,6 @@ RSpec.describe Alexandria::BookProviders::ThaliaProvider do
|
|
114
114
|
stub_request(:get, "https://www.thalia.de/shop/home/artikeldetails/ID134292338.html")
|
115
115
|
.to_return(status: 200, body: normal_people_details, headers: {})
|
116
116
|
|
117
|
-
|
117
|
+
expect(described_class).to have_correct_search_result_for "9780571334650"
|
118
118
|
end
|
119
119
|
end
|
@@ -139,22 +139,34 @@ RSpec.describe Alexandria::BookProviders::WorldCatProvider do
|
|
139
139
|
"sky-catalogue-20000-ed-by-alan-hirshfeld-and-roger-w-sinnott" \
|
140
140
|
"/oclc/476534140&referer=brief_results")
|
141
141
|
.to_return(status: 200, body: +sky_catalog_details, headers: {})
|
142
|
-
|
142
|
+
expect(described_class).to have_correct_search_result_for "9780521247108"
|
143
143
|
end
|
144
144
|
|
145
145
|
it "works with vernacular" do
|
146
146
|
stub_request(:get, "https://www.worldcat.org/search?q=isbn:9785941454136&qt=advanced")
|
147
147
|
.to_return(status: 200, body: +florence_ru_details, headers: {})
|
148
|
-
|
148
|
+
expect(described_class).to have_correct_search_result_for "9785941454136"
|
149
149
|
end
|
150
150
|
|
151
|
-
|
152
|
-
|
153
|
-
.
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
151
|
+
context "when book has multiple authors" do
|
152
|
+
let(:search_result) do
|
153
|
+
described_class.instance.search("9785941454136",
|
154
|
+
Alexandria::BookProviders::SEARCH_BY_ISBN)
|
155
|
+
rescue SocketError
|
156
|
+
skip "Service is offline"
|
157
|
+
end
|
158
|
+
|
159
|
+
before do
|
160
|
+
stub_request(:get, "https://www.worldcat.org/search?q=isbn:9785941454136&qt=advanced")
|
161
|
+
.to_return(status: 200, body: +florence_ru_details, headers: {})
|
162
|
+
end
|
163
|
+
|
164
|
+
it "returns all authors" do
|
165
|
+
this_book, = search_result
|
166
|
+
aggregate_failures do
|
167
|
+
expect(this_book.authors).to be_instance_of(Array), "Not an array!"
|
168
|
+
expect(this_book.authors.length).to eq(2), "Wrong number of authors for this book!"
|
169
|
+
end
|
170
|
+
end
|
159
171
|
end
|
160
172
|
end
|
@@ -22,16 +22,18 @@ require "spec_helper"
|
|
22
22
|
|
23
23
|
describe Alexandria::Book do
|
24
24
|
it "is a thing" do
|
25
|
-
an_artist_of_the_floating_world
|
25
|
+
expect(an_artist_of_the_floating_world).to be_a described_class
|
26
26
|
end
|
27
27
|
|
28
28
|
it "establishes equality only with books with the same identity" do
|
29
29
|
book = an_artist_of_the_floating_world
|
30
30
|
same_book = an_artist_of_the_floating_world
|
31
|
-
expect(same_book).to eq book
|
32
31
|
different_book = an_artist_of_the_floating_world
|
33
32
|
different_book.isbn = "9780571147999"
|
34
|
-
|
33
|
+
aggregate_failures do
|
34
|
+
expect(same_book).to eq book
|
35
|
+
expect(different_book).not_to eq book
|
36
|
+
end
|
35
37
|
end
|
36
38
|
|
37
39
|
describe "#rating" do
|