alexandria-book-collection-manager 0.7.3 → 0.7.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +9 -0
  3. data/.github/workflows/ruby.yml +77 -0
  4. data/.gitignore +4 -1
  5. data/.rubocop.yml +86 -36
  6. data/.rubocop_todo.yml +58 -161
  7. data/.simplecov +5 -2
  8. data/CHANGELOG.md +56 -2
  9. data/Gemfile +4 -3
  10. data/INSTALL.md +23 -11
  11. data/README.md +52 -41
  12. data/Rakefile +78 -75
  13. data/alexandria-book-collection-manager.gemspec +50 -44
  14. data/bin/alexandria +12 -22
  15. data/doc/FAQ +1 -2
  16. data/doc/dependency_decisions.yml +27 -8
  17. data/lib/alexandria.rb +25 -23
  18. data/lib/alexandria/about.rb +50 -50
  19. data/lib/alexandria/book_providers.rb +86 -91
  20. data/lib/alexandria/book_providers/adlibris.rb +37 -74
  21. data/lib/alexandria/book_providers/amazon_aws.rb +94 -100
  22. data/lib/alexandria/book_providers/amazon_ecs_util.rb +289 -324
  23. data/lib/alexandria/book_providers/barnes_and_noble.rb +42 -42
  24. data/lib/alexandria/book_providers/douban.rb +25 -41
  25. data/lib/alexandria/book_providers/proxis.rb +34 -29
  26. data/lib/alexandria/book_providers/pseudomarc.rb +77 -85
  27. data/lib/alexandria/book_providers/siciliano.rb +60 -64
  28. data/lib/alexandria/book_providers/thalia_provider.rb +161 -0
  29. data/lib/alexandria/book_providers/web.rb +5 -5
  30. data/lib/alexandria/book_providers/worldcat.rb +66 -95
  31. data/lib/alexandria/book_providers/z3950.rb +153 -169
  32. data/lib/alexandria/config.rb +1 -1
  33. data/lib/alexandria/console.rb +3 -3
  34. data/lib/alexandria/default_preferences.rb +37 -0
  35. data/lib/alexandria/execution_queue.rb +13 -12
  36. data/lib/alexandria/export_format.rb +8 -8
  37. data/lib/alexandria/export_library.rb +128 -127
  38. data/lib/alexandria/import_library.rb +102 -126
  39. data/lib/alexandria/import_library_csv.rb +41 -41
  40. data/lib/alexandria/library_collection.rb +6 -5
  41. data/lib/alexandria/library_sort_order.rb +4 -2
  42. data/lib/alexandria/library_store.rb +39 -28
  43. data/lib/alexandria/logging.rb +10 -14
  44. data/lib/alexandria/models/book.rb +5 -4
  45. data/lib/alexandria/models/library.rb +63 -53
  46. data/lib/alexandria/net.rb +5 -6
  47. data/lib/alexandria/preferences.rb +66 -63
  48. data/lib/alexandria/scanners.rb +2 -2
  49. data/lib/alexandria/scanners/{cuecat.rb → cue_cat.rb} +17 -17
  50. data/lib/alexandria/scanners/keyboard.rb +8 -8
  51. data/lib/alexandria/smart_library.rb +110 -112
  52. data/lib/alexandria/ui.rb +15 -15
  53. data/lib/alexandria/ui/{dialogs/about_dialog.rb → about_dialog.rb} +2 -2
  54. data/lib/alexandria/ui/{dialogs/acquire_dialog.rb → acquire_dialog.rb} +108 -109
  55. data/lib/alexandria/ui/alert_dialog.rb +66 -0
  56. data/lib/alexandria/ui/{dialogs/bad_isbns_dialog.rb → bad_isbns_dialog.rb} +13 -9
  57. data/lib/alexandria/ui/{dialogs/barcode_animation.rb → barcode_animation.rb} +16 -15
  58. data/lib/alexandria/ui/{dialogs/book_properties_dialog.rb → book_properties_dialog.rb} +25 -38
  59. data/lib/alexandria/ui/{dialogs/book_properties_dialog_base.rb → book_properties_dialog_base.rb} +64 -157
  60. data/lib/alexandria/ui/builder_base.rb +1 -1
  61. data/lib/alexandria/ui/calendar_popup.rb +58 -0
  62. data/lib/alexandria/ui/callbacks.rb +187 -155
  63. data/lib/alexandria/ui/completion_models.rb +8 -22
  64. data/lib/alexandria/ui/confirm_erase_dialog.rb +33 -0
  65. data/lib/alexandria/ui/conflict_while_copying_dialog.rb +34 -0
  66. data/lib/alexandria/ui/dndable.rb +7 -7
  67. data/lib/alexandria/ui/error_dialog.rb +25 -0
  68. data/lib/alexandria/ui/{dialogs/export_dialog.rb → export_dialog.rb} +37 -58
  69. data/lib/alexandria/ui/icons.rb +38 -43
  70. data/lib/alexandria/ui/iconview.rb +12 -10
  71. data/lib/alexandria/ui/iconview_tooltips.rb +41 -54
  72. data/lib/alexandria/ui/import_dialog.rb +157 -0
  73. data/lib/alexandria/ui/init.rb +30 -41
  74. data/lib/alexandria/ui/{dialogs/keep_bad_isbn_dialog.rb → keep_bad_isbn_dialog.rb} +9 -6
  75. data/lib/alexandria/ui/libraries_combo.rb +15 -14
  76. data/lib/alexandria/ui/listview.rb +69 -67
  77. data/lib/alexandria/ui/main_app.rb +24 -26
  78. data/lib/alexandria/ui/misc_dialogs.rb +10 -0
  79. data/lib/alexandria/ui/multi_drag_treeview.rb +8 -9
  80. data/lib/alexandria/ui/{dialogs/new_book_dialog.rb → new_book_dialog.rb} +113 -114
  81. data/lib/alexandria/ui/{dialogs/new_book_dialog_manual.rb → new_book_dialog_manual.rb} +22 -19
  82. data/lib/alexandria/ui/new_provider_dialog.rb +100 -0
  83. data/lib/alexandria/ui/new_smart_library_dialog.rb +74 -0
  84. data/lib/alexandria/ui/preferences_dialog.rb +313 -0
  85. data/lib/alexandria/ui/provider_preferences_base_dialog.rb +95 -0
  86. data/lib/alexandria/ui/provider_preferences_dialog.rb +35 -0
  87. data/lib/alexandria/ui/{dialogs/misc_dialogs.rb → really_delete_dialog.rb} +7 -28
  88. data/lib/alexandria/ui/{sidepane.rb → sidepane_manager.rb} +53 -48
  89. data/lib/alexandria/ui/skip_entry_dialog.rb +33 -0
  90. data/lib/alexandria/ui/smart_library_properties_dialog.rb +60 -0
  91. data/lib/alexandria/ui/smart_library_properties_dialog_base.rb +242 -0
  92. data/lib/alexandria/ui/smart_library_rule_box.rb +119 -0
  93. data/lib/alexandria/ui/sound.rb +11 -13
  94. data/lib/alexandria/ui/ui_manager.rb +216 -200
  95. data/lib/alexandria/version.rb +4 -19
  96. data/lib/alexandria/web_themes.rb +21 -21
  97. data/po/Makefile +2 -2
  98. data/po/cs.po +992 -875
  99. data/po/cy.po +961 -874
  100. data/po/de.po +990 -865
  101. data/po/el.po +989 -865
  102. data/po/es.po +985 -861
  103. data/po/fr.po +987 -867
  104. data/po/ga.po +908 -820
  105. data/po/gl.po +980 -860
  106. data/po/it.po +986 -864
  107. data/po/ja.po +969 -849
  108. data/po/mk.po +984 -860
  109. data/po/nb.po +979 -859
  110. data/po/nl.po +983 -860
  111. data/po/pl.po +1018 -971
  112. data/po/pt.po +988 -857
  113. data/po/pt_BR.po +983 -863
  114. data/po/ru.po +994 -871
  115. data/po/sk.po +989 -867
  116. data/po/sv.po +976 -856
  117. data/po/uk.po +972 -858
  118. data/po/zh_TW.po +974 -854
  119. data/schemas/alexandria.schemas +24 -2
  120. data/share/alexandria/glade/acquire_dialog__builder.glade +1 -1
  121. data/share/alexandria/glade/book_properties_dialog__builder.glade +1 -1
  122. data/share/alexandria/glade/main_app__builder.glade +6 -21
  123. data/share/alexandria/glade/new_book_dialog__builder.glade +1 -1
  124. data/share/alexandria/glade/preferences_dialog__builder.glade +1 -1
  125. data/share/gnome/help/alexandria/C/introduction.xml +0 -4
  126. data/share/gnome/help/alexandria/C/searching.xml +1 -1
  127. data/share/gnome/help/alexandria/C/smart-libraries.xml +2 -2
  128. data/share/gnome/help/alexandria/C/working-with-libraries.xml +1 -1
  129. data/share/gnome/help/alexandria/fr/alexandria.xml +1 -1
  130. data/share/gnome/help/alexandria/ja/introduction.xml +0 -4
  131. data/share/gnome/help/alexandria/ja/smart-libraries.xml +1 -1
  132. data/spec/alexandria/book_providers/thalia_provider_spec.rb +119 -0
  133. data/spec/alexandria/book_providers/world_cat_provider_spec.rb +160 -0
  134. data/spec/alexandria/book_providers_spec.rb +62 -156
  135. data/spec/alexandria/book_spec.rb +12 -10
  136. data/spec/alexandria/console_spec.rb +6 -11
  137. data/spec/alexandria/export_library_spec.rb +47 -58
  138. data/spec/alexandria/library_spec.rb +121 -109
  139. data/spec/alexandria/library_store_spec.rb +8 -8
  140. data/spec/alexandria/preferences_spec.rb +44 -17
  141. data/spec/alexandria/scanners/cue_cat_spec.rb +52 -0
  142. data/spec/alexandria/smart_library_spec.rb +15 -15
  143. data/spec/alexandria/ui/about_dialog_spec.rb +14 -0
  144. data/spec/alexandria/ui/acquire_dialog_spec.rb +14 -0
  145. data/spec/alexandria/ui/alert_dialog_spec.rb +16 -0
  146. data/spec/alexandria/ui/bad_isbns_dialog_spec.rb +14 -0
  147. data/spec/alexandria/ui/book_properties_dialog_spec.rb +59 -0
  148. data/spec/alexandria/ui/confirm_erase_dialog_spec.rb +14 -0
  149. data/spec/alexandria/ui/conflict_while_copying_dialog_spec.rb +16 -0
  150. data/spec/alexandria/ui/error_dialog_spec.rb +14 -0
  151. data/spec/alexandria/ui/export_dialog_spec.rb +36 -0
  152. data/spec/alexandria/ui/icons_spec.rb +26 -0
  153. data/spec/alexandria/ui/iconview_spec.rb +7 -21
  154. data/spec/alexandria/ui/import_dialog_spec.rb +46 -0
  155. data/spec/alexandria/ui/keep_bad_isbn_dialog_spec.rb +17 -0
  156. data/spec/alexandria/ui/main_app_spec.rb +7 -34
  157. data/spec/alexandria/ui/new_book_dialog_manual_spec.rb +51 -0
  158. data/spec/alexandria/ui/{dialogs/new_book_dialog_spec.rb → new_book_dialog_spec.rb} +4 -4
  159. data/spec/alexandria/ui/new_provider_dialog_spec.rb +30 -0
  160. data/spec/alexandria/ui/new_smart_library_dialog_spec.rb +39 -0
  161. data/spec/alexandria/ui/preferences_dialog_spec.rb +14 -0
  162. data/spec/alexandria/ui/provider_preferences_dialog_spec.rb +34 -0
  163. data/spec/alexandria/ui/really_delete_dialog_spec.rb +16 -0
  164. data/spec/alexandria/ui/sidepane_manager_spec.rb +15 -0
  165. data/spec/alexandria/ui/skip_entry_dialog_spec.rb +14 -0
  166. data/spec/alexandria/ui/smart_library_properties_dialog_spec.rb +49 -0
  167. data/spec/alexandria/ui/sound_spec.rb +2 -2
  168. data/spec/alexandria/ui/ui_manager_spec.rb +44 -20
  169. data/spec/end_to_end/basic_run_spec.rb +21 -38
  170. data/spec/fixtures/cover.jpg +0 -0
  171. data/spec/spec_helper.rb +54 -10
  172. data/tasks/setup.rb +2 -2
  173. data/tasks/spec.rake +11 -11
  174. data/util/rake/fileinstall.rb +38 -35
  175. data/util/rake/gettextgenerate.rb +7 -7
  176. data/util/rake/omfgenerate.rb +7 -7
  177. metadata +158 -45
  178. data/dogtail/basic_run_test.py +0 -9
  179. data/lib/alexandria/book_providers/renaud.rb +0 -155
  180. data/lib/alexandria/book_providers/thalia.rb +0 -198
  181. data/lib/alexandria/ui/dialogs/alert_dialog.rb +0 -63
  182. data/lib/alexandria/ui/dialogs/import_dialog.rb +0 -176
  183. data/lib/alexandria/ui/dialogs/new_smart_library_dialog.rb +0 -62
  184. data/lib/alexandria/ui/dialogs/preferences_dialog.rb +0 -563
  185. data/lib/alexandria/ui/dialogs/smart_library_properties_dialog.rb +0 -61
  186. data/lib/alexandria/ui/dialogs/smart_library_properties_dialog_base.rb +0 -423
  187. data/spec/alexandria/scanners/cuecat_spec.rb +0 -67
  188. data/spec/alexandria/ui/dialogs_spec.rb +0 -162
  189. data/spec/alexandria/ui/sidepane_spec.rb +0 -29
  190. data/spec/alexandria/ui/ui_utilities_spec.rb +0 -62
  191. data/spec/alexandria/utilities_spec.rb +0 -52
  192. data/tasks/dogtail.rake +0 -6
