alexandria-book-collection-manager 0.7.2 → 0.7.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (200) 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 +5 -1
  5. data/.hound.yml +2 -0
  6. data/.rubocop.yml +87 -37
  7. data/.rubocop_todo.yml +62 -191
  8. data/.simplecov +5 -2
  9. data/CHANGELOG.md +63 -0
  10. data/Gemfile +4 -3
  11. data/INSTALL.md +26 -14
  12. data/README.md +52 -42
  13. data/Rakefile +93 -109
  14. data/TODO.md +9 -1
  15. data/alexandria-book-collection-manager.gemspec +50 -43
  16. data/bin/alexandria +30 -53
  17. data/doc/FAQ +2 -6
  18. data/doc/dependency_decisions.yml +27 -8
  19. data/lib/alexandria.rb +27 -37
  20. data/lib/alexandria/about.rb +50 -50
  21. data/lib/alexandria/book_providers.rb +90 -97
  22. data/lib/alexandria/book_providers/adlibris.rb +41 -76
  23. data/lib/alexandria/book_providers/amazon_aws.rb +96 -100
  24. data/lib/alexandria/book_providers/amazon_ecs_util.rb +295 -322
  25. data/lib/alexandria/book_providers/barnes_and_noble.rb +48 -45
  26. data/lib/alexandria/book_providers/douban.rb +26 -42
  27. data/lib/alexandria/book_providers/proxis.rb +44 -55
  28. data/lib/alexandria/book_providers/pseudomarc.rb +77 -85
  29. data/lib/alexandria/book_providers/siciliano.rb +64 -65
  30. data/lib/alexandria/book_providers/thalia.rb +42 -41
  31. data/lib/alexandria/book_providers/web.rb +15 -33
  32. data/lib/alexandria/book_providers/worldcat.rb +70 -97
  33. data/lib/alexandria/book_providers/z3950.rb +160 -173
  34. data/lib/alexandria/config.rb +1 -1
  35. data/lib/alexandria/console.rb +8 -21
  36. data/lib/alexandria/default_preferences.rb +37 -0
  37. data/lib/alexandria/execution_queue.rb +15 -13
  38. data/lib/alexandria/export_format.rb +47 -0
  39. data/lib/alexandria/export_library.rb +193 -300
  40. data/lib/alexandria/import_library.rb +108 -141
  41. data/lib/alexandria/import_library_csv.rb +43 -46
  42. data/lib/alexandria/library_collection.rb +79 -0
  43. data/lib/alexandria/library_sort_order.rb +45 -0
  44. data/lib/alexandria/library_store.rb +233 -0
  45. data/lib/alexandria/logging.rb +11 -13
  46. data/lib/alexandria/models/book.rb +13 -20
  47. data/lib/alexandria/models/library.rb +81 -353
  48. data/lib/alexandria/net.rb +5 -6
  49. data/lib/alexandria/preferences.rb +73 -87
  50. data/lib/alexandria/scanners.rb +2 -2
  51. data/lib/alexandria/scanners/{cuecat.rb → cue_cat.rb} +20 -18
  52. data/lib/alexandria/scanners/keyboard.rb +8 -8
  53. data/lib/alexandria/smart_library.rb +133 -170
  54. data/lib/alexandria/ui.rb +15 -15
  55. data/lib/alexandria/ui/about_dialog.rb +49 -0
  56. data/lib/alexandria/ui/{dialogs/acquire_dialog.rb → acquire_dialog.rb} +119 -136
  57. data/lib/alexandria/ui/alert_dialog.rb +64 -0
  58. data/lib/alexandria/ui/bad_isbns_dialog.rb +41 -0
  59. data/lib/alexandria/ui/{dialogs/barcode_animation.rb → barcode_animation.rb} +16 -15
  60. data/lib/alexandria/ui/{dialogs/book_properties_dialog.rb → book_properties_dialog.rb} +39 -52
  61. data/lib/alexandria/ui/book_properties_dialog_base.rb +318 -0
  62. data/lib/alexandria/ui/builder_base.rb +7 -27
  63. data/lib/alexandria/ui/calendar_popup.rb +58 -0
  64. data/lib/alexandria/ui/callbacks.rb +189 -183
  65. data/lib/alexandria/ui/completion_models.rb +10 -23
  66. data/lib/alexandria/ui/confirm_erase_dialog.rb +33 -0
  67. data/lib/alexandria/ui/conflict_while_copying_dialog.rb +34 -0
  68. data/lib/alexandria/ui/dndable.rb +7 -7
  69. data/lib/alexandria/ui/error_dialog.rb +25 -0
  70. data/lib/alexandria/ui/export_dialog.rb +142 -0
  71. data/lib/alexandria/ui/icons.rb +47 -63
  72. data/lib/alexandria/ui/iconview.rb +12 -10
  73. data/lib/alexandria/ui/iconview_tooltips.rb +41 -54
  74. data/lib/alexandria/ui/import_dialog.rb +157 -0
  75. data/lib/alexandria/ui/init.rb +21 -33
  76. data/lib/alexandria/ui/keep_bad_isbn_dialog.rb +36 -0
  77. data/lib/alexandria/ui/libraries_combo.rb +16 -14
  78. data/lib/alexandria/ui/listview.rb +73 -87
  79. data/lib/alexandria/ui/main_app.rb +24 -26
  80. data/lib/alexandria/ui/misc_dialogs.rb +10 -0
  81. data/lib/alexandria/ui/multi_drag_treeview.rb +28 -41
  82. data/lib/alexandria/ui/{dialogs/new_book_dialog.rb → new_book_dialog.rb} +156 -194
  83. data/lib/alexandria/ui/new_book_dialog_manual.rb +139 -0
  84. data/lib/alexandria/ui/new_provider_dialog.rb +100 -0
  85. data/lib/alexandria/ui/new_smart_library_dialog.rb +74 -0
  86. data/lib/alexandria/ui/preferences_dialog.rb +313 -0
  87. data/lib/alexandria/ui/provider_preferences_base_dialog.rb +95 -0
  88. data/lib/alexandria/ui/provider_preferences_dialog.rb +35 -0
  89. data/lib/alexandria/ui/really_delete_dialog.rb +53 -0
  90. data/lib/alexandria/ui/{sidepane.rb → sidepane_manager.rb} +56 -68
  91. data/lib/alexandria/ui/skip_entry_dialog.rb +33 -0
  92. data/lib/alexandria/ui/smart_library_properties_dialog.rb +60 -0
  93. data/lib/alexandria/ui/smart_library_properties_dialog_base.rb +242 -0
  94. data/lib/alexandria/ui/smart_library_rule_box.rb +119 -0
  95. data/lib/alexandria/ui/sound.rb +11 -13
  96. data/lib/alexandria/ui/ui_manager.rb +236 -251
  97. data/lib/alexandria/undo_manager.rb +1 -0
  98. data/lib/alexandria/version.rb +4 -19
  99. data/lib/alexandria/web_themes.rb +22 -21
  100. data/po/Makefile +2 -2
  101. data/po/cs.po +993 -880
  102. data/po/cy.po +957 -874
  103. data/po/de.po +990 -869
  104. data/po/el.po +989 -869
  105. data/po/es.po +985 -865
  106. data/po/fr.po +986 -870
  107. data/po/ga.po +907 -823
  108. data/po/gl.po +981 -865
  109. data/po/it.po +986 -868
  110. data/po/ja.po +969 -853
  111. data/po/mk.po +983 -863
  112. data/po/nb.po +979 -863
  113. data/po/nl.po +983 -864
  114. data/po/pl.po +1017 -974
  115. data/po/pt.po +988 -861
  116. data/po/pt_BR.po +984 -868
  117. data/po/ru.po +992 -873
  118. data/po/sk.po +987 -869
  119. data/po/sv.po +977 -861
  120. data/po/uk.po +975 -865
  121. data/po/zh_TW.po +976 -860
  122. data/schemas/alexandria.schemas +25 -3
  123. data/share/alexandria/glade/acquire_dialog__builder.glade +15 -12
  124. data/share/alexandria/glade/book_properties_dialog__builder.glade +171 -299
  125. data/share/alexandria/glade/main_app__builder.glade +24 -33
  126. data/share/alexandria/glade/new_book_dialog__builder.glade +27 -59
  127. data/share/alexandria/glade/preferences_dialog__builder.glade +250 -290
  128. data/share/gnome/help/alexandria/C/introduction.xml +0 -8
  129. data/share/gnome/help/alexandria/C/searching.xml +1 -1
  130. data/share/gnome/help/alexandria/C/smart-libraries.xml +2 -2
  131. data/share/gnome/help/alexandria/C/working-with-libraries.xml +1 -1
  132. data/share/gnome/help/alexandria/fr/alexandria.xml +1 -1
  133. data/share/gnome/help/alexandria/ja/introduction.xml +0 -8
  134. data/share/gnome/help/alexandria/ja/smart-libraries.xml +1 -1
  135. data/spec/alexandria/book_providers/world_cat_provider_spec.rb +160 -0
  136. data/spec/alexandria/book_providers_spec.rb +75 -171
  137. data/spec/alexandria/book_spec.rb +12 -10
  138. data/spec/alexandria/console_spec.rb +27 -0
  139. data/spec/alexandria/export_library_spec.rb +130 -0
  140. data/spec/alexandria/library_spec.rb +128 -172
  141. data/spec/alexandria/library_store_spec.rb +37 -0
  142. data/spec/alexandria/preferences_spec.rb +44 -17
  143. data/spec/alexandria/scanners/cue_cat_spec.rb +52 -0
  144. data/spec/alexandria/smart_library_spec.rb +30 -25
  145. data/spec/alexandria/ui/about_dialog_spec.rb +14 -0
  146. data/spec/alexandria/ui/acquire_dialog_spec.rb +14 -0
  147. data/spec/alexandria/ui/alert_dialog_spec.rb +16 -0
  148. data/spec/alexandria/ui/bad_isbns_dialog_spec.rb +14 -0
  149. data/spec/alexandria/ui/book_properties_dialog_spec.rb +17 -0
  150. data/spec/alexandria/ui/confirm_erase_dialog_spec.rb +14 -0
  151. data/spec/alexandria/ui/conflict_while_copying_dialog_spec.rb +16 -0
  152. data/spec/alexandria/ui/error_dialog_spec.rb +14 -0
  153. data/spec/alexandria/ui/export_dialog_spec.rb +36 -0
  154. data/spec/alexandria/ui/icons_spec.rb +26 -0
  155. data/spec/alexandria/ui/iconview_spec.rb +7 -21
  156. data/spec/alexandria/ui/import_dialog_spec.rb +46 -0
  157. data/spec/alexandria/ui/keep_bad_isbn_dialog_spec.rb +17 -0
  158. data/spec/alexandria/ui/main_app_spec.rb +7 -34
  159. data/spec/alexandria/ui/new_book_dialog_manual_spec.rb +15 -0
  160. data/spec/alexandria/ui/new_book_dialog_spec.rb +22 -0
  161. data/spec/alexandria/ui/new_provider_dialog_spec.rb +30 -0
  162. data/spec/alexandria/ui/new_smart_library_dialog_spec.rb +39 -0
  163. data/spec/alexandria/ui/preferences_dialog_spec.rb +14 -0
  164. data/spec/alexandria/ui/provider_preferences_dialog_spec.rb +34 -0
  165. data/spec/alexandria/ui/really_delete_dialog_spec.rb +16 -0
  166. data/spec/alexandria/ui/sidepane_manager_spec.rb +15 -0
  167. data/spec/alexandria/ui/skip_entry_dialog_spec.rb +14 -0
  168. data/spec/alexandria/ui/smart_library_properties_dialog_spec.rb +49 -0
  169. data/spec/alexandria/ui/sound_spec.rb +2 -2
  170. data/spec/alexandria/ui/ui_manager_spec.rb +43 -20
  171. data/spec/end_to_end/basic_run_spec.rb +52 -0
  172. data/spec/spec_helper.rb +65 -33
  173. data/tasks/setup.rb +2 -2
  174. data/tasks/spec.rake +16 -3
  175. data/util/rake/fileinstall.rb +39 -35
  176. data/util/rake/gettextgenerate.rb +7 -7
  177. data/util/rake/omfgenerate.rb +7 -7
  178. metadata +178 -45
  179. data/dogtail/basic_run_test.py +0 -9
  180. data/lib/alexandria/book_providers/deastore.rb +0 -265
  181. data/lib/alexandria/book_providers/mcu.rb +0 -182
  182. data/lib/alexandria/book_providers/renaud.rb +0 -149
  183. data/lib/alexandria/ui/dialogs/about_dialog.rb +0 -61
  184. data/lib/alexandria/ui/dialogs/alert_dialog.rb +0 -72
  185. data/lib/alexandria/ui/dialogs/bad_isbns_dialog.rb +0 -51
  186. data/lib/alexandria/ui/dialogs/book_properties_dialog_base.rb +0 -426
  187. data/lib/alexandria/ui/dialogs/export_dialog.rb +0 -171
  188. data/lib/alexandria/ui/dialogs/import_dialog.rb +0 -196
  189. data/lib/alexandria/ui/dialogs/misc_dialogs.rb +0 -87
  190. data/lib/alexandria/ui/dialogs/new_book_dialog_manual.rb +0 -154
  191. data/lib/alexandria/ui/dialogs/new_smart_library_dialog.rb +0 -74
  192. data/lib/alexandria/ui/dialogs/preferences_dialog.rb +0 -568
  193. data/lib/alexandria/ui/dialogs/smart_library_properties_dialog.rb +0 -59
  194. data/lib/alexandria/ui/dialogs/smart_library_properties_dialog_base.rb +0 -420
  195. data/spec/alexandria/scanners/cuecat_spec.rb +0 -67
  196. data/spec/alexandria/ui/dialogs_spec.rb +0 -96
  197. data/spec/alexandria/ui/sidepane_spec.rb +0 -29
  198. data/spec/alexandria/ui/ui_utilities_spec.rb +0 -62
  199. data/spec/alexandria/utilities_spec.rb +0 -52
  200. data/tasks/dogtail.rake +0 -6
