alexandria-book-collection-manager 0.7.5 → 0.7.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +9 -0
  3. data/.github/workflows/ruby.yml +72 -0
  4. data/.gitignore +4 -1
  5. data/.rubocop.yml +65 -30
  6. data/.rubocop_todo.yml +49 -165
  7. data/.simplecov +5 -2
  8. data/CHANGELOG.md +64 -0
  9. data/ChangeLog.0 +19 -19
  10. data/INSTALL.md +26 -16
  11. data/README.md +31 -35
  12. data/Rakefile +18 -16
  13. data/alexandria-book-collection-manager.gemspec +35 -29
  14. data/doc/FAQ +2 -2
  15. data/doc/dependency_decisions.yml +22 -3
  16. data/lib/alexandria/about.rb +1 -1
  17. data/lib/alexandria/book_providers/bl_provider.rb +88 -0
  18. data/lib/alexandria/book_providers/douban.rb +2 -2
  19. data/lib/alexandria/book_providers/loc_provider.rb +38 -0
  20. data/lib/alexandria/book_providers/pseudomarc.rb +61 -71
  21. data/lib/alexandria/book_providers/sbn_provider.rb +108 -0
  22. data/lib/alexandria/book_providers/{thalia.rb → thalia_provider.rb} +37 -74
  23. data/lib/alexandria/book_providers/web.rb +2 -2
  24. data/lib/alexandria/book_providers/worldcat.rb +34 -38
  25. data/lib/alexandria/book_providers/z3950_provider.rb +199 -0
  26. data/lib/alexandria/book_providers.rb +48 -65
  27. data/lib/alexandria/default_preferences.rb +2 -1
  28. data/lib/alexandria/execution_queue.rb +13 -12
  29. data/lib/alexandria/export_library.rb +21 -22
  30. data/lib/alexandria/image_fetcher.rb +25 -0
  31. data/lib/alexandria/import_library.rb +46 -70
  32. data/lib/alexandria/import_library_csv.rb +16 -16
  33. data/lib/alexandria/library_sort_order.rb +3 -1
  34. data/lib/alexandria/library_store.rb +19 -20
  35. data/lib/alexandria/logging.rb +5 -9
  36. data/lib/alexandria/models/book.rb +15 -2
  37. data/lib/alexandria/models/library.rb +31 -35
  38. data/lib/alexandria/net.rb +1 -2
  39. data/lib/alexandria/preferences.rb +27 -33
  40. data/lib/alexandria/scanners/cue_cat.rb +6 -6
  41. data/lib/alexandria/scanners/keyboard.rb +1 -1
  42. data/lib/alexandria/scanners.rb +2 -2
  43. data/lib/alexandria/smart_library.rb +22 -26
  44. data/lib/alexandria/ui/about_dialog.rb +1 -1
  45. data/lib/alexandria/ui/acquire_dialog.rb +15 -19
  46. data/lib/alexandria/ui/alert_dialog.rb +36 -19
  47. data/lib/alexandria/ui/bad_isbns_dialog.rb +13 -9
  48. data/lib/alexandria/ui/barcode_animation.rb +6 -6
  49. data/lib/alexandria/ui/book_properties_dialog.rb +2 -3
  50. data/lib/alexandria/ui/book_properties_dialog_base.rb +35 -137
  51. data/lib/alexandria/ui/calendar_popup.rb +58 -0
  52. data/lib/alexandria/ui/callbacks.rb +144 -123
  53. data/lib/alexandria/ui/completion_models.rb +2 -6
  54. data/lib/alexandria/ui/confirm_erase_dialog.rb +1 -1
  55. data/lib/alexandria/ui/conflict_while_copying_dialog.rb +2 -2
  56. data/lib/alexandria/ui/error_dialog.rb +1 -1
  57. data/lib/alexandria/ui/export_dialog.rb +19 -18
  58. data/lib/alexandria/ui/icons.rb +34 -40
  59. data/lib/alexandria/ui/iconview_tooltips.rb +40 -53
  60. data/lib/alexandria/ui/import_dialog.rb +49 -48
  61. data/lib/alexandria/ui/init.rb +14 -12
  62. data/lib/alexandria/ui/keep_bad_isbn_dialog.rb +2 -2
  63. data/lib/alexandria/ui/libraries_combo.rb +10 -9
  64. data/lib/alexandria/ui/listview.rb +6 -7
  65. data/lib/alexandria/ui/main_app.rb +2 -2
  66. data/lib/alexandria/ui/multi_drag_treeview.rb +5 -7
  67. data/lib/alexandria/ui/new_book_dialog.rb +63 -65
  68. data/lib/alexandria/ui/new_book_dialog_manual.rb +1 -1
  69. data/lib/alexandria/ui/new_provider_dialog.rb +12 -11
  70. data/lib/alexandria/ui/new_smart_library_dialog.rb +39 -27
  71. data/lib/alexandria/ui/preferences_dialog.rb +25 -84
  72. data/lib/alexandria/ui/provider_preferences_base_dialog.rb +10 -6
  73. data/lib/alexandria/ui/provider_preferences_dialog.rb +5 -5
  74. data/lib/alexandria/ui/really_delete_dialog.rb +2 -2
  75. data/lib/alexandria/ui/sidepane_manager.rb +38 -38
  76. data/lib/alexandria/ui/skip_entry_dialog.rb +3 -2
  77. data/lib/alexandria/ui/smart_library_properties_dialog.rb +35 -36
  78. data/lib/alexandria/ui/smart_library_properties_dialog_base.rb +61 -244
  79. data/lib/alexandria/ui/smart_library_rule_box.rb +119 -0
  80. data/lib/alexandria/ui/sound.rb +4 -6
  81. data/lib/alexandria/ui/ui_manager.rb +80 -83
  82. data/lib/alexandria/ui.rb +7 -7
  83. data/lib/alexandria/version.rb +2 -2
  84. data/lib/alexandria/web_themes.rb +15 -15
  85. data/lib/alexandria.rb +2 -2
  86. data/po/cs.po +947 -865
  87. data/po/cy.po +913 -864
  88. data/po/de.po +961 -865
  89. data/po/el.po +956 -861
  90. data/po/es.po +952 -857
  91. data/po/fr.po +950 -865
  92. data/po/ga.po +866 -819
  93. data/po/gl.po +946 -861
  94. data/po/it.po +945 -858
  95. data/po/ja.po +921 -836
  96. data/po/mk.po +953 -858
  97. data/po/nb.po +932 -847
  98. data/po/nl.po +955 -849
  99. data/po/pl.po +999 -963
  100. data/po/pt.po +946 -850
  101. data/po/pt_BR.po +944 -859
  102. data/po/ru.po +959 -868
  103. data/po/sk.po +950 -863
  104. data/po/sv.po +944 -859
  105. data/po/uk.po +925 -846
  106. data/po/zh_TW.po +926 -841
  107. data/schemas/alexandria.schemas +1 -1
  108. data/share/alexandria/glade/main_app__builder.glade +6 -21
  109. data/share/gnome/help/alexandria/C/adding-books.xml +3 -4
  110. data/share/gnome/help/alexandria/C/introduction.xml +0 -16
  111. data/share/gnome/help/alexandria/C/searching.xml +1 -4
  112. data/share/gnome/help/alexandria/C/settings.xml +0 -30
  113. data/share/gnome/help/alexandria/C/smart-libraries.xml +2 -2
  114. data/share/gnome/help/alexandria/C/working-with-libraries.xml +1 -1
  115. data/share/gnome/help/alexandria/fr/alexandria.xml +5 -160
  116. data/share/gnome/help/alexandria/ja/adding-books.xml +1 -1
  117. data/share/gnome/help/alexandria/ja/introduction.xml +0 -15
  118. data/share/gnome/help/alexandria/ja/searching.xml +3 -7
  119. data/share/gnome/help/alexandria/ja/settings.xml +0 -27
  120. data/share/gnome/help/alexandria/ja/smart-libraries.xml +1 -1
  121. data/spec/alexandria/book_providers/bl_provider_spec.rb +13 -0
  122. data/spec/alexandria/book_providers/loc_provider_spec.rb +17 -0
  123. data/spec/alexandria/book_providers/sbn_provider_spec.rb +13 -0
  124. data/spec/alexandria/book_providers/thalia_provider_spec.rb +119 -0
  125. data/spec/alexandria/book_providers/world_cat_provider_spec.rb +160 -0
  126. data/spec/alexandria/book_providers_spec.rb +0 -154
  127. data/spec/alexandria/console_spec.rb +0 -5
  128. data/spec/alexandria/export_library_spec.rb +27 -38
  129. data/spec/alexandria/library_spec.rb +76 -46
  130. data/spec/alexandria/preferences_spec.rb +29 -3
  131. data/spec/alexandria/scanners/cue_cat_spec.rb +1 -1
  132. data/spec/alexandria/ui/about_dialog_spec.rb +1 -1
  133. data/spec/alexandria/ui/acquire_dialog_spec.rb +1 -1
  134. data/spec/alexandria/ui/alert_dialog_spec.rb +1 -1
  135. data/spec/alexandria/ui/bad_isbns_dialog_spec.rb +1 -1
  136. data/spec/alexandria/ui/book_properties_dialog_spec.rb +47 -5
  137. data/spec/alexandria/ui/confirm_erase_dialog_spec.rb +1 -1
  138. data/spec/alexandria/ui/conflict_while_copying_dialog_spec.rb +1 -1
  139. data/spec/alexandria/ui/error_dialog_spec.rb +1 -1
  140. data/spec/alexandria/ui/export_dialog_spec.rb +25 -4
  141. data/spec/alexandria/ui/icons_spec.rb +26 -0
  142. data/spec/alexandria/ui/iconview_spec.rb +1 -1
  143. data/spec/alexandria/ui/import_dialog_spec.rb +35 -3
  144. data/spec/alexandria/ui/keep_bad_isbn_dialog_spec.rb +1 -1
  145. data/spec/alexandria/ui/main_app_spec.rb +1 -1
  146. data/spec/alexandria/ui/new_book_dialog_manual_spec.rb +39 -3
  147. data/spec/alexandria/ui/new_provider_dialog_spec.rb +19 -3
  148. data/spec/alexandria/ui/new_smart_library_dialog_spec.rb +28 -3
  149. data/spec/alexandria/ui/preferences_dialog_spec.rb +2 -2
  150. data/spec/alexandria/ui/provider_preferences_dialog_spec.rb +23 -8
  151. data/spec/alexandria/ui/really_delete_dialog_spec.rb +1 -1
  152. data/spec/alexandria/ui/sidepane_manager_spec.rb +2 -2
  153. data/spec/alexandria/ui/skip_entry_dialog_spec.rb +1 -1
  154. data/spec/alexandria/ui/smart_library_properties_dialog_spec.rb +37 -6
  155. data/spec/alexandria/ui/ui_manager_spec.rb +116 -2
  156. data/spec/data/libraries/0.6.2/My Library/9780571147168.yaml +2 -0
  157. data/spec/end_to_end/basic_run_spec.rb +3 -8
  158. data/spec/fixtures/cover.jpg +0 -0
  159. data/spec/spec_helper.rb +47 -3
  160. data/tasks/spec.rake +3 -5
  161. data/util/rake/fileinstall.rb +16 -15
  162. data/util/rake/omfgenerate.rb +1 -1
  163. metadata +141 -52
  164. data/.travis.yml +0 -39
  165. data/lib/alexandria/book_providers/adlibris.rb +0 -196
  166. data/lib/alexandria/book_providers/amazon_aws.rb +0 -252
  167. data/lib/alexandria/book_providers/amazon_ecs_util.rb +0 -388
  168. data/lib/alexandria/book_providers/barnes_and_noble.rb +0 -209
  169. data/lib/alexandria/book_providers/proxis.rb +0 -175
  170. data/lib/alexandria/book_providers/siciliano.rb +0 -257
  171. data/lib/alexandria/book_providers/z3950.rb +0 -415
  172. data/spec/alexandria/ui/ui_utilities_spec.rb +0 -62
  173. data/spec/alexandria/utilities_spec.rb +0 -52