@@ -203,7 +203,7 @@
203
203
  <long>Whether the publisher column should be visible in the list view.</long>
204
204
  </locale>
205
205
  </schema>
206
- <schema>
206
+ <schema>
207
207
  <key>/schemas/apps/alexandria/col_publish_date_visible</key>
208
208
  <applyto>/apps/alexandria/col_publish_date_visible</applyto>
209
209
  <owner>alexandria</owner>
@@ -214,6 +214,17 @@
214
214
  <long>Whether the publish date column should be visible in the list view.</long>
215
215
  </locale>
216
216
  </schema>
217
+ <schema>
218
+ <key>/schemas/apps/alexandria/col_loaned_to_visible</key>
219
+ <applyto>/apps/alexandria/col_loaned_to_visible</applyto>
220
+ <owner>alexandria</owner>
221
+ <type>bool</type>
222
+ <default>true</default>
223
+ <locale name="C">
224
+ <short>Loaned to visibility</short>
225
+ <long>Whether the loaned to column should be visible in the list view.</long>
226
+ </locale>
227
+ </schema>
217
228
  <schema>
218
229
  <key>/schemas/apps/alexandria/col_rating_visible</key>
219
230
  <applyto>/apps/alexandria/col_rating_visible</applyto>
@@ -247,7 +258,7 @@
247
258
  <long>Whether the own column should be visible in the list view.</long>