@@ -44,10 +44,6 @@
44
44
  <para><ulink url="http://www.barnesandnoble.com">Barnes and Noble</ulink></para>
45
45
  </listitem>
46
46
 
47
- <listitem>
48
- <para><ulink url="http://www.mcu.es">Spanish Ministry of Culture</ulink></para>
49
- </listitem>
50
-
51
47
  <listitem>
52
48
  <para><ulink url="http://www.thalia.de">Thalia</ulink></para>
53
49
  </listitem>
@@ -56,10 +52,6 @@
56
52
  <para><ulink url="http://www.internetbookshop.it">Internet Bookshop Italia</ulink></para>
57
53
  </listitem>
58
54
 
59
- <listitem>
60
- <para><ulink url="http://www.renaud-bray.com/">Renaud-Bray</ulink></para>
61
- </listitem>
62
-
63
55
  <listitem>
64
56
  <para><ulink url="http://www.loc.gov">US Library of Congress</ulink></para>
65
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
@@ -36,10 +36,6 @@
36
36
  <para><ulink url="http://www.barnesandnoble.com">Barnes and Noble</ulink></para>
37
37
  </listitem>
38
38
 
39
- <listitem>
40
- <para><ulink url="http://www.mcu.es">Spanish Ministry of Culture</ulink></para>
41
- </listitem>
42
-
43
39
  <listitem>
