alexandria-book-collection-manager 0.7.1 → 0.7.6

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