248
259
  </locale>
249
260
  </schema>
250
- <schema>
261
+ <schema>
251
262
  <key>/schemas/apps/alexandria/col_want_visible</key>
252
263
  <applyto>/apps/alexandria/col_want_visible</applyto>
253
264
  <owner>alexandria</owner>
@@ -258,6 +269,17 @@
258
269
  <long>Whether the want column should be visible in the list view.</long>
259
270
  </locale>
260
271
  </schema>
272
+ <schema>
273
+ <key>/schemas/apps/alexandria/col_tags_visible</key>
274
+ <applyto>/apps/alexandria/col_tags_visible</applyto>
275
+ <owner>alexandria</owner>
276
+ <type>bool</type>
277
+ <default>true</default>
278
+ <locale name="C">
279
+ <short>Tags column visibility</short>
280
+ <long>Whether the tags column should be visible in the list view.</long>
281
+ </locale>
282
+ </schema>
261
283
  <schema>
262
284
  <key>/schemas/apps/alexandria/cols_width</key>
263
285
  <applyto>/apps/alexandria/cols_width</applyto>
@@ -3,7 +3,7 @@
3
3
  <interface>
4
4
  <requires lib="gtk+" version="3.0"/>
5
5
  <object class="GtkDialog" id="acquire_dialog">