44
40
  <para><ulink url="http://www.thalia.de">Thalia</ulink></para>
45
41
  </listitem>
@@ -48,10 +44,6 @@
48
44
  <para><ulink url="http://www.internetbookshop.it">Internet Bookshop Italia</ulink></para>
49
45
  </listitem>
50
46
 
51
- <listitem>
52
- <para><ulink url="http://www.renaud-bray.com/">Renaud-Bray</ulink></para>
53
- </listitem>
54
-
55
47
  <listitem>
56
48
  <para><ulink url="http://www.loc.gov">米国国会図書館</ulink></para>
57
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,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
@@ -1,205 +1,109 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (C) 2005-2006 Laurent Sansonetti
4
- # Copyright (C) 2007 Joseph Method
5
- # Copyright (C) 2011, 2014, 2015 Matijs van Zuijlen
3
+ # This file is part of Alexandria.
6
4
  #
7
- # This file is part of Alexandria, a GNOME book collection manager.
8
- #
9
- # Alexandria is free software; you can redistribute it and/or
10
- # modify it under the terms of the GNU General Public License as
11
- # published by the Free Software Foundation; either version 2 of the
12
- # License, or (at your option) any later version.
13
- #
14
- # Alexandria is distributed in the hope that it will be useful,
15
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
- # General Public License for more details.
18
- #
19
- # You should have received a copy of the GNU General Public
20
- # License along with Alexandria; see the file COPYING. If not,
21
- # write to the Free Software Foundation, Inc., 51 Franklin Street,
22
- # Fifth Floor, Boston, MA 02110-1301 USA.
5
+ # See the file README.md for authorship and licensing information.
23
6
 
