alexandria-book-collection-manager 0.7.4 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +31 -6
  3. data/.rubocop_todo.yml +33 -33
  4. data/.travis.yml +39 -0
  5. data/CHANGELOG.md +8 -0
  6. data/README.md +1 -1
  7. data/Rakefile +4 -2
  8. data/alexandria-book-collection-manager.gemspec +2 -1
  9. data/bin/alexandria +0 -10
  10. data/doc/FAQ +1 -2
  11. data/doc/dependency_decisions.yml +5 -5
  12. data/lib/alexandria.rb +3 -1
  13. data/lib/alexandria/book_providers.rb +1 -4
  14. data/lib/alexandria/book_providers/adlibris.rb +4 -20
  15. data/lib/alexandria/book_providers/amazon_aws.rb +15 -8
  16. data/lib/alexandria/book_providers/amazon_ecs_util.rb +16 -10
  17. data/lib/alexandria/book_providers/barnes_and_noble.rb +1 -1
  18. data/lib/alexandria/book_providers/douban.rb +2 -2
  19. data/lib/alexandria/book_providers/proxis.rb +6 -2
  20. data/lib/alexandria/book_providers/pseudomarc.rb +3 -1
  21. data/lib/alexandria/book_providers/siciliano.rb +24 -27
  22. data/lib/alexandria/book_providers/thalia.rb +1 -1
  23. data/lib/alexandria/book_providers/worldcat.rb +5 -3
  24. data/lib/alexandria/book_providers/z3950.rb +20 -14
  25. data/lib/alexandria/export_library.rb +15 -12
  26. data/lib/alexandria/import_library.rb +65 -65
  27. data/lib/alexandria/library_collection.rb +2 -1
  28. data/lib/alexandria/library_store.rb +18 -7
  29. data/lib/alexandria/models/book.rb +2 -1
  30. data/lib/alexandria/models/library.rb +9 -3
  31. data/lib/alexandria/preferences.rb +13 -6
  32. data/lib/alexandria/scanners/keyboard.rb +2 -2
  33. data/lib/alexandria/smart_library.rb +41 -39
  34. data/lib/alexandria/ui/acquire_dialog.rb +47 -48
  35. data/lib/alexandria/ui/alert_dialog.rb +2 -1
  36. data/lib/alexandria/ui/barcode_animation.rb +6 -5
  37. data/lib/alexandria/ui/book_properties_dialog_base.rb +7 -3
  38. data/lib/alexandria/ui/callbacks.rb +14 -7
  39. data/lib/alexandria/ui/dndable.rb +1 -1
  40. data/lib/alexandria/ui/export_dialog.rb +0 -2
  41. data/lib/alexandria/ui/icons.rb +2 -1
  42. data/lib/alexandria/ui/iconview.rb +5 -3
  43. data/lib/alexandria/ui/import_dialog.rb +6 -8
  44. data/lib/alexandria/ui/keep_bad_isbn_dialog.rb +4 -3
  45. data/lib/alexandria/ui/listview.rb +34 -31
  46. data/lib/alexandria/ui/multi_drag_treeview.rb +3 -2
  47. data/lib/alexandria/ui/new_book_dialog.rb +28 -30
  48. data/lib/alexandria/ui/new_book_dialog_manual.rb +3 -1
  49. data/lib/alexandria/ui/provider_preferences_base_dialog.rb +2 -1
  50. data/lib/alexandria/ui/sidepane_manager.rb +6 -3
  51. data/lib/alexandria/ui/smart_library_properties_dialog_base.rb +5 -3
  52. data/lib/alexandria/ui/ui_manager.rb +22 -12
  53. data/lib/alexandria/version.rb +2 -2
  54. data/po/Makefile +2 -2
  55. data/share/alexandria/glade/acquire_dialog__builder.glade +1 -1
  56. data/share/alexandria/glade/book_properties_dialog__builder.glade +1 -1
  57. data/share/alexandria/glade/new_book_dialog__builder.glade +1 -1
  58. data/share/alexandria/glade/preferences_dialog__builder.glade +1 -1
  59. data/share/gnome/help/alexandria/C/introduction.xml +0 -4
  60. data/share/gnome/help/alexandria/C/searching.xml +1 -1
  61. data/share/gnome/help/alexandria/ja/introduction.xml +0 -4
  62. data/spec/alexandria/book_providers_spec.rb +12 -16
  63. data/spec/alexandria/console_spec.rb +1 -1
  64. data/spec/alexandria/ui/main_app_spec.rb +4 -31
  65. data/spec/alexandria/ui/really_delete_dialog_spec.rb +2 -1
  66. data/tasks/spec.rake +6 -4
  67. data/util/rake/fileinstall.rb +3 -1
  68. metadata +19 -7
  69. data/dogtail/basic_run_test.py +0 -9
  70. data/lib/alexandria/book_providers/renaud.rb +0 -142
  71. data/tasks/dogtail.rake +0 -6
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env python
2
-
3
- from dogtail.tree import *
4
- from dogtail.utils import run
5
-
6
- run('bin/alexandria', appName = 'alexandria')
7
- app = root.application('alexandria')
8
- quit_item = app.menuItem('Quit')
9
- quit_item.doActionNamed('click')
@@ -1,142 +0,0 @@
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
- # http://en.wikipedia.org/wiki/Renaud-Bray
8
-
9
- require "net/http"
10
- require "cgi"
11
-
12
- module Alexandria
13
- class BookProviders
14
- class RENAUDProvider < GenericProvider
15
- include GetText
16
- # GetText.bindtextdomain(Alexandria::TEXTDOMAIN, :charset => "UTF-8")
17
- BASE_URI = "http://www.renaud-bray.com/"
18
- ACCENTUATED_CHARS = "áàâäçéèêëíìîïóòôöúùûü"
19
-
20
- def initialize
21
- super("RENAUD", "Renaud-Bray (Canada)")
22
- end
23
-
24
- def search(criterion, type)
25
- criterion = criterion.encode("ISO-8859-1")
26
- req = BASE_URI +
27
- "francais/menu/gabarit.asp?Rubrique=&Recherche=&Entete=Livre" \
28
- "&Page=Recherche_wsc.asp&OnlyAvailable=false&Tri="
29
- req += case type
30
- when SEARCH_BY_ISBN
31
- "ISBN"
32
- when SEARCH_BY_TITLE
33
- "Titre"
34
- when SEARCH_BY_AUTHORS
35
- "Auteur"
36
- when SEARCH_BY_KEYWORD
37
- ""
38
- else
39
- raise InvalidSearchTypeError
40
- end
41
- req += "&Phrase="
42
-
43
- req += CGI.escape(criterion)
44
- p req if $DEBUG
45
- data = transport.get(URI.parse(req))
46
- begin
47
- if type == SEARCH_BY_ISBN
48
- return to_books(data).pop
49
- else
50
- results = []
51
- to_books(data).each do |book|
52
- results << book
53
- end
54
- while /Suivant/ =~ data
55
- md = %r{Enteterouge\">([\d]*)</b>}.match(data)
56
- num = md[1].to_i + 1
57
- data = transport.get(URI.parse(req + "&PageActuelle=" + num.to_s))
58
- to_books(data).each do |book|
59
- results << book
60
- end
61
- end
62
- return results
63
- end
64
- rescue StandardError
65
- raise NoResultsError
66
- end
67
- end
68
-
69
- def url(book)
70
- "http://www.renaud-bray.com/francais/menu/gabarit.asp?Rubrique=&Recherche=" \
71
- "&Entete=Livre&Page=Recherche_wsc.asp&OnlyAvailable=false&Tri=ISBN&Phrase=" + book.isbn
72
- end
73
-
74
- private
75
-
76
- NO_BOOKS_FOUND_REGEXP =
77
- %r{<strong class="Promotion">Aucun article trouv. selon les crit.res demand.s</strong>}.freeze
78
- HYPERLINK_SCAN_REGEXP =
79
- %r{"(Jeune|Lire)Hyperlien" href.*><strong>([-,'\(\)&\#;\w\s#{ACCENTUATED_CHARS}]*)</strong></a><br>}
80
- .freeze
81
-
82
- def to_books(data)
83
- data = CGI.unescapeHTML(data)
84
- data = data.encode("UTF-8")
85
- raise NoResultsError if NO_BOOKS_FOUND_REGEXP.match?(data)
86
-
87
- titles = []
88
- data.scan(HYPERLINK_SCAN_REGEXP).each do |md|
89
- titles << md[1].strip
90
- end
91
- raise if titles.empty?
92
-
93
- authors = []
94
- data.scan(%r{Nom_Auteur.*><i>([,'.&\#;\w\s#{ACCENTUATED_CHARS}]*)</i>}).each do |md|
95
- authors2 = []
96
- md[0].split(" ").each do |author|
97
- authors2 << author.strip
98
- end
99
- authors << authors2
100
- end
101
- raise if authors.empty?
102
-
103
- isbns = []
104
- data.scan(%r{ISBN : ?</td><td>(\d+)}).each do |md|
105
- isbns << md[0].strip
106
- end
107
- raise if isbns.empty?
108
-
109
- editions = []
110
- publish_years = []
111
- data.scan(/Parution : <br>(\d{4,}-\d{2,}-\d{2,})/).each do |md|
112
- editions << md[0].strip
113
- publish_years << md[0].strip.split(/-/)[0].to_i
114
- end
115
- raise if editions.empty? || publish_years.empty?
116
-
117
- publishers = []
118
- data.scan(%r{diteur : ([,'.&\#;\w\s#{ACCENTUATED_CHARS}]*)</span><br>}).each do |md|
119
- publishers << md[0].strip
120
- end
121
- raise if publishers.empty?
122
-
123
- book_covers = []
124
- data.scan(%r{(/ImagesEditeurs/[\d]*/([\dX]*-f.(jpg|gif))
125
- |/francais/suggestion/images/livre/livre.gif)}x).each do |md|
126
- book_covers << BASE_URI + md[0].strip
127
- end
128
- raise if book_covers.empty?
129
-
130
- books = []
131
- titles.each_with_index do |title, i|
132
- books << [Book.new(title, authors[i], isbns[i], publishers[i], publish_years[i], editions[i]),
133
- book_covers[i]]
134
- # print books
135
- end
136
- raise if books.empty?
137
-
138
- books
139
- end
140
- end
141
- end
142
- end
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- desc "run dogtail integration tests"
4
- task :dogtail do
5
- `RUBYOPT='-rbundler/setup -Ilib' python dogtail/*.py`
6
- end