6
- <property name="visible">True</property>
6
+ <property name="visible">False</property>
7
7
  <property name="can_focus">False</property>
8
8
  <property name="border_width">6</property>
9
9
  <property name="title" translatable="yes">Acquire from Scanner</property>
@@ -3,7 +3,7 @@
3
3
  <interface>
4
4
  <requires lib="gtk+" version="3.0"/>
5
5
  <object class="GtkDialog" id="book_properties_dialog">
6
- <property name="visible">True</property>
6
+ <property name="visible">False</property>
7
7
  <property name="can_focus">False</property>
8
8
  <property name="modal">True</property>
9
9
  <property name="type_hint">dialog</property>
@@ -1,9 +1,12 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <!-- Generated with glade 3.22.0 -->
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
- <object class="GtkLabel" id="label2">
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
- <object class="GtkLabel" id="label3">
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>
@@ -26,7 +26,7 @@
26
26
  </data>
27
27
  </object>
28
28
  <object class="GtkDialog" id="new_book_dialog">
29
- <property name="visible">True</property>
29
+ <property name="visible">False</property>
30
30
  <property name="can_focus">False</property>
31
31
  <property name="border_width">8</property>
32
32
  <property name="title" translatable="yes">Adding a Book</property>
@@ -3,7 +3,7 @@
3
3
  <interface>