24
- require 'spec_helper'
7
+ require "spec_helper"
25
8
 
26
9
  describe Alexandria::BookProviders do
27
- it 'should be less clever'
10
+ it "should be less clever"
28
11
 
29
- def assert_correct_search_result(provider, query,
30
- search_type = Alexandria::BookProviders::SEARCH_BY_ISBN)
31
- begin
32
- results = provider.instance.search(query, search_type)
33
- rescue SocketError
34
- skip 'Service is offline'
12
+ describe Alexandria::BookProviders::AmazonProvider do
13
+ before do
14
+ skip "Amazon requires an API key. Remove it altogether as a provider?"
35
15
  end
36
16
 
37
- puts results.inspect if $DEBUG
38
-
39
- expect(results).to be_instance_of(Array), "Results are not an array for #{provider}"
40
- expect(results).not_to be_empty, "Results are empty for #{provider}"
41
-
42
- if search_type == Alexandria::BookProviders::SEARCH_BY_ISBN
43
- expect(results.length).to be <= 2, "Results are greater than 2 for #{provider}"
44
-
45
- book = results.first
46
-
47
- expect(book).to be_instance_of(Alexandria::Book), "Result is not a Book for #{provider}"
48
-
49
- canonical_query = Alexandria::Library.canonicalise_ean(query)
50
- canonical_result = Alexandria::Library.canonicalise_ean(book.isbn)
51
- expect(canonical_query).
52
- to eq(canonical_result),
53
- "Result's isbn #{book.isbn} is not equivalent to the requested isbn #{query} for #{provider}"
54
-
55
- if results.length == 2
56
- cover_url = results.last
57
- if cover_url
58
- expect(cover_url).
59
- to be_instance_of(String), "Unexpected cover_url #{cover_url.inspect} for #{provider}"
60
- end
61
- end
62
- else
63
- expect(results.first.first).
64
- to be_instance_of(Alexandria::Book), "Result item is not a Book for #{provider}"
17
+ it "does not piss off Rich Burridge" do
18
+ assert_correct_search_result(described_class, "033025068X")
65
19
  end