data/ChangeLog.0 CHANGED
@@ -98,7 +98,7 @@
98
98
  - test of provider MCU: added test that bugs [#2533] and [#2518]
99
99
  are fixed
100
100
  - added test of SBN, LOC and BL, and grouped together tests of
101
- providers depending on optional libraries
101
+ providers depending on optional libraries
102
102
 
103
103
  * z3950.rb:
104
104
  - refactored
@@ -595,22 +595,22 @@
595
595
 
596
596
  2005-10-13 Laurent Sansonetti <lrz@gnome.org>
597
597
 
598
- * lib/alexandria/macui/Icons.rb,
599
- lib/alexandria/macui/ImportController.rb,
600
- lib/alexandria/macui/MainController.rb,
601
- lib/alexandria/macui/TableView.rb,
602
- lib/alexandria/macui/MainWindow.nib/info.nib,
603
- lib/alexandria/macui/MainWindow.nib/keyedobjects.nib:
604
-
605
- - Fixed the end of the import action ;
606
- - Double click on a row in the libraries table view will edit ;
607
- - Added ellipsis after action names in some popup menus ;
608
- - Set the vertical scrollbar as autohide in the libraries table view ;
609
- - Double click outside a row in the libraries table view will create a
610
- new library ;
611
- - Double click outside a row in the books table view or a cell in the
612
- books matrix will open the add book sheet ;
613
- - Some cleaning.
598
+ * lib/alexandria/macui/Icons.rb,
599
+ lib/alexandria/macui/ImportController.rb,
600
+ lib/alexandria/macui/MainController.rb,
601
+ lib/alexandria/macui/TableView.rb,
602
+ lib/alexandria/macui/MainWindow.nib/info.nib,
603
+ lib/alexandria/macui/MainWindow.nib/keyedobjects.nib:
604
+
605
+ - Fixed the end of the import action ;
606
+ - Double click on a row in the libraries table view will edit ;
607
+ - Added ellipsis after action names in some popup menus ;
608
+ - Set the vertical scrollbar as autohide in the libraries table view ;
609
+ - Double click outside a row in the libraries table view will create a
610
+ new library ;
611
+ - Double click outside a row in the books table view or a cell in the
612
+ books matrix will open the add book sheet ;
613
+ - Some cleaning.
614
614
 
615
615
  2005-10-02 Laurent Sansonetti <lrz@gnome.org>
616
616
 
@@ -642,7 +642,7 @@
642
642
 
643
643
  - Removed all scanning stuff ;
644
644
  - The libraries popup menu now display a "New Library" item that
645
- automatically generates a library then adds the books in it ;
645
+ automatically generates a library then adds the books in it ;
646
646
  - Fixed the help error transcient window.
647
647
 
648
648
  * lib/alexandria/library.rb:
@@ -3242,7 +3242,7 @@
3242
3242
  Use the 'clicked' signal instead of 'pressed' for
3243
3243
  Gtk::Button's.
3244
3244
 
3245
- * data/alexandria/glade/preferences_dialog.glade,
3245
+ * data/alexandria/glade/preferences_dialog.glade,
3246
3246
  lib/alexandria/ui/preferences_dialog.rb:
3247
3247
 
3248
3248
  - Removed the network proxy tab ;
data/INSTALL.md CHANGED
@@ -23,12 +23,10 @@ You should have GTK+ 3, and use Ruby-GNOME2 `~> 3.1.0`.
23
23
  is required for the internationalisation of the user interface.
24
24
  Requires version `~> 3.1`.
25
25
 
26
- ### Hpricot
26
+ ### Nokogiri
27
27
 
28
- Alexandria uses [hpricot](https://github.com/hpricot/hpricot) to
29
- parse the HTML from web pages for providers such as Siciliano.
30
- It is also used to parse the XML for the Amazon web
31
- service.
28
+ Alexandria uses [nokogiri](https://nokogiri.org/) to parse the HTML from web
29
+ pages for web-based providers.
32
30
 
33
31
  ## HTMLEntities
34
32
 
@@ -56,23 +54,35 @@ to merge translations into generated files (and to extract
56
54
  translatable string from xml files during development).
57
55
 
58
56
  Note that these files are pre-generated in tar.gz releases, so you'll
59
- only need them if you're building from the SVN version, or want to
57
+ only need them if you're building from the Git version, or want to
60
58
  change the translations.
61
59
 
60
+ For support of the Z38.50 protocol you will need the
61
+ [`yaz`](http://www.indexdata.dk/yaz) package.
62
+
63
+ Alexandria also uses the outdate gconf2 configuration storage system, so you'll
64
+ need to install `gconf2`.
65
+
66
+ On Debian/Ubuntu systems, you can install the needed dependencies by running
67
+
68
+ ```
69
+ apt-get install gettext intltool libyaz-dev gconf2
70
+ ```
71
+
62
72
  ### Ruby/ZOOM and Yaz
63
73
 
64
- For Z39.50 support and and the *Library of Congress* and
65
- *British Library* book providers you will need
66
- [`ruby-zoom`](http://ruby-zoom.rubyforge.org), which in turn
67
- requires the non-Ruby package [`yaz`](http://www.indexdata.dk/yaz).
74
+ For Z39.50 support and the *Library of Congress* and *British Library* book
75
+ providers you will need [`ruby-zoom`](http://ruby-zoom.rubyforge.org), which in
76
+ turn requires the non-Ruby package [`yaz`](http://www.indexdata.dk/yaz) (see
77
+ Native Dependencies above).
68
78
 
69
- Note that if you install the recent Ruby/ZOOM as the `zoom` gem, you
70
- will also need to install the `marc` gem. (Older implementations of
71
- ruby-zoom contained their own implementation of MARC.)
79
+ Note that if you install the recent Ruby/ZOOM as the `zoom` gem, you will also
80
+ need to install the `marc` gem. (Older implementations of ruby-zoom contained
81
+ their own implementation of MARC.)
72
82
 
73
- The Z39.50 Object-Orientation Model (ZOOM) is an international
74
- standard for communication between computer systems, particularly
75
- libraries and information-related systems.
83
+ The Z39.50 Object-Orientation Model (ZOOM) is an international standard for
84
+ communication between computer systems, particularly libraries and
85
+ information-related systems.
76
86
 
77
87
  ### image_size
78
88
 
data/README.md CHANGED
@@ -4,7 +4,7 @@ Alexandria is a GNOME application for managing collections of books.
4
4
 
5
5
  Alexandria is written in Ruby, and is free software, distributed under
6
6
  the terms of the GNU General Public License, version 2 or later. See
7
- the file COPYING for more information.
7
+ the file [COPYING](COPYING) for more information.
8
8
 
9
9
  What is Alexandria?
10
10
  ===================
@@ -39,49 +39,45 @@ Alexandria is a simple program designed to allow individuals to keep a
39
39
  catalogue of their book collection. In addition, it enables users to
40
40
  keep track of books which are on loan.
41
41
 
42
- * retrieves and displays book information (sometimes with cover
43
- pictures) from several online libraries and bookshops, such as
44
- o Amazon
45
- o Proxis
46
- o AdLibris
47
- o Spanish Ministry of Culture
48
- o Livraria Siciliano
49
- o WorldCat
50
- o US Library of Congress
51
- o British Library
52
- * allows books to be added and updated by hand
53
- * enables searches either by ISBN, title, author or keyword
54
- * supports the Z39.50 standard and allow you to manage your own
55
- sources (e.g. university libraries)
56
- * saves data using the plain-text YAML format
57
- * can import and export data into ONIX, Tellico, ISBN-list
58
- and GoodReads CSV formats
59
- * can export XHTML web pages of your libraries, themable with CSS
60
- * allows marking your books as loaned, each with the loan-date and
61
- the name of the person who has borrowed them
62
- * features a HIG-compliant user interface
63
- * shows books in different views (standard list or icons list),
64
- that can be filtered and/or sorted
65
- * handles book rating and notes
66
- * supports CueCat and standard "keyboard wedge" barcode readers
67
- * includes translations for several languages
68
- * is documented in a complete manual (at the moment only in
69
- English and Japanese)
70
-
71
- Alexandria is not without problems. See doc/BUGS for a summary of issues.
42
+ * retrieves and displays book information (sometimes with cover
43
+ pictures) from several online libraries and bookshops, such as
44
+ - WorldCat
45
+ - US Library of Congress
46
+ - British Library
47
+ * allows books to be added and updated by hand
48
+ * enables searches either by ISBN, title, author or keyword
49
+ * supports the Z39.50 standard and allow you to manage your own
50
+ sources (e.g. university libraries)
51
+ * saves data using the plain-text YAML format
52
+ * can import and export data into ONIX, Tellico, ISBN-list
53
+ and GoodReads CSV formats
54
+ * can export XHTML web pages of your libraries, themable with CSS
55
+ * allows marking your books as loaned, each with the loan-date and
56
+ the name of the person who has borrowed them
57
+ * features a HIG-compliant user interface
58
+ * shows books in different views (standard list or icons list),
59
+ that can be filtered and/or sorted
60
+ * handles book rating and notes
61
+ * supports CueCat and standard "keyboard wedge" barcode readers
62
+ * includes translations for several languages
63
+ * is documented in a complete manual (at the moment only in
64
+ English and Japanese)
65
+
66
+ Alexandria is not without problems. See [doc/BUGS](doc/BUGS) for a
67
+ summary of issues.
72
68
 
73
69
  ## Installation
74
70
 
75
71
  There are full instructions for installing Alexandria from source in the
76
- file INSTALL, including information about all the dependencies.
72
+ file [INSTALL](INSTALL), including information about all the dependencies.
77
73
 
78
74
  If you are installing on a Debian-based system, things should be
79
75
  easier as the dependencies can be handled automatically.
80
76
 
81
77
  To run the program, just type
82
- alexandria
78
+ `alexandria`
83
79
  or, to get verbose debugging information,
84
- alexandria --debug
80
+ `alexandria --debug`
85
81
 
86
82
  If you are running GNOME, Alexandria should appear under the
87
83
  'Applications > Office' menu.
@@ -166,4 +162,4 @@ Copyright (C) 2005-2010,2014-2020 Alexandria Contributors
166
162
  Alexandria is free software; you can redistribute it and/or modify it under the
167
163
  terms of the GNU General Public License as published by the Free Software
168
164
  Foundation; either version 2 of the License, or (at your option) any later
169
- version. See the file COPYING for details.
165
+ version. See the file [COPYING](COPYING) for details.
data/Rakefile CHANGED
@@ -30,25 +30,25 @@ end
30
30
 
31
31
  OmfGenerateTask.new(PROJECT) do |o|
32
32
  o.gnome_helpfiles_dir = "#{SHARE}/gnome/help"
33
- o.generate_omf("data/omf/alexandria", "share/omf/alexandria/*.in")
33
+ o.generate_omf("share/omf/alexandria", "share/omf/alexandria/*.in")
34
34
  end
35
35
 
36
- SHARE_FILE_GLOBS = ["data/alexandria/**/*", "data/gnome/**/*.*",
37
- "data/locale/**/*.mo", "data/omf/**/*.omf",
38
- "data/sounds/**/*.ogg"].freeze # , 'data/menu/*']
36
+ SHARE_FILE_GLOBS = ["share/alexandria/**/*", "share/gnome/**/*.*",
37
+ "share/locale/**/*.mo", "share/omf/**/*.omf",
38
+ "share/sounds/**/*.ogg"].freeze # , 'share/menu/*']
39
39
 
40
- ICON_FILE_GLOBS = ["data/app-icon/**/*.png",
41
- "data/app-icon/scalable/*.svg"].freeze
40
+ ICON_FILE_GLOBS = ["share/app-icon/**/*.png",
41
+ "share/app-icon/scalable/*.svg"].freeze
42
42
 
43
- PIXMAP_GLOBS = "data/app-icon/32x32/*.xpm"
43
+ PIXMAP_GLOBS = "share/app-icon/32x32/*.xpm"
44
44
 
45
45
  def install_common(install_task)
46
46
  install_task.install_exe("bin", "bin/*", "#{PREFIX}/bin")
47
47
  install_task.install("lib", "lib/**/*.rb", install_task.rubylib)
48
48
 
49
- install_task.install("data", SHARE_FILE_GLOBS, SHARE)
49
+ install_task.install("share", SHARE_FILE_GLOBS, SHARE)
50
50
  install_task.install_icons(ICON_FILE_GLOBS, "#{SHARE}/icons")
51
- install_task.install("data/app-icon/32x32", PIXMAP_GLOBS, "#{SHARE}/pixmaps")
51
+ install_task.install("share/app-icon/32x32", PIXMAP_GLOBS, "#{SHARE}/pixmaps")
52
52
 
53
53
  install_task.install("", "schemas/alexandria.schemas", "#{SHARE}/gconf")
54
54
  install_task.install("", "alexandria.desktop", "#{SHARE}/applications")
@@ -107,8 +107,10 @@ def convert_with_type(value, type)
107
107
  value.to_f
108
108
  when "bool"
109
109
  value == "true"
110
+ when "string"
111
+ value.to_s.strip
110
112
  else
111
- value.strip
113
+ raise NotImplementedError, "Unknown type #{type}"
112
114
  end
113
115
  end
114
116
 
@@ -117,14 +119,13 @@ SCHEMA_PATH = "schemas/alexandria.schemas"
117
119
  # This generates default_preferences.rb by copying over values from
118
120
  # providers_priority key in alexandria.schemas (necessary?)
119
121
 
120
- file "lib/alexandria/default_preferences.rb" => [SCHEMA_PATH] do |f|
122
+ file "lib/alexandria/default_preferences.rb" => ["Rakefile", SCHEMA_PATH] do |f|
121
123
  require "rexml/document"
122
124
  generated_lines = []
123
125
 
124
- doc = REXML::Document.new(IO.read(SCHEMA_PATH))
126
+ doc = REXML::Document.new(File.read(SCHEMA_PATH))
125
127
  doc.elements.each("gconfschemafile/schemalist/schema") do |element|
126
128
  default = element.elements["default"].text
127
- next unless default
128
129
 
129
130
  varname = File.basename(element.elements["key"].text)
130
131
  type = element.elements["type"].text
@@ -133,10 +134,11 @@ file "lib/alexandria/default_preferences.rb" => [SCHEMA_PATH] do |f|
133
134
  ary = default[1..-2].split(",")
134
135
  next if ary.empty?
135
136
 
136
- if type == "list"
137
+ case type
138
+ when "list"
137
139
  list_type = element.elements["list_type"].text
138
140
  ary.map! { |x| convert_with_type(x, list_type) }
139
- elsif type == "pair"
141
+ when "pair"
140
142
  next if ary.length != 2
141
143
 
142
144
  ary[0] = convert_with_type(ary[0],
@@ -200,7 +202,7 @@ Rake::PackageTask.new(PROJECT, Alexandria::DISPLAY_VERSION) do |p|
200
202
  "Rakefile", "util/**/*",
201
203
  "TODO.md", "alexandria.desktop",
202
204
  "alexandria.desktop.in",
203
- "bin/**/*", "data/**/*", "misc/**/*",
205
+ "bin/**/*", "share/**/*", "misc/**/*",
204
206
  "doc/**/*", "lib/**/*", "po/**/*",
205
207
  "schemas/**/*", "spec/**/*")
206
208
  end
@@ -2,14 +2,10 @@
2
2
 
3
3
  require_relative "lib/alexandria/version"
4
4
 
5
- Gem::Specification.new do |s|
6
- s.name = "alexandria-book-collection-manager"
7
- s.version = Alexandria::VERSION
8
-
9
- s.summary = "GNOME application for managing collections of books"
10
- s.required_ruby_version = ">= 2.5.0"
11
-
12
- s.authors = [
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "alexandria-book-collection-manager"
7
+ spec.version = Alexandria::VERSION
8
+ spec.authors = [
13
9
  "Alexander McCormmach",
14
10
  "Aymeric Nys",
15
11
  "Cathal Mc Ginley",
@@ -32,32 +28,42 @@ Gem::Specification.new do |s|
32
28
  "Timothy Malone",
33
29
  "Zachary P. Landau"
34
30
  ]
35
- s.email = ["matijs@matijs.net"]
36
- s.homepage = "http://www.github.com/mvz/alexandria-book-collection-manager"
31
+ spec.email = ["matijs@matijs.net"]
37
32
 
38
- s.license = "GPL-2"
33
+ spec.summary = "GNOME application for managing collections of books"
39
34
 
40
- s.files = `git ls-files -z`.split("\0") |
41
- ["lib/alexandria/default_preferences.rb"]
35
+ spec.homepage = "http://www.github.com/mvz/alexandria-book-collection-manager"
36
+ spec.license = "GPL-2.0+"
42
37
 
43
- s.executables = ["alexandria"]
38
+ spec.required_ruby_version = ">= 2.6.0"
39
+
40
+ spec.metadata["rubygems_mfa_required"] = "true"
41
+
42
+ spec.files = `git ls-files -z`.split("\0") |
43
+ ["lib/alexandria/default_preferences.rb"]
44
44
 
45
- s.rdoc_options = ["--main", "README.md"]
45
+ spec.executables = ["alexandria"]
46
46
 
47
- s.add_runtime_dependency("gettext", ["~> 3.1"])
48
- s.add_runtime_dependency("gstreamer", ["~> 3.4.1"])
49
- s.add_runtime_dependency("gtk3", ["~> 3.4.1"])
50
- s.add_runtime_dependency("hpricot", ["~> 0.8.5"])
51
- s.add_runtime_dependency("htmlentities", ["~> 4.3"])
52
- s.add_runtime_dependency("image_size", ["~> 2.0"])
53
- s.add_runtime_dependency("marc", ["~> 1.0.0"])
54
- s.add_runtime_dependency("psych", ["~> 3.1.0"])
55
- s.add_runtime_dependency("zoom", ["~> 0.5.0"])
47
+ spec.require_paths = ["lib"]
48
+ spec.rdoc_options = ["--main", "README.md"]
56
49
 
57
- s.add_development_dependency("gnome_app_driver", ["~> 0.2.1"])
58
- s.add_development_dependency("minitest", ["~> 5.0"])
59
- s.add_development_dependency("rake", ["~> 13.0"])
60
- s.add_development_dependency("rspec", ["~> 3.0"])
50
+ spec.add_runtime_dependency("gettext", ["~> 3.1"])
51
+ spec.add_runtime_dependency("gstreamer", ["~> 3.5.0"])
52
+ spec.add_runtime_dependency("gtk3", ["~> 3.5.0"])
53
+ spec.add_runtime_dependency("htmlentities", ["~> 4.3"])
54
+ spec.add_runtime_dependency("image_size", ["~> 3.0"])
55
+ spec.add_runtime_dependency("marc", ">= 1.0", "< 1.2")
56
+ spec.add_runtime_dependency("nokogiri", ["~> 1.11"])
57
+ spec.add_runtime_dependency("psych", ">= 3.2", "< 4.1")
58
+ spec.add_runtime_dependency("zoom", ["~> 0.5.0"])
61
59
 
62
- s.require_paths = ["lib"]
60
+ spec.add_development_dependency("gnome_app_driver", "~> 0.3.0")
61
+ spec.add_development_dependency("rake", ["~> 13.0"])
62
+ spec.add_development_dependency("rspec", ["~> 3.0"])
63
+ spec.add_development_dependency("rubocop", "~> 1.25")
64
+ spec.add_development_dependency("rubocop-i18n", ["~> 3.0"])
65
+ spec.add_development_dependency("rubocop-performance", "~> 1.13")
66
+ spec.add_development_dependency("rubocop-rake", "~> 0.6.0")
67
+ spec.add_development_dependency("rubocop-rspec", "~> 2.7")
68
+ spec.add_development_dependency("webmock", "~> 3.9")
63
69
  end
data/doc/FAQ CHANGED
@@ -291,8 +291,8 @@ of "Name Surname".
291
291
 
292
292
  Answer: Alexandria relies on what the providers say:
293
293
  some providers report "Surname Name": Webster.it, Ibs.it,
294
- some "Name Surname": Bn, Thalia, Bol.it, Adlibris, L Siciliano, Worldcat,
295
- and some without any rule: Amazon, Proxis.
294
+ some "Name Surname": Bn, Thalia, Bol.it, Worldcat,
295
+ and some without any rule: Amazon.
296
296
  You can change, in the preferences, the order in which the providers are
297
297
  queried.
298
298
 
@@ -53,9 +53,28 @@
53
53
  :why:
54
54
  :versions: []
55
55
  :when: 2017-07-23 05:54:54.822319735 Z
56
- - - :approve
56
+ - - :license
57
57
  - zoom
58
+ - LGPL-2.1
59
+ - :who:
60
+ :why:
61
+ :versions: []
62
+ :when: 2020-07-30 06:44:22.960902375 Z
63
+ - - :permit
64
+ - Simplified BSD
65
+ - :who:
66
+ :why:
67
+ :versions: []
68
+ :when: 2020-07-30 06:45:58.599399721 Z
69
+ - - :permit
70
+ - Apache 2.0
58
71
  - :who:
59
- :why: Actually licensed under LGPL-2.1
72
+ :why:
73
+ :versions: []
74
+ :when: 2020-07-30 06:46:08.280121582 Z
75
+ - - :permit
76
+ - LGPL-2.1
77
+ - :who:
78
+ :why:
60
79
  :versions: []
61
- :when: 2017-07-23 06:00:43.594558953 Z
80
+ :when: 2020-07-30 06:46:32.729325577 Z
@@ -26,7 +26,7 @@ module Alexandria
26
26
  bindtextdomain(Alexandria::TEXTDOMAIN, charset: "UTF-8")
27
27
  DESCRIPTION = _("A program to help you manage your book collection.")
28
28
  COPYRIGHT = "Copyright (C) 2004-2006 Laurent Sansonetti\n" \
29
- "Copyright (C) 2007-2010,2014,2015 Alexandria Contributors"
29
+ "Copyright (C) 2007-2010,2014,2015 Alexandria Contributors"
30
30
  AUTHORS = [
31
31
  "Alexander McCormmach <alexander@tunicate.org>",
32
32
  "Aymeric Nys <aymeric@nnx.com>",
@@ -0,0 +1,88 @@
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 "alexandria/book_providers/z3950_provider"
8
+
9
+ module Alexandria
10
+ class BookProviders
11
+ class BLProvider < Z3950Provider
12
+ # http://en.wikipedia.org/wiki/Copac
13
+ # http://en.wikipedia.org/wiki/British_Library
14
+ # http://www.bl.uk/catalogues/z3950fullaccess.html
15
+ # http://www.bl.uk/catalogues/z3950copacaccess.html
16
+ #
17
+ # FIXME: switch from BL to Copac, which incudes the BL itself and many more
18
+ # libraries: http://copac.ac.uk/libraries/
19
+ #
20
+ # Details: http://copac.ac.uk/interfaces/z39.50/
21
+ # The SUTRS format used by Copac is different from the one used by BL
22
+ unabstract
23
+
24
+ include GetText
25
+ GetText.bindtextdomain(Alexandria::TEXTDOMAIN, charset: "UTF-8")
26
+
27
+ def initialize
28
+ super("BL", _("British Library"))
29
+ prefs.variable_named("hostname").default_value = "z3950cat.bl.uk"
30
+ prefs.variable_named("port").default_value = 9909
31
+ prefs.variable_named("database").default_value = "BLAC"
32
+ prefs.variable_named("record_syntax").default_value = "SUTRS"
33
+ prefs.variable_named("charset").default_value = "ISO-8859-1"
34
+ prefs.read
35
+ end
36
+
37
+ def url(book)
38
+ "http://copac.ac.uk/openurl?isbn=" + Library.canonicalise_isbn(book.isbn)
39
+ rescue StandardError => ex
40
+ log.warn { "Cannot create url for book #{book}; #{ex.message}" }
41
+ nil
42
+ end
43
+
44
+ private
45
+
46
+ def books_from_sutrs(resultset)
47
+ results = []
48
+ resultset[0..9].each do |record|
49
+ text = record.render(prefs["charset"], "UTF-8")
50
+ # File.open(',bl.marc', 'wb') {|f| f.write(text) }
51
+ log.debug { text }
52
+
53
+ title = isbn = publisher = publish_year = edition = nil
54
+ authors = []
55
+
56
+ text.split("\n").each do |line|
57
+ if (md = /^Title:\s+(.*)$/.match(line))
58
+ title = md[1].sub(/\.$/, "").squeeze(" ")
59
+ elsif (md = /^(?:Added Person|ME-Personal) Name:\s+(.*),[^,]+$/.match(line))
60
+ authors << md[1]
61
+ elsif (md = /^ISBN:\s+([\dXx]+)/.match(line))
62
+ isbn = Library.canonicalise_ean(md[1])
63
+ elsif (md = /^Imprint:.+:\s*(.+),/.match(line))
64
+ publisher = md[1]
65
+ end
66
+ end
67
+
68
+ log.debug do
69
+ msg = "Parsing SUTRS"
70
+ msg += "\n title: #{title}"
71
+ msg += "\n authors: #{authors.join(' and ')}"
72
+ msg += "\n isbn: #{isbn}"
73
+ msg += "\n publisher: #{publisher}"
74
+ msg += "\n edition: #{edition}"
75
+ msg
76
+ end
77
+
78
+ if title # and !authors.empty?
79
+ book = Book.new(title, authors, isbn, (publisher || nil),
80
+ (publish_year || nil), (edition || nil))
81
+ results << [book]
82
+ end
83
+ end
84
+ results
85
+ end
86
+ end
87
+ end
88
+ end
@@ -16,7 +16,7 @@ require "yaml"
16
16
  module Alexandria
17
17
  class BookProviders
18
18
  class DoubanProvider < GenericProvider
19
- include Alexandria::Logging
19
+ include Logging
20
20
 
21
21
  SITE = "http://www.douban.com"
22
22
  BASE_URL = "http://api.douban.com/book/subjects?q=%s&max-results=5&alt=json"
@@ -58,7 +58,7 @@ module Alexandria
58
58
  def json2yaml(json)
59
59
  # insert spaces after : and , except within strings
60
60
  # i.e. when followed by numeral, quote, { or [
61
- yaml = json.gsub(/(\:|\,)([0-9'"{\[])/) do |_match|
61
+ yaml = json.gsub(/(:|,)([0-9'"{\[])/) do |_match|
62
62
  "#{Regexp.last_match[1]} #{Regexp.last_match[2]}"
63
63
  end
64
64
  yaml.gsub!(%r{\\/}, "/") # unescape forward slashes
@@ -0,0 +1,38 @@
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 "alexandria/book_providers/z3950_provider"
8
+
9
+ module Alexandria
10
+ class BookProviders
11
+ class LOCProvider < Z3950Provider
12
+ # http://en.wikipedia.org/wiki/Library_of_Congress
13
+ unabstract
14
+
15
+ include GetText
16
+ GetText.bindtextdomain(Alexandria::TEXTDOMAIN, charset: "UTF-8")
17
+
18
+ def initialize
19
+ super("LOC", _("Library of Congress (Usa)"))
20
+ prefs.variable_named("hostname").default_value = "z3950.loc.gov"
21
+ prefs.variable_named("port").default_value = 7090
22
+ prefs.variable_named("database").default_value = "Voyager"
23
+ prefs.variable_named("record_syntax").default_value = "USMARC"
24
+ prefs.variable_named("charset").default_value = "ISO-8859-1"
25
+ prefs.read
26
+ end
27
+
28
+ def url(book)
29
+ isbn = Library.canonicalise_isbn(book.isbn)
30
+ "http://catalog.loc.gov/cgi-bin/Pwebrecon.cgi?" \
31
+ "DB=local&CNT=25+records+per+page&CMD=isbn+#{isbn}"
32
+ rescue StandardError => ex
33
+ log.warn { "Cannot create url for book #{book}; #{ex.message}" }
34
+ nil
35
+ end
36
+ end
37
+ end
38
+ end