4
4
  <requires lib="gtk+" version="3.0"/>
5
5
  <object class="GtkDialog" id="preferences_dialog">
6
- <property name="visible">True</property>
6
+ <property name="visible">False</property>
7
7
  <property name="can_focus">False</property>
8
8
  <property name="title" translatable="yes">Preferences</property>
9
9
  <property name="type_hint">dialog</property>
@@ -52,10 +52,6 @@
52
52
  <para><ulink url="http://www.internetbookshop.it">Internet Bookshop Italia</ulink></para>
53
53
  </listitem>
54
54
 
55
- <listitem>
56
- <para><ulink url="http://www.renaud-bray.com/">Renaud-Bray</ulink></para>
57
- </listitem>
58
-
59
55
  <listitem>
60
56
  <para><ulink url="http://www.loc.gov">US Library of Congress</ulink></para>
61
57
  </listitem>
@@ -79,7 +79,7 @@
79
79
  <!-- ========= Finding out more online =========== -->
80
80
  <section id="searching-more-online">
81
81
  <title>Finding out more information about your books online</title>
82
- <para>If you want to find out more information about your book, you can use &app; to open the web page of Amazon, Barnes and Noble, or one of the other online information providers and be taken directly to the relevant book. Simply select the book you wish to know more about, right-click on it, and from the menu <guimenuitem>Display Online Information</guimenuitem>, choose from either Amazon, Barnes and Nobel, Proxis, Spanish Culture Ministry, Amadeus Buch, Renaud-Bray or Internet Bookshop Italia.</para>
82
+ <para>If you want to find out more information about your book, you can use &app; to open the web page of Amazon, Barnes and Noble, or one of the other online information providers and be taken directly to the relevant book. Simply select the book you wish to know more about, right-click on it, and from the menu <guimenuitem>Display Online Information</guimenuitem>, choose from either Amazon, Barnes and Nobel, Proxis, Spanish Culture Ministry, Amadeus Buch or Internet Bookshop Italia.</para>
83
83
  <tip>