66
- results
67
- end
68
-
69
- it 'should not piss off Rich Burridge' do
70
- skip 'Amazon requires an API key. Remove it altogether as a provider?'
71
- assert_correct_search_result(Alexandria::BookProviders::AmazonProvider,
72
- '033025068X')
73
- end
74
-
75
- it 'amazon should work' do
76
- skip 'Amazon requires an API key. Remove it altogether as a provider?'
77
- assert_correct_search_result(Alexandria::BookProviders::AmazonProvider,
78
- '9780385504201')
79
- end
80
-
81
- it 'amazon title should work' do
82
- skip 'Amazon requires an API key. Remove it altogether as a provider?'
83
- assert_correct_search_result(Alexandria::BookProviders::AmazonProvider,
84
- 'A Confederacy of Dunces', Alexandria::BookProviders::SEARCH_BY_TITLE)
85
- end
86
-
87
- it 'amazon authors should work' do
88
- skip 'Amazon requires an API key. Remove it altogether as a provider?'
89
- assert_correct_search_result(Alexandria::BookProviders::AmazonProvider,
90
- 'John Kennedy Toole', Alexandria::BookProviders::SEARCH_BY_AUTHORS)
91
- end
92
-
93
- it 'amazon keyword should work' do
94
- skip 'Amazon requires an API key. Remove it altogether as a provider?'
95
- assert_correct_search_result(Alexandria::BookProviders::AmazonProvider,
96
- 'Confederacy Dunces', Alexandria::BookProviders::SEARCH_BY_KEYWORD)
97
- end
98
20
 
99
- it 'dea should work' do
100
- skip 'DEAStore is not operational at the moment'
101
- assert_correct_search_result(Alexandria::BookProviders::DeaStoreProvider,
102
- '9788817012980')
103
- assert_correct_search_result(Alexandria::BookProviders::DeaStoreProvider,
104
- '9788806134747')
105
- end
21
+ it "works" do
22
+ assert_correct_search_result(described_class, "9780385504201")
23
+ end
106
24
 
107
- # Right? Don't test if dependency isn't present.
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
108
29
 
109
- it 'LOC should work' do
110
- assert_correct_search_result(Alexandria::BookProviders::LOCProvider,
111
- '9780805335583')
112
- # this book has non-ASCII letters
113
- assert_correct_search_result(Alexandria::BookProviders::LOCProvider,
114
- '9782070379248')
115
- 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
116
34
 
