alexandria-book-collection-manager 0.7.5 → 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +9 -0
- data/.gitignore +4 -1
- data/.rubocop.yml +51 -29
- data/.rubocop_todo.yml +33 -155
- data/.simplecov +5 -2
- data/.travis.yml +10 -4
- data/CHANGELOG.md +19 -0
- data/INSTALL.md +23 -11
- data/README.md +36 -35
- data/Rakefile +7 -5
- data/alexandria-book-collection-manager.gemspec +8 -3
- data/doc/dependency_decisions.yml +22 -3
- data/lib/alexandria.rb +2 -2
- data/lib/alexandria/book_providers.rb +47 -49
- data/lib/alexandria/book_providers/adlibris.rb +8 -13
- data/lib/alexandria/book_providers/amazon_aws.rb +47 -60
- data/lib/alexandria/book_providers/amazon_ecs_util.rb +283 -298
- data/lib/alexandria/book_providers/barnes_and_noble.rb +8 -8
- data/lib/alexandria/book_providers/douban.rb +2 -2
- data/lib/alexandria/book_providers/proxis.rb +12 -11
- data/lib/alexandria/book_providers/pseudomarc.rb +60 -70
- data/lib/alexandria/book_providers/siciliano.rb +5 -6
- data/lib/alexandria/book_providers/thalia.rb +8 -9
- data/lib/alexandria/book_providers/worldcat.rb +25 -31
- data/lib/alexandria/book_providers/z3950.rb +62 -69
- data/lib/alexandria/default_preferences.rb +37 -0
- data/lib/alexandria/execution_queue.rb +13 -12
- data/lib/alexandria/export_library.rb +4 -8
- data/lib/alexandria/import_library.rb +38 -62
- data/lib/alexandria/import_library_csv.rb +16 -16
- data/lib/alexandria/library_sort_order.rb +3 -1
- data/lib/alexandria/library_store.rb +16 -16
- data/lib/alexandria/logging.rb +4 -8
- data/lib/alexandria/models/book.rb +2 -2
- data/lib/alexandria/models/library.rb +18 -14
- data/lib/alexandria/net.rb +1 -2
- data/lib/alexandria/preferences.rb +27 -31
- data/lib/alexandria/scanners.rb +2 -2
- data/lib/alexandria/scanners/cue_cat.rb +5 -5
- data/lib/alexandria/scanners/keyboard.rb +1 -1
- data/lib/alexandria/smart_library.rb +22 -26
- data/lib/alexandria/ui.rb +7 -7
- data/lib/alexandria/ui/about_dialog.rb +1 -1
- data/lib/alexandria/ui/acquire_dialog.rb +9 -10
- data/lib/alexandria/ui/alert_dialog.rb +34 -19
- data/lib/alexandria/ui/bad_isbns_dialog.rb +13 -9
- data/lib/alexandria/ui/barcode_animation.rb +5 -5
- data/lib/alexandria/ui/book_properties_dialog.rb +2 -2
- data/lib/alexandria/ui/book_properties_dialog_base.rb +23 -17
- data/lib/alexandria/ui/callbacks.rb +141 -120
- data/lib/alexandria/ui/completion_models.rb +1 -1
- data/lib/alexandria/ui/confirm_erase_dialog.rb +1 -1
- data/lib/alexandria/ui/conflict_while_copying_dialog.rb +1 -1
- data/lib/alexandria/ui/error_dialog.rb +1 -1
- data/lib/alexandria/ui/export_dialog.rb +13 -15
- data/lib/alexandria/ui/icons.rb +34 -40
- data/lib/alexandria/ui/iconview_tooltips.rb +40 -53
- data/lib/alexandria/ui/import_dialog.rb +48 -47
- data/lib/alexandria/ui/init.rb +3 -2
- data/lib/alexandria/ui/keep_bad_isbn_dialog.rb +2 -2
- data/lib/alexandria/ui/libraries_combo.rb +10 -9
- data/lib/alexandria/ui/listview.rb +5 -6
- data/lib/alexandria/ui/main_app.rb +2 -2
- data/lib/alexandria/ui/multi_drag_treeview.rb +4 -6
- data/lib/alexandria/ui/new_book_dialog.rb +52 -52
- data/lib/alexandria/ui/new_provider_dialog.rb +12 -11
- data/lib/alexandria/ui/new_smart_library_dialog.rb +39 -27
- data/lib/alexandria/ui/preferences_dialog.rb +23 -82
- data/lib/alexandria/ui/provider_preferences_base_dialog.rb +9 -5
- data/lib/alexandria/ui/provider_preferences_dialog.rb +5 -5
- data/lib/alexandria/ui/really_delete_dialog.rb +1 -1
- data/lib/alexandria/ui/sidepane_manager.rb +35 -37
- data/lib/alexandria/ui/skip_entry_dialog.rb +3 -2
- data/lib/alexandria/ui/smart_library_properties_dialog.rb +35 -36
- data/lib/alexandria/ui/smart_library_properties_dialog_base.rb +59 -138
- data/lib/alexandria/ui/smart_library_rule_box.rb +119 -0
- data/lib/alexandria/ui/sound.rb +4 -6
- data/lib/alexandria/ui/ui_manager.rb +62 -64
- data/lib/alexandria/version.rb +2 -2
- data/lib/alexandria/web_themes.rb +15 -15
- data/po/cs.po +991 -874
- data/po/cy.po +957 -870
- data/po/de.po +991 -866
- data/po/el.po +987 -863
- data/po/es.po +986 -862
- data/po/fr.po +988 -868
- data/po/ga.po +910 -822
- data/po/gl.po +983 -863
- data/po/it.po +984 -862
- data/po/ja.po +969 -849
- data/po/mk.po +983 -859
- data/po/nb.po +982 -862
- data/po/nl.po +992 -869
- data/po/pl.po +1018 -963
- data/po/pt.po +983 -852
- data/po/pt_BR.po +983 -863
- data/po/ru.po +992 -869
- data/po/sk.po +986 -864
- data/po/sv.po +980 -860
- data/po/uk.po +975 -861
- data/po/zh_TW.po +974 -854
- data/share/alexandria/glade/main_app__builder.glade +6 -21
- data/share/gnome/help/alexandria/C/smart-libraries.xml +2 -2
- data/share/gnome/help/alexandria/C/working-with-libraries.xml +1 -1
- data/share/gnome/help/alexandria/fr/alexandria.xml +1 -1
- data/share/gnome/help/alexandria/ja/smart-libraries.xml +1 -1
- data/spec/alexandria/book_providers/world_cat_provider_spec.rb +160 -0
- data/spec/alexandria/book_providers_spec.rb +73 -129
- data/spec/alexandria/console_spec.rb +0 -5
- data/spec/alexandria/export_library_spec.rb +27 -38
- data/spec/alexandria/library_spec.rb +56 -44
- data/spec/alexandria/preferences_spec.rb +29 -3
- data/spec/alexandria/scanners/cue_cat_spec.rb +1 -1
- 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 +1 -1
- data/spec/alexandria/ui/bad_isbns_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/book_properties_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/confirm_erase_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/conflict_while_copying_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/error_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/export_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/icons_spec.rb +26 -0
- data/spec/alexandria/ui/iconview_spec.rb +1 -1
- data/spec/alexandria/ui/import_dialog_spec.rb +30 -3
- data/spec/alexandria/ui/keep_bad_isbn_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/main_app_spec.rb +1 -1
- data/spec/alexandria/ui/new_book_dialog_manual_spec.rb +1 -1
- data/spec/alexandria/ui/new_provider_dialog_spec.rb +19 -3
- data/spec/alexandria/ui/new_smart_library_dialog_spec.rb +28 -3
- data/spec/alexandria/ui/preferences_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/provider_preferences_dialog_spec.rb +23 -8
- data/spec/alexandria/ui/really_delete_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/sidepane_manager_spec.rb +2 -2
- data/spec/alexandria/ui/skip_entry_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/smart_library_properties_dialog_spec.rb +21 -7
- data/spec/alexandria/ui/ui_manager_spec.rb +39 -2
- data/spec/spec_helper.rb +46 -3
- data/tasks/spec.rake +3 -5
- data/util/rake/fileinstall.rb +12 -11
- metadata +82 -10
- data/spec/alexandria/ui/ui_utilities_spec.rb +0 -62
- data/spec/alexandria/utilities_spec.rb +0 -52
@@ -1,9 +1,12 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!-- Generated with glade 3.22.
|
2
|
+
<!-- Generated with glade 3.22.2 -->
|
3
3
|
<interface>
|
4
4
|
<requires lib="gtk+" version="3.0"/>
|
5
5
|
<object class="GtkWindow" id="main_app">
|
6
6
|
<property name="can_focus">False</property>
|
7
|
+
<child type="titlebar">
|
8
|
+
<placeholder/>
|
9
|
+
</child>
|
7
10
|
<child>
|
8
11
|
<object class="GtkBox" id="vbox1">
|
9
12
|
<property name="visible">True</property>
|
@@ -135,14 +138,7 @@
|
|
135
138
|
</object>
|
136
139
|
</child>
|
137
140
|
<child type="tab">
|
138
|
-
<
|
139
|
-
<property name="visible">True</property>
|
140
|
-
<property name="can_focus">False</property>
|
141
|
-
<property name="label" translatable="yes">label</property>
|
142
|
-
</object>
|
143
|
-
<packing>
|
144
|
-
<property name="tab_fill">False</property>
|
145
|
-
</packing>
|
141
|
+
<placeholder/>
|
146
142
|
</child>
|
147
143
|
<child>
|
148
144
|
<object class="GtkScrolledWindow" id="scrolledwindow4">
|
@@ -165,15 +161,7 @@
|
|
165
161
|
</packing>
|
166
162
|
</child>
|
167
163
|
<child type="tab">
|
168
|
-
<
|
169
|
-
<property name="visible">True</property>
|
170
|
-
<property name="can_focus">False</property>
|
171
|
-
<property name="label" translatable="yes">label</property>
|
172
|
-
</object>
|
173
|
-
<packing>
|
174
|
-
<property name="position">1</property>
|
175
|
-
<property name="tab_fill">False</property>
|
176
|
-
</packing>
|
164
|
+
<placeholder/>
|
177
165
|
</child>
|
178
166
|
</object>
|
179
167
|
<packing>
|
@@ -228,8 +216,5 @@
|
|
228
216
|
</child>
|
229
217
|
</object>
|
230
218
|
</child>
|
231
|
-
<child type="titlebar">
|
232
|
-
<placeholder/>
|
233
|
-
</child>
|
234
219
|
</object>
|
235
220
|
</interface>
|
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
<para>
|
20
20
|
Smart Libraries are listed beneath the actual libraries in the
|
21
|
-
application
|
21
|
+
application sidepane. They do not actually contain books, but
|
22
22
|
rather a set of rules describing which books you wish to see. The
|
23
23
|
books from all libraries which satisfy the set of rules will be
|
24
24
|
displayed. You cannot directly add books to a Smart Library.
|
@@ -58,7 +58,7 @@
|
|
58
58
|
<para>
|
59
59
|
An example will illustrate the use of Smart Libraries. Let us
|
60
60
|
suppose you have a large collections of books by Terry
|
61
|
-
|
61
|
+
Pratchett and you add the tag <quote>discworld</quote> to all
|
62
62
|
the books in the Discworld series. Let us create a Smart Library
|
63
63
|
for all his non-Discworld books.
|
64
64
|
</para>
|
@@ -12,7 +12,7 @@
|
|
12
12
|
<para>Books stored in &app; can be grouped into different collections, called libraries. For instance, you may have
|
13
13
|
one library for all your novels, and other for your programming manuals. &app; allows you to create, edit, and move books
|
14
14
|
between libraries.</para>
|
15
|
-
<para>Available libraries are listed in the <guilabel>Library pane</guilabel> at the left of the main &app; window. If you cannot see the library pane, open it with <menuchoice><guimenu>View</guimenu><guimenuitem>
|
15
|
+
<para>Available libraries are listed in the <guilabel>Library pane</guilabel> at the left of the main &app; window. If you cannot see the library pane, open it with <menuchoice><guimenu>View</guimenu><guimenuitem>Sidepane</guimenuitem></menuchoice>. You can close it again with the same menu option, or by clicking the <guibutton>Close</guibutton> icon in the top right of the library pane.</para>
|
16
16
|
<figure id="library-pane-fig">
|
17
17
|
<title>An &app; list of libraries</title>
|
18
18
|
<screenshot>
|
@@ -1240,7 +1240,7 @@ Date : 30 décembre 2005
|
|
1240
1240
|
open it with
|
1241
1241
|
<menuchoice>
|
1242
1242
|
<guimenu>View</guimenu>
|
1243
|
-
<guimenuitem>
|
1243
|
+
<guimenuitem>Sidepane</guimenuitem>
|
1244
1244
|
</menuchoice>.
|
1245
1245
|
You can close it again with the same menu option, or by clicking
|
1246
1246
|
the <guibutton>Close</guibutton> icon in the top right of the
|
@@ -0,0 +1,160 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file is part of Alexandria.
|
4
|
+
#
|
5
|
+
# See the file README.md for authorship and licensing information.
|
6
|
+
|
7
|
+
require "spec_helper"
|
8
|
+
|
9
|
+
RSpec.describe Alexandria::BookProviders::WorldCatProvider do
|
10
|
+
let(:sky_catalog_main) do
|
11
|
+
<<~XHTML
|
12
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
13
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
|
14
|
+
<head></head>
|
15
|
+
<body id="worldcat">
|
16
|
+
<table class="table-results">
|
17
|
+
<tr class="menuElem">
|
18
|
+
<td class="result details">
|
19
|
+
<div class="name">
|
20
|
+
<a id="result-1" href="/title/sky-catalogue-20000-ed-by-alan-hirshfeld-and-roger-w-sinnott/oclc/476534140&referer=brief_results"><strong>Sky catalogue 2000.0 ed. by Alan Hirshfeld and Roger W. Sinnott</strong></a>
|
21
|
+
</div>
|
22
|
+
<div class="type">
|
23
|
+
<img class='icn' src='https://static1.worldcat.org/wcpa/rel20201014/images/icon-bks.gif' alt=' ' height='16' width='16' /> <span class='itemType'>Print book</span>
|
24
|
+
</div>
|
25
|
+
</td>
|
26
|
+
</tr>
|
27
|
+
<tr class="menuElem">
|
28
|
+
<td class="result details">
|
29
|
+
<div class="name">
|
30
|
+
<a id="result-2" href="/title/sky-catalogue-20000/oclc/7978015&referer=brief_results"><strong>Sky catalogue 2000.0</strong></a>
|
31
|
+
</div>
|
32
|
+
<div class="type">
|
33
|
+
<img class='icn' src='https://static1.worldcat.org/wcpa/rel20201014/images/icon-bks.gif' alt=' ' height='16' width='16' /> <span class='itemType'>Print book</span>
|
34
|
+
</div>
|
35
|
+
</td>
|
36
|
+
</tr>
|
37
|
+
</table>
|
38
|
+
</body>
|
39
|
+
</html>
|
40
|
+
XHTML
|
41
|
+
end
|
42
|
+
|
43
|
+
let(:sky_catalog_details) do
|
44
|
+
<<~XHTML
|
45
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
46
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
|
47
|
+
<head></head>
|
48
|
+
<body id="worldcat">
|
49
|
+
<div id="bibdata">
|
50
|
+
<h1 class="title">Sky catalogue 2000.0 ed. by Alan Hirshfeld and Roger W. Sinnott</h1>
|
51
|
+
<table border="0" cellspacing="0" cellpadding="0">
|
52
|
+
<tr id="bib-author-row">
|
53
|
+
<th>Author:</th>
|
54
|
+
<td id="bib-author-cell">
|
55
|
+
<a href='/search?q=au%3AHirshfeld+Alan&qt=hot_author' title='Search for more by this author'>Hirshfeld Alan</a>;
|
56
|
+
<a href='/search?q=au%3ASinnott+Roger+W.&qt=hot_author' title='Search for more by this author'>Sinnott Roger W.</a>;
|
57
|
+
<a href='/search?q=au%3ACambridge+Cambridge+University+Press+1982-&qt=hot_author' title='Search for more by this author'>Cambridge Cambridge University Press 1982-</a>
|
58
|
+
</td>
|
59
|
+
</tr>
|
60
|
+
<tr id="bib-publisher-row">
|
61
|
+
<th>Publisher:</th>
|
62
|
+
<td id="bib-publisher-cell">1982</td>
|
63
|
+
</tr>
|
64
|
+
</table>
|
65
|
+
</div>
|
66
|
+
<table border="0" cellspacing="0">
|
67
|
+
<tr id="details-allauthors">
|
68
|
+
<th>All Authors / Contributors:</th>
|
69
|
+
<td>
|
70
|
+
<a href='/search?q=au%3AHirshfeld+Alan&qt=hot_author' title='Search for more by this author'>Hirshfeld Alan</a>;
|
71
|
+
<a href='/search?q=au%3ASinnott+Roger+W.&qt=hot_author' title='Search for more by this author'>Sinnott Roger W.</a>;
|
72
|
+
<a href='/search?q=au%3ACambridge+Cambridge+University+Press+1982-&qt=hot_author' title='Search for more by this author'>Cambridge Cambridge University Press 1982-</a>
|
73
|
+
</td>
|
74
|
+
</tr>
|
75
|
+
<tr id="details-standardno">
|
76
|
+
<th>ISBN:</th>
|
77
|
+
<td>0521247101 9780521247108 0521289130 9780521289139 0521258189 9780521258180</td>
|
78
|
+
</tr>
|
79
|
+
</table>
|
80
|
+
</body>
|
81
|
+
</html>
|
82
|
+
XHTML
|
83
|
+
end
|
84
|
+
|
85
|
+
let(:florence_ru_details) do
|
86
|
+
<<~XHTML
|
87
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
88
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
|
89
|
+
<head></head>
|
90
|
+
<body id="worldcat">
|
91
|
+
<div id="bibdata">
|
92
|
+
<h1 class="title">
|
93
|
+
<div class="vernacular" lang="ru">Флоренс Аравийская : роман /</div>
|
94
|
+
Florens Araviĭskai︠a︡ : roman
|
95
|
+
</h1>
|
96
|
+
<table border="0" cellspacing="0" cellpadding="0">
|
97
|
+
<tr id="bib-author-row">
|
98
|
+
<th>Author:</th>
|
99
|
+
<td id="bib-author-cell">
|
100
|
+
<span class="vernacular" lang="ru">Кристофер Бакли ; перевод с английского Андрея Геласимова.</span>
|
101
|
+
<span class="vernacular" lang="ru">Геласимов, Андрей.</span> ;
|
102
|
+
<a href="/search?q=au%3ABuckley%2C+Christopher%2C&qt=hot_author" title="Search for more by this author">Christopher Buckley</a>;
|
103
|
+
<a href="/search?q=au%3AGelasimov%2C+Andrei%CC%86.&qt=hot_author" title="Search for more by this author">Andreĭ Gelasimov</a>
|
104
|
+
</td>
|
105
|
+
</tr>
|
106
|
+
<tr id="bib-publisher-row">
|
107
|
+
<th>Publisher:</th>
|
108
|
+
<td id="bib-publisher-cell"><span class="vernacular" lang="ru">Иностранка,</span>
|
109
|
+
Moskva : Inostranka, 2006.
|
110
|
+
</td>
|
111
|
+
</tr>
|
112
|
+
</table>
|
113
|
+
</div>
|
114
|
+
<table border="0" cellspacing="0">
|
115
|
+
<tr id="details-allauthors">
|
116
|
+
<th>All Authors / Contributors:</th>
|
117
|
+
<td>
|
118
|
+
<span class="vernacular" lang="ru">Кристофер Бакли ; перевод с английского Андрея Геласимова.</span>
|
119
|
+
<span class="vernacular" lang="ru">Геласимов, Андрей.</span> ;
|
120
|
+
<a href="/search?q=au%3ABuckley%2C+Christopher%2C&qt=hot_author" title="Search for more by this author">Christopher Buckley</a>;
|
121
|
+
<a href="/search?q=au%3AGelasimov%2C+Andrei%CC%86.&qt=hot_author" title="Search for more by this author">Andreĭ Gelasimov</a>
|
122
|
+
</td>
|
123
|
+
</tr>
|
124
|
+
<tr id="details-standardno">
|
125
|
+
<th>ISBN:</th>
|
126
|
+
<td>5941454139 9785941454136</td>
|
127
|
+
</tr>
|
128
|
+
</table>
|
129
|
+
</body>
|
130
|
+
</html>
|
131
|
+
XHTML
|
132
|
+
end
|
133
|
+
|
134
|
+
it "works for an isbn with multiple results" do
|
135
|
+
stub_request(:get, "https://www.worldcat.org/search?q=isbn:9780521247108&qt=advanced")
|
136
|
+
.to_return(status: 200, body: +sky_catalog_main, headers: {})
|
137
|
+
stub_request(:get,
|
138
|
+
"https://www.worldcat.org/title/" \
|
139
|
+
"sky-catalogue-20000-ed-by-alan-hirshfeld-and-roger-w-sinnott" \
|
140
|
+
"/oclc/476534140&referer=brief_results")
|
141
|
+
.to_return(status: 200, body: +sky_catalog_details, headers: {})
|
142
|
+
assert_correct_search_result(described_class, "9780521247108")
|
143
|
+
end
|
144
|
+
|
145
|
+
it "works with vernacular" do
|
146
|
+
stub_request(:get, "https://www.worldcat.org/search?q=isbn:9785941454136&qt=advanced")
|
147
|
+
.to_return(status: 200, body: +florence_ru_details, headers: {})
|
148
|
+
assert_correct_search_result(described_class, "9785941454136")
|
149
|
+
end
|
150
|
+
|
151
|
+
it "works with multiple authors" do
|
152
|
+
stub_request(:get, "https://www.worldcat.org/search?q=isbn:9785941454136&qt=advanced")
|
153
|
+
.to_return(status: 200, body: +florence_ru_details, headers: {})
|
154
|
+
results = assert_correct_search_result(described_class,
|
155
|
+
"9785941454136")
|
156
|
+
this_book = results.first
|
157
|
+
expect(this_book.authors).to be_instance_of(Array), "Not an array!"
|
158
|
+
expect(this_book.authors.length).to eq(2), "Wrong number of authors for this book!"
|
159
|
+
end
|
160
|
+
end
|
@@ -9,157 +9,101 @@ require "spec_helper"
|
|
9
9
|
describe Alexandria::BookProviders do
|
10
10
|
it "should be less clever"
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
rescue SocketError
|
17
|
-
skip "Service is offline"
|
18
|
-
end
|
19
|
-
|
20
|
-
puts results.inspect if $DEBUG
|
21
|
-
|
22
|
-
expect(results).to be_instance_of(Array), "Results are not an array for #{provider}"
|
23
|
-
expect(results).not_to be_empty, "Results are empty for #{provider}"
|
24
|
-
|
25
|
-
if search_type == Alexandria::BookProviders::SEARCH_BY_ISBN
|
26
|
-
expect(results.length).to be <= 2, "Results are greater than 2 for #{provider}"
|
27
|
-
|
28
|
-
book = results.first
|
29
|
-
|
30
|
-
expect(book).to be_instance_of(Alexandria::Book),
|
31
|
-
"Result is not a Book for #{provider}"
|
32
|
-
|
33
|
-
canonical_query = Alexandria::Library.canonicalise_ean(query)
|
34
|
-
canonical_result = Alexandria::Library.canonicalise_ean(book.isbn)
|
35
|
-
expect(canonical_query)
|
36
|
-
.to eq(canonical_result),
|
37
|
-
"Result's isbn #{book.isbn} is not equivalent" \
|
38
|
-
" to the requested isbn #{query} for #{provider}"
|
39
|
-
|
40
|
-
if results.length == 2
|
41
|
-
cover_url = results.last
|
42
|
-
if cover_url
|
43
|
-
expect(cover_url)
|
44
|
-
.to be_instance_of(String),
|
45
|
-
"Unexpected cover_url #{cover_url.inspect} for #{provider}"
|
46
|
-
end
|
47
|
-
end
|
48
|
-
else
|
49
|
-
expect(results.first.first)
|
50
|
-
.to be_instance_of(Alexandria::Book), "Result item is not a Book for #{provider}"
|
51
|
-
end
|
52
|
-
results
|
53
|
-
end
|
12
|
+
describe Alexandria::BookProviders::AmazonProvider do
|
13
|
+
before do
|
14
|
+
skip "Amazon requires an API key. Remove it altogether as a provider?"
|
15
|
+
end
|
54
16
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
"033025068X")
|
59
|
-
end
|
17
|
+
it "does not piss off Rich Burridge" do
|
18
|
+
assert_correct_search_result(described_class, "033025068X")
|
19
|
+
end
|
60
20
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
"9780385504201")
|
65
|
-
end
|
21
|
+
it "works" do
|
22
|
+
assert_correct_search_result(described_class, "9780385504201")
|
23
|
+
end
|
66
24
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
Alexandria::BookProviders::SEARCH_BY_TITLE)
|
72
|
-
end
|
25
|
+
it "works when searching for title" do
|
26
|
+
assert_correct_search_result(described_class, "A Confederacy of Dunces",
|
27
|
+
Alexandria::BookProviders::SEARCH_BY_TITLE)
|
28
|
+
end
|
73
29
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
Alexandria::BookProviders::SEARCH_BY_AUTHORS)
|
79
|
-
end
|
30
|
+
it "amazon authors should work" do
|
31
|
+
assert_correct_search_result(described_class, "John Kennedy Toole",
|
32
|
+
Alexandria::BookProviders::SEARCH_BY_AUTHORS)
|
33
|
+
end
|
80
34
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
Alexandria::BookProviders::SEARCH_BY_KEYWORD)
|
35
|
+
it "amazon keyword should work" do
|
36
|
+
assert_correct_search_result(described_class, "Confederacy Dunces",
|
37
|
+
Alexandria::BookProviders::SEARCH_BY_KEYWORD)
|
38
|
+
end
|
86
39
|
end
|
87
40
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
assert_correct_search_result(Alexandria::BookProviders::LOCProvider,
|
93
|
-
"9782070379248")
|
94
|
-
end
|
41
|
+
describe Alexandria::BookProviders::LOCProvider do
|
42
|
+
it "works for a book with ASCII title" do
|
43
|
+
assert_correct_search_result(described_class, "9780805335583")
|
44
|
+
end
|
95
45
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
"9781853260803")
|
46
|
+
it "works for a book with a title with non-ASCII letters" do
|
47
|
+
assert_correct_search_result(described_class, "9782070379248")
|
48
|
+
end
|
100
49
|
end
|
101
50
|
|
102
|
-
|
103
|
-
|
104
|
-
|
51
|
+
describe Alexandria::BookProviders::BLProvider do
|
52
|
+
it "works" do
|
53
|
+
skip "Not working: connect failed"
|
54
|
+
assert_correct_search_result(described_class, "9781853260803")
|
55
|
+
end
|
105
56
|
end
|
106
57
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
58
|
+
describe Alexandria::BookProviders::SBNProvider do
|
59
|
+
it "works" do
|
60
|
+
assert_correct_search_result(described_class, "9788835926436")
|
61
|
+
end
|
111
62
|
end
|
112
63
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
"9780586071403")
|
64
|
+
describe Alexandria::BookProviders::BarnesAndNobleProvider do
|
65
|
+
it "works" do
|
66
|
+
skip "Barnes and Noble is not operational at the moment"
|
67
|
+
assert_correct_search_result(described_class, "9780961328917") # see #1433
|
68
|
+
end
|
119
69
|
end
|
120
70
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
assert_correct_search_result(Alexandria::BookProviders::ThaliaProvider,
|
128
|
-
"9780440241904")
|
129
|
-
# movie dvd
|
130
|
-
assert_correct_search_result(Alexandria::BookProviders::ThaliaProvider,
|
131
|
-
"4010232037824")
|
132
|
-
# music cd
|
133
|
-
assert_correct_search_result(Alexandria::BookProviders::ThaliaProvider,
|
134
|
-
"0094638203520")
|
71
|
+
describe Alexandria::BookProviders::ProxisProvider do
|
72
|
+
it "works" do
|
73
|
+
skip "Needs fixing"
|
74
|
+
assert_correct_search_result(described_class, "9789026965746")
|
75
|
+
assert_correct_search_result(described_class, "9780586071403")
|
76
|
+
end
|
135
77
|
end
|
136
78
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
end
|
79
|
+
describe Alexandria::BookProviders::ThaliaProvider do
|
80
|
+
before do
|
81
|
+
skip "Needs fixing"
|
82
|
+
end
|
142
83
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
84
|
+
it "works" do
|
85
|
+
# german book
|
86
|
+
assert_correct_search_result(described_class, "9783896673305")
|
87
|
+
# international book
|
88
|
+
assert_correct_search_result(described_class, "9780440241904")
|
89
|
+
# movie dvd
|
90
|
+
assert_correct_search_result(described_class, "4010232037824")
|
91
|
+
# music cd
|
92
|
+
assert_correct_search_result(described_class, "0094638203520")
|
93
|
+
end
|
147
94
|
end
|
148
95
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
"9785941454136")
|
96
|
+
describe Alexandria::BookProviders::AdLibrisProvider do
|
97
|
+
it "works" do
|
98
|
+
skip "Needs fixing: site has changed"
|
99
|
+
assert_correct_search_result(described_class, "9789100109332")
|
100
|
+
end
|
155
101
|
end
|
156
102
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
# puts this_book.authors
|
163
|
-
expect(this_book.authors.length).to eq(2), "Wrong number of authors for this book!"
|
103
|
+
describe Alexandria::BookProviders::SicilianoProvider do
|
104
|
+
it "works" do
|
105
|
+
skip "Needs fixing: no results found"
|
106
|
+
assert_correct_search_result(described_class, "9788599170380")
|
107
|
+
end
|
164
108
|
end
|
165
109
|
end
|