84
84
  <para>The <menuchoice><guimenu>Display Online Information</guimenu><guimenuitem>At Amazon</guimenuitem></menuchoice> choice will take you to the Amazon .com, .co.uk, .de, or jp site, as set up in the <xref linkend="alexandria-amazon-prefs"/>.</para>
85
85
  </tip>
@@ -18,7 +18,7 @@
18
18
 
19
19
  <para>
20
20
  Smart Libraries are listed beneath the actual libraries in the
21
- application side pane. They do not actually contain books, but
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
- Practchett and you add the tag <quote>discworld</quote> to all
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>Side Pane</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>
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>Side Pane</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
@@ -44,10 +44,6 @@
44
44
  <para><ulink url="http://www.internetbookshop.it">Internet Bookshop Italia</ulink></para>
45
45
  </listitem>
46
46
 
47
- <listitem>
48
- <para><ulink url="http://www.renaud-bray.com/">Renaud-Bray</ulink></para>
49
- </listitem>
50
-
51
47
  <listitem>
52
48
  <para><ulink url="http://www.loc.gov">米国国会図書館</ulink></para>
53
49
  </listitem>
@@ -44,7 +44,7 @@
44
44
 
45
45
 
46
46
  <para>
47
- 高機能ライブラリの例を以下に示します。Terry Practchettという作者の本をたくさん持っていて、
47
+ 高機能ライブラリの例を以下に示します。Terry Pratchettという作者の本をたくさん持っていて、
48
48
  Discworldシリーズの本に<quote>discworld</quote>というタグをつけてあるとします。
49
49
  高機能ライブラリで、彼のDiscworldシリーズでない本を探してライブラリ化します。
50
50
  </para>