117
- it 'BL should work' do
118
- assert_correct_search_result(Alexandria::BookProviders::BLProvider,
119
- '9781853260803')
35
+ it "amazon keyword should work" do
36
+ assert_correct_search_result(described_class, "Confederacy Dunces",
37
+ Alexandria::BookProviders::SEARCH_BY_KEYWORD)
38
+ end
120
39
  end
121
40
 
122
- it 'SBN should work' do
123
- assert_correct_search_result(Alexandria::BookProviders::SBNProvider,
124
- '9788835926436')
125
- 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
126
45
 
127
- it 'Barnes and Noble should work' do
128
- skip 'Barnes and Noble is not operational at the moment'
129
- assert_correct_search_result(Alexandria::BookProviders::BarnesAndNobleProvider,
130
- '9780961328917') # see #1433
46
+ it "works for a book with a title with non-ASCII letters" do
47
+ assert_correct_search_result(described_class, "9782070379248")
48
+ end
131
49
  end
132
50
 
133
- it 'MCU should work' do
134
- skip 'Needs fixing'
135
- # this book is without binding information, see bug [#2533]
136
- assert_correct_search_result(Alexandria::BookProviders::MCUProvider,
137
- '9788487982033')
138
- # this book is "agotado" (out of print), see bug [#2518]
139
- assert_correct_search_result(Alexandria::BookProviders::MCUProvider,
140
- '9788496075856')
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
141
56
  end
142
57
 
143
- it 'Proxis should work' do
144
- skip 'Needs fixing'
145
- assert_correct_search_result(Alexandria::BookProviders::ProxisProvider,
146
- '9789026965746')
147
- assert_correct_search_result(Alexandria::BookProviders::ProxisProvider,
148
- '9780586071403')
58
+ describe Alexandria::BookProviders::SBNProvider do
59
+ it "works" do
60
+ assert_correct_search_result(described_class, "9788835926436")
61
+ end
149
62
  end
150
63
 
151
- it 'Thalia should work' do
152
- skip 'Needs fixing'
153
- # german book
154
- assert_correct_search_result(Alexandria::BookProviders::ThaliaProvider,
155
- '9783896673305')
156
- # international book
157
- assert_correct_search_result(Alexandria::BookProviders::ThaliaProvider,
158
- '9780440241904')
159
- # movie dvd
160
- assert_correct_search_result(Alexandria::BookProviders::ThaliaProvider,
161
- '4010232037824')
162
- # music cd
163
- assert_correct_search_result(Alexandria::BookProviders::ThaliaProvider,
164
- '0094638203520')
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
165
69
  end
166
70
 
167
- it 'AdLibris should work' do
168
- skip 'Needs fixing: site has changed'
169
- assert_correct_search_result(Alexandria::BookProviders::AdLibrisProvider,
170
- '9789100109332')
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
171
77
  end
172
78
 
173
- it 'Siciliano should work' do
174
- skip 'Needs fixing: no results found'
175
- assert_correct_search_result(Alexandria::BookProviders::SicilianoProvider,
176
- '9788599170380')
177
- end
79
+ describe Alexandria::BookProviders::ThaliaProvider do
80
+ before do
81
+ skip "Needs fixing"
82
+ end
178
83
 
179
- it 'Renaud should work' do
180
- skip 'Marked in code as not working; remove implementation entirely.'
181
- # adultes
182
- assert_correct_search_result(Alexandria::BookProviders::RENAUDProvider,
183
- '9782894723388')
184
- # jeunesse
185
- assert_correct_search_result(Alexandria::BookProviders::RENAUDProvider,
186
- '9782764605059')
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
187
94
  end
188
95
 
189
- it 'Worldcat should work' do
190
- assert_correct_search_result(Alexandria::BookProviders::WorldCatProvider,
191
- '9780521247108')
192
- # this one is with <div class=vernacular lang="[^"]+">)
193
- assert_correct_search_result(Alexandria::BookProviders::WorldCatProvider,
194
- '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
195
101
  end
196
102
 
197
- it 'Worldcat should work with multiple authors' do
198
- results = assert_correct_search_result(Alexandria::BookProviders::WorldCatProvider,
199
- '9785941454136')
200
- this_book = results.first
201
- expect(this_book.authors).to be_instance_of(Array), 'Not an array!'
202
- # puts this_book.authors
203
- 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
204
108
  end
205
109
  end