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.
- checksums.yaml +4 -4
- data/.rubocop.yml +31 -6
- data/.rubocop_todo.yml +33 -33
- data/.travis.yml +39 -0
- data/CHANGELOG.md +8 -0
- data/README.md +1 -1
- data/Rakefile +4 -2
- data/alexandria-book-collection-manager.gemspec +2 -1
- data/bin/alexandria +0 -10
- data/doc/FAQ +1 -2
- data/doc/dependency_decisions.yml +5 -5
- data/lib/alexandria.rb +3 -1
- data/lib/alexandria/book_providers.rb +1 -4
- data/lib/alexandria/book_providers/adlibris.rb +4 -20
- data/lib/alexandria/book_providers/amazon_aws.rb +15 -8
- data/lib/alexandria/book_providers/amazon_ecs_util.rb +16 -10
- data/lib/alexandria/book_providers/barnes_and_noble.rb +1 -1
- data/lib/alexandria/book_providers/douban.rb +2 -2
- data/lib/alexandria/book_providers/proxis.rb +6 -2
- data/lib/alexandria/book_providers/pseudomarc.rb +3 -1
- data/lib/alexandria/book_providers/siciliano.rb +24 -27
- data/lib/alexandria/book_providers/thalia.rb +1 -1
- data/lib/alexandria/book_providers/worldcat.rb +5 -3
- data/lib/alexandria/book_providers/z3950.rb +20 -14
- data/lib/alexandria/export_library.rb +15 -12
- data/lib/alexandria/import_library.rb +65 -65
- data/lib/alexandria/library_collection.rb +2 -1
- data/lib/alexandria/library_store.rb +18 -7
- data/lib/alexandria/models/book.rb +2 -1
- data/lib/alexandria/models/library.rb +9 -3
- data/lib/alexandria/preferences.rb +13 -6
- data/lib/alexandria/scanners/keyboard.rb +2 -2
- data/lib/alexandria/smart_library.rb +41 -39
- data/lib/alexandria/ui/acquire_dialog.rb +47 -48
- data/lib/alexandria/ui/alert_dialog.rb +2 -1
- data/lib/alexandria/ui/barcode_animation.rb +6 -5
- data/lib/alexandria/ui/book_properties_dialog_base.rb +7 -3
- data/lib/alexandria/ui/callbacks.rb +14 -7
- data/lib/alexandria/ui/dndable.rb +1 -1
- data/lib/alexandria/ui/export_dialog.rb +0 -2
- data/lib/alexandria/ui/icons.rb +2 -1
- data/lib/alexandria/ui/iconview.rb +5 -3
- data/lib/alexandria/ui/import_dialog.rb +6 -8
- data/lib/alexandria/ui/keep_bad_isbn_dialog.rb +4 -3
- data/lib/alexandria/ui/listview.rb +34 -31
- data/lib/alexandria/ui/multi_drag_treeview.rb +3 -2
- data/lib/alexandria/ui/new_book_dialog.rb +28 -30
- data/lib/alexandria/ui/new_book_dialog_manual.rb +3 -1
- data/lib/alexandria/ui/provider_preferences_base_dialog.rb +2 -1
- data/lib/alexandria/ui/sidepane_manager.rb +6 -3
- data/lib/alexandria/ui/smart_library_properties_dialog_base.rb +5 -3
- data/lib/alexandria/ui/ui_manager.rb +22 -12
- data/lib/alexandria/version.rb +2 -2
- data/po/Makefile +2 -2
- data/share/alexandria/glade/acquire_dialog__builder.glade +1 -1
- data/share/alexandria/glade/book_properties_dialog__builder.glade +1 -1
- data/share/alexandria/glade/new_book_dialog__builder.glade +1 -1
- data/share/alexandria/glade/preferences_dialog__builder.glade +1 -1
- data/share/gnome/help/alexandria/C/introduction.xml +0 -4
- data/share/gnome/help/alexandria/C/searching.xml +1 -1
- data/share/gnome/help/alexandria/ja/introduction.xml +0 -4
- data/spec/alexandria/book_providers_spec.rb +12 -16
- data/spec/alexandria/console_spec.rb +1 -1
- data/spec/alexandria/ui/main_app_spec.rb +4 -31
- data/spec/alexandria/ui/really_delete_dialog_spec.rb +2 -1
- data/tasks/spec.rake +6 -4
- data/util/rake/fileinstall.rb +3 -1
- metadata +19 -7
- data/dogtail/basic_run_test.py +0 -9
- data/lib/alexandria/book_providers/renaud.rb +0 -142
- data/tasks/dogtail.rake +0 -6
data/dogtail/basic_run_test.py
DELETED
@@ -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
|