@@ -0,0 +1,119 @@
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::ThaliaProvider do
10
+ let(:normal_people_main) do
11
+ +<<~HTML
12
+ <!DOCTYPE html>
13
+ <html lang="de" data-environment="prod">
14
+ <head>
15
+ <title>Artikel von 0571334652 ansehen | Thalia</title>
16
+ </head>
17
+ <body data-mandant="2" data-version="20201112100740_528b0df" data-environment="prod">
18
+ <main class="suche-grid--main nur-suchergebnis">
19
+ <section class="suchergebnis">
20
+ <ul class="suchergebnis-liste no-bullets">
21
+ <li class="suchergebnis" data-seite="1"
22
+ data-ean="9780571334650"
23
+ data-id="134292338"
24
+ data-preis="9.49"
25
+ data-preis-reduziert="false"
26
+ data-alterpreis="">
27
+ <a href="/shop/home/artikeldetails/ID134292338.html" class="layered-link">Normal People von Sally Rooney</a>
28
+
29
+ <ul class="weitere-formate no-bullets" impression="product-variant">
30
+ <li class="format aktiv">
31
+ <a href="/shop/home/artikeldetails/ID134292338.html">Buch (Taschenbuch)</a>
32
+ </li>
33
+ <li class="format">
34
+ <a href="/shop/home/artikeldetails/ID95227195.html">Weitere: Buch (Taschenbuch)</a>
35
+ </li>
36
+ </ul>
37
+ </li>
38
+ </ul>
39
+ </section>
40
+ </main>
41
+ </body>
42
+ </html>
43
+ HTML
44
+ end
45
+ let(:normal_people_details) do
46
+ +<<~HTML
47
+ <!DOCTYPE html>
48
+ <html class="no-js" id="ID-2" lang="de">
49
+ <head>
50
+ <title>Normal People von Sally Rooney - Taschenbuch - 978-0-571-33465-0 | Thalia</title>
51
+ </head>
52
+ <body>
53
+ <section class="artikel-medien imagesPreview">
54
+ <img src="https://assets.thalia.media/img/artikel/ae9934c90f2c7d595146807ea6253c99532043ec-00-00.jpeg" class='largeImg'>
55
+ </section>
56
+
57
+ <section class="artikel-infos" id="sbe-product-details"
58
+ data-shopid="2"
59
+ data-id="A1051452169"
60
+ data-id-alt="134292338"
61
+ data-titel="Normal People"
62
+ data-verfuegbarkeit="Sofort lieferbar"
63
+ data-preis-netto="9.02"
64
+ data-preis-brutto="9.49"
65
+ data-ean="9780571334650"
66
+ data-reduziert="false"
67
+ data-waehrung="EUR"
68
+ data-preis-liste="9.49"
69
+ data-hersteller="Faber &amp; Faber"
70
+ data-form="Taschenbuch"
71
+ data-verkaufsrang="5"
72
+ data-anzahlbewertungen="19"
73
+ data-durchschnittsbewertung="4.5"
74
+ data-preisbindung="false"
75
+ data-mandant="2"
76
+ data-environment="prod"
77
+ component="artikeldetails-produktdetails">
78
+
79
+ <h1 class="ncTitle">
80
+ Normal People
81
+ </h1>
82
+
83
+ <p class="aim-author">
84
+ <a href="https://www.thalia.de/shop/home/mehr-von-suche/ANY/sp/suche.html?mehrVon=Sally%20Rooney" interaction="autor-klick">Sally Rooney</a>
85
+ </p>
86
+ </section>
87
+
88
+ <section class="artikeldetails">
89
+ <table>
90
+ <tr> <th> Einband </th> <td> Taschenbuch </td> </tr>
91
+ <tr> <th> Erscheinungsdatum </th> <td> 02.05.2019 </td> </tr>
92
+ <tr> <th> ISBN </th> <td> 978-0-571-33465-0 </td> </tr>
93
+ </table>
94
+ <table>
95
+ <tr>
96
+ <th> Verlag </th>
97
+ <td>
98
+ <a href="https://www.thalia.de/shop/home/mehr-von-suche/ANY/sv/suche.html?mehrVon=Faber%20%26%20Faber" interaction="auswahl">
99
+ Faber &amp; Faber
100
+ </a>
101
+ </td>
102
+ </tr>
103
+ </table>
104
+ </section>
105
+ </body>
106
+ </html>
107
+ HTML
108
+ end
109
+
110
+ it "works when searching by ISBN" do
111
+ stub_request(:get,
112
+ "https://www.thalia.de/shop/bde_bu_hg_startseite/suche/?sq=0571334652")
113
+ .to_return(status: 200, body: normal_people_main, headers: {})
114
+ stub_request(:get, "https://www.thalia.de/shop/home/artikeldetails/ID134292338.html")
115
+ .to_return(status: 200, body: normal_people_details, headers: {})
116
+
117
+ assert_correct_search_result(described_class, "9780571334650")
118
+ end
119
+ end
@@ -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' />&nbsp;<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' />&nbsp;<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&amp;qt=hot_author' title='Search for more by this author'>Hirshfeld Alan</a>;
56
+ <a href='/search?q=au%3ASinnott+Roger+W.&amp;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-&amp;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&amp;qt=hot_author' title='Search for more by this author'>Hirshfeld Alan</a>;
71
+ <a href='/search?q=au%3ASinnott+Roger+W.&amp;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-&amp;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&amp;qt=hot_author" title="Search for more by this author">Christopher Buckley</a>;
103
+ <a href="/search?q=au%3AGelasimov%2C+Andrei%CC%86.&amp;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&amp;qt=hot_author" title="Search for more by this author">Christopher Buckley</a>;
121
+ <a href="/search?q=au%3AGelasimov%2C+Andrei%CC%86.